File tree Expand file tree Collapse file tree 4 files changed +29
-2
lines changed Expand file tree Collapse file tree 4 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -542,6 +542,10 @@ -(void)sqlString:(NSMutableString*)sql AddOder:(NSString*)orderby offset:(int)of
542
542
{
543
543
[sql appendFormat: @" limit %d offset %d " ,count,offset];
544
544
}
545
+ else if (offset > 0 )
546
+ {
547
+ [sql appendFormat: @" limit %d offset %d " ,INT_MAX,offset];
548
+ }
545
549
}
546
550
- (NSMutableArray *)executeOneColumnResult : (FMResultSet *)set
547
551
{
Original file line number Diff line number Diff line change @@ -13,6 +13,17 @@ @interface LKDateFormatter : NSDateFormatter
13
13
@end
14
14
15
15
@implementation LKDateFormatter
16
+ - (id )init
17
+ {
18
+ self = [super init ];
19
+ if (self) {
20
+ self.lock = [[NSLock alloc ]init];
21
+ self.generatesCalendarDates = YES ;
22
+ self.dateStyle = NSDateFormatterNoStyle;
23
+ self.timeStyle = NSDateFormatterNoStyle;
24
+ }
25
+ return self;
26
+ }
16
27
// 防止在IOS5下 多线程 格式化时间时 崩溃
17
28
-(NSDate *)dateFromString : (NSString *)string
18
29
{
@@ -98,6 +109,9 @@ +(NSString*)stringWithDate:(NSDate*)date
98
109
{
99
110
NSDateFormatter * formatter = [self getDBDateFormat ];
100
111
NSString * datestr = [formatter stringFromDate: date];
112
+ if (datestr.length > 19 ){
113
+ datestr = [datestr substringToIndex: 19 ];
114
+ }
101
115
return datestr;
102
116
}
103
117
+(NSDate *)dateWithString : (NSString *)str
Original file line number Diff line number Diff line change 66
66
*/
67
67
-(void )userSetValueForModel : (LKDBProperty*)property value : (id )value ;
68
68
69
-
69
+ +( NSDateFormatter *) getModelDateFormatter ;
70
70
// lkdbhelper use
71
71
-(id )modelGetValue : (LKDBProperty*)property ;
72
72
-(void )modelSetValue : (LKDBProperty*)property value : (id )value ;
Original file line number Diff line number Diff line change @@ -65,6 +65,9 @@ +(NSDictionary *)getTableMapping
65
65
return nil ;
66
66
}
67
67
#pragma mark- Table Data Function 表数据
68
+ +(NSDateFormatter *)getModelDateFormatter {
69
+ return nil ;
70
+ }
68
71
-(id )modelGetValue : (LKDBProperty *)property
69
72
{
70
73
id value = [self valueForKey: property.propertyName];
@@ -83,7 +86,13 @@ -(id)modelGetValue:(LKDBProperty *)property
83
86
}
84
87
else if ([value isKindOfClass: [NSDate class ]])
85
88
{
86
- returnValue = [LKDBUtils stringWithDate: value];
89
+ NSDateFormatter * formatter = [self .class getModelDateFormatter ];
90
+ if (formatter){
91
+ returnValue = [formatter stringFromDate: value];
92
+ }
93
+ else {
94
+ returnValue = [LKDBUtils stringWithDate: value];
95
+ }
87
96
}
88
97
else if ([value isKindOfClass: [UIColor class ]])
89
98
{
You can’t perform that action at this time.
0 commit comments