@@ -82,7 +82,7 @@ -(NSString *)db_tableName
82
82
}
83
83
-(BOOL )db_inserting
84
84
{
85
- return [objc_getAssociatedObject (self , &LKModelBase_Key_Inserting) boolValue ];
85
+ return [objc_getAssociatedObject (self , &LKModelBase_Key_Inserting) boolValue ];
86
86
}
87
87
-(void )setDb_inserting : (BOOL )db_inserting
88
88
{
@@ -624,7 +624,7 @@ -(id)db_objectWithDictionary:(NSDictionary*)dic
624
624
{
625
625
BOOL isNeedAddDot = NO ;
626
626
NSMutableString * sb = [NSMutableString stringWithFormat: @" select rowid,* from %@ where" ,tableName];
627
-
627
+
628
628
NSArray * allKeys = pv.allKeys ;
629
629
for (NSString * key in allKeys)
630
630
{
@@ -749,11 +749,11 @@ -(NSDictionary *)db_getPrimaryKeysValues
749
749
id value = nil ;
750
750
if ([property.type isEqualToString: LKSQL_Mapping_UserCalculate])
751
751
{
752
- value = [self userGetValueForModel: property];
752
+ value = [self userGetValueForModel: property];
753
753
}
754
754
else
755
755
{
756
- value = [self modelGetValue: property];
756
+ value = [self modelGetValue: property];
757
757
}
758
758
if (value)
759
759
{
@@ -924,17 +924,12 @@ + (void)getSelfPropertys:(NSMutableArray *)pronames protypes:(NSMutableArray *)p
924
924
unsigned int outCount = 0 , i = 0 ;
925
925
objc_property_t *properties = class_copyPropertyList (self, &outCount);
926
926
927
- id respondInstance = nil ;
928
- if (outCount > 0 )
929
- {
930
- respondInstance = [[self alloc ]init];
931
- }
932
927
for (i = 0 ; i < outCount; i++) {
933
928
objc_property_t property = properties[i];
934
929
NSString *propertyName = [NSString stringWithCString: property_getName (property) encoding: NSUTF8StringEncoding];
935
930
936
931
// 取消rowid 的插入 //子类 已重载的属性 取消插入
937
- if ([propertyName isEqualToString: @" rowid" ] ||
932
+ if (propertyName. length == 0 || [propertyName isEqualToString: @" rowid" ] ||
938
933
[pronames indexOfObject: propertyName] != NSNotFound )
939
934
{
940
935
continue ;
@@ -944,10 +939,12 @@ + (void)getSelfPropertys:(NSMutableArray *)pronames protypes:(NSMutableArray *)p
944
939
// /过滤只读属性
945
940
if ([propertyType rangeOfString: @" ,R," ].length > 0 || [propertyType hasSuffix: @" ,R" ])
946
941
{
947
- NSString * setMethodString = [NSString stringWithFormat: @" set%@ :" ,[propertyName capitalizedString ]];
942
+ NSString * firstWord = [[propertyName substringToIndex: 1 ] uppercaseString ];
943
+ NSString * otherWord = [propertyName substringFromIndex: 1 ];
944
+ NSString * setMethodString = [NSString stringWithFormat: @" set%@%@ :" ,firstWord,otherWord];
948
945
SEL setSEL = NSSelectorFromString (setMethodString);
949
946
// /有set方法就不过滤了
950
- if ([respondInstance respondsToSelector : setSEL] == NO )
947
+ if ([self instancesRespondToSelector : setSEL] == NO )
951
948
{
952
949
continue ;
953
950
}
@@ -1030,7 +1027,6 @@ + (void)getSelfPropertys:(NSMutableArray *)pronames protypes:(NSMutableArray *)p
1030
1027
[pronames addObject: propertyName];
1031
1028
[protypes addObject: propertyClassName];
1032
1029
}
1033
- respondInstance = nil ;
1034
1030
free (properties);
1035
1031
if ([self isContainParent ] && [self superclass ] != [NSObject class ])
1036
1032
{
0 commit comments