Skip to content

Commit

Permalink
code clean & fix #106
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jun 19, 2017
1 parent 728e46d commit 1c7fc13
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 320 deletions.
18 changes: 6 additions & 12 deletions LKDBHelper/Helper/LKDB+Mapping.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ + (void)setUserCalculateForCN:(NSString *)columnName
LKDBProperty *property = [infos objectWithSqlColumnName:columnName];
if (property) {
[property enableUserCalculate];
}
else {
} else {
[infos addDBPropertyWithType:LKSQL_Mapping_UserCalculate cname:columnName ctype:LKSQL_Type_Text pname:columnName ptype:@"NSString"];
}
}
Expand Down Expand Up @@ -115,11 +114,9 @@ + (void)setTableColumnName:(NSString *)columnName bindingPropertyName:(NSString
if (column) {
[infos updateProperty:column propertyName:propertyName];
column.propertyType = property.propertyType;
}
else if ([property.sqlColumnName isEqualToString:property.propertyName]) {
} else if ([property.sqlColumnName isEqualToString:property.propertyName]) {
[infos updateProperty:property sqlColumnName:columnName];
}
else {
} else {
[infos addDBPropertyWithType:LKSQL_Mapping_Binding cname:columnName ctype:LKSQL_Type_Text pname:propertyName ptype:property.propertyType];
}
}
Expand Down Expand Up @@ -169,14 +166,12 @@ - (id)initWithKeyMapping:(NSDictionary *)keyMapping propertyNames:(NSArray *)pro
if ([mappingValue isEqualToString:LKSQL_Mapping_UserCalculate]) {
type = LKSQL_Mapping_UserCalculate;
column_type = LKSQL_Type_Text;
}
else {
} else {

if ([mappingValue isEqualToString:LKSQL_Mapping_Inherit] || [mappingValue isEqualToString:LKSQL_Mapping_Binding]) {
type = LKSQL_Mapping_Inherit;
property_name = column_name;
}
else {
} else {
type = LKSQL_Mapping_Binding;
property_name = mappingValue;
}
Expand All @@ -191,8 +186,7 @@ - (id)initWithKeyMapping:(NSDictionary *)keyMapping propertyNames:(NSArray *)pro

[self addDBPropertyWithType:type cname:column_name ctype:column_type pname:property_name ptype:property_type];
}
}
else {
} else {
for (NSInteger i = 0; i < propertyNames.count; i++) {

type = LKSQL_Mapping_Inherit;
Expand Down
8 changes: 4 additions & 4 deletions LKDBHelper/Helper/LKDBHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
// Copyright (c) 2012年 LJH. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <FMDB/FMDB.h>
#import "LKDBUtils.h"
#import "LKDB+Mapping.h"
#import "LKDBUtils.h"
#import "NSObject+LKDBHelper.h"
#import "NSObject+LKModel.h"
#import <FMDB/FMDB.h>
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -176,7 +176,7 @@ NS_ASSUME_NONNULL_BEGIN
orderBy:(nullable NSString *)orderBy
offset:(NSInteger)offset
count:(NSInteger)count
callback:(void (^)(NSMutableArray * _Nullable array))block;
callback:(void (^)(NSMutableArray *_Nullable array))block;

///return first model or nil
- (nullable id)searchSingle:(Class)modelClass where:(nullable id)where orderBy:(nullable NSString *)orderBy;
Expand Down
Loading

0 comments on commit 1c7fc13

Please sign in to comment.