好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

使用LKDBHelper 插入相同id时候应该是更新数据而不是插入新的数据

"JSONModel.h"

 

@interface InfoModel : JSONModel

@property ( nonatomic , copy ) NSString *name;

@property ( nonatomic , copy ) NSString *age;

@property ( nonatomic , copy ) NSString *sex;

@property ( nonatomic , copy ) NSString *vid;

@end

 

 

#import "InfoModel.h"

 

@implementation InfoModel

// DB

// 修改 主键

+( NSString *)getPrimaryKey

{

    return @"vid" ;

}

// 表名

+( NSString *)getTableName

{

    return @"InfoModel" ;

}

// 表版本

+( int )getTableVersion

{

    return 1 ;

}

 

 

@end

使用LKDBHelper 插入相同id时候应该是更新数据而不是插入新的数据

标签:

查看更多关于使用LKDBHelper 插入相同id时候应该是更新数据而不是插入新的数据的详细内容...

  阅读:22次