li6185377 / LKDBHelper-SQLite-ORM

全自动的插入,查询,更新,删除, an automatic database operation thread-safe and not afraid of recursive deadlock
MIT License
1.21k stars 288 forks source link

怎么保存类里的类 #136

Closed wangxiaola closed 5 years ago

wangxiaola commented 5 years ago

大神你好,我要保存一个类,这个类里有个属性类对象 ,为啥我保存的这个属性对象是个地址,不能保存这个对象吗,我怎么才能完整的保存这个类里的所有类属性

wangxiaola commented 5 years ago

2019-03-13 10:57:08.866395+0800 teamTripManagement[5437:3407853] [logging] near "index": syntax error 2019-03-13 10:57:08.866444+0800 teamTripManagement[5437:3407853] DB Error: 1 "near "index": syntax error" 2019-03-13 10:57:08.866467+0800 teamTripManagement[5437:3407853] DB Query: CREATE TABLE IF NOT EXISTS IGQuestionnaireEntryQuestionData(items text,content text,number text,explain text,rule text,fillItems text,type text,rowid integer primary key autoincrement,ID integer,index integer) 2019-03-13 10:57:08.866535+0800 teamTripManagement[5437:3407853] DB Path: /var/mobile/Containers/Data/Application/9FF76B5E-5675-4462-ADEC-DD9D3C763D2C/Documents/db/LKDB.db 2019-03-13 10:57:08.866573+0800 teamTripManagement[5437:3407853]

LKDBHelper ERROR: -[LKDBHelper executeSQL:arguments:]_block_invoke [Line 302]

sql:CREATE TABLE IF NOT EXISTS IGQuestionnaireEntryQuestionData(items text,content text,number text,explain text,rule text,fillItems text,type text,rowid integer primary key autoincrement,ID integer,index integer) args:(null) sqlite error :near "index": syntax error 2019-03-13 10:57:08.866978+0800 teamTripManagement[5437:3407853] [logging] near "index": syntax error 2019-03-13 10:57:08.866994+0800 teamTripManagement[5437:3407853] DB Error: 1 "near "index": syntax error" 2019-03-13 10:57:08.867009+0800 teamTripManagement[5437:3407853] DB Query: CREATE TABLE IF NOT EXISTS IGQuestionnaireEntryItems(parentType text,code text,fillItems text,image text,index integer,rowid integer primary key autoincrement,allowFill integer,isEnd integer,items text,isDefault integer,parent text,type text,number text,cellHeight double,ID integer,explain text,noAddHeader double,rule text,sequence text,content text) 2019-03-13 10:57:08.867038+0800 teamTripManagement[5437:3407853] DB Path: /var/mobile/Containers/Data/Application/9FF76B5E-5675-4462-ADEC-DD9D3C763D2C/Documents/db/LKDB.db 2019-03-13 10:57:08.867054+0800 teamTripManagement[5437:3407853]

LKDBHelper ERROR: -[LKDBHelper executeSQL:arguments:]_block_invoke [Line 302]

sql:CREATE TABLE IF NOT EXISTS IGQuestionnaireEntryItems(parentType text,code text,fillItems text,image text,index integer,rowid integer primary key autoincrement,allowFill integer,isEnd integer,items text,isDefault integer,parent text,type text,number text,cellHeight double,ID integer,explain text,noAddHeader double,rule text,sequence text,content text) args:(null) sqlite error :near "index": syntax error 2019-03-13 10:57:08.878328+0800 teamTripManagement[5437:3407853] [logging] near "index": syntax error 2019-03-13 10:57:08.878373+0800 teamTripManagement[5437:3407853] DB Error: 1 "near "index": syntax error" 2019-03-13 10:57:08.878397+0800 teamTripManagement[5437:3407853] DB Query: replace into IGQuestionnaireEntryItems(parentType,code,fillItems,image,index,allowFill,isEnd,items,isDefault,parent,type,number,cellHeight,ID,explain,noAddHeader,rule,sequence,content) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) 2019-03-13 10:57:08.878437+0800 teamTripManagement[5437:3407853] DB Path: /var/mobile/Containers/Data/Application/9FF76B5E-5675-4462-ADEC-DD9D3C763D2C/Documents/db/LKDB.db 2019-03-13 10:57:08.878512+0800 teamTripManagement[5437:3407853]

LKDBHelper ERROR: -[LKDBHelper(DatabaseExecute) insertBase:]_block_invoke [Line 1277]

sql:replace into IGQuestionnaireEntryItems(parentType,code,fillItems,image,index,allowFill,isEnd,items,isDefault,parent,type,number,cellHeight,ID,explain,noAddHeader,rule,sequence,content) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) args:[ "filterSelect", "1", "{\"DB_Type\":\"DB_Type_JSON\",\"DB_Value\":[]}", "", "1", "0", "1", "{\"DB_Type\":\"DB_Type_JSON\",\"DB_Value\":[]}", "1", null, null, null, "0", "4988", "", "0", "{\"DB_PKeyValue\":{\"rowid\":\"319\"},\"DB_Type\":\"DB_Type_Model\",\"DB_Class\":\"IGQuestionnaireEntryRule\",\"DB_RowId\":319,\"DB_TableName\":\"IGQuestionnaireEntryRule\"}", null, "是" ]

li6185377 commented 5 years ago

自动关联保存的。。

wangxiaola commented 5 years ago

屏幕快照 2019-03-13 上午11 36 56

wangxiaola commented 5 years ago

取出数据就成这个样了 都是NSCFString类型 实际上questionData数组里是一个个IGQuestionnaireEntryQuestionData类

wangxiaola commented 5 years ago

找到原因了 NSAssert(NO, @"目前LKDB 还不支持 循环引用。 比如 A 持有 B, B 持有 A,这种的存储");