williamwen1986 / flutter_orm_demo

demo of flutter_orm_plugin
29 stars 2 forks source link

lua_err #2

Open wt959790 opened 5 years ago

wt959790 commented 5 years ago

code:

Map<String, Field> fields = new Map<String, Field>(); fields["id"] = Field(FieldType.Integer, primaryKey: true , autoIncrement: true); fields["book_id"] = Field(FieldType.Text,unique: true); fields["name"] = Field(FieldType.Text); fields["author"] = Field(FieldType.Text); fields["img_url"] = Field(FieldType.Text);
FlutterOrmPlugin.createTable("novel","Book",fields );

Map m = {"book_id":"1234","name":"test","author":"haha","img_url": "..."}; FlutterOrmPlugin.saveOrm("Book",m);

logcat: E:lua_helpers.cpp(105)] lua_err [string "/data/user/0/com.remennovel.flutter_reader/..."]:150: update error errorcode:19 E/business: [06-23/14:56:50.762:E:lua_helpers.cpp(105)] lua_err [string "/data/user/0/com.remennovel.flutter_reader/..."]:95: Need a block to unpack

williamwen1986 commented 5 years ago

please update the latest version and try again

williamwen1986 commented 5 years ago

we can only add database column,can not modify or delete database column

tookbra commented 5 years ago

当某个字段为null时候会出现这种错误,这种不会处理吗

williamwen1986 commented 5 years ago

当某个字段为null时候会出现这种错误,这种不会处理吗

可以贴一下出错代码吗?我看看什么原因

tookbra commented 5 years ago

当某个字段为null时候会出现这种错误,这种不会处理吗

可以贴一下出错代码吗?我看看什么原因

控制台打印日志: E/business( 2629): [08-17/00:07:58.854:E:lua_helpers.cpp(105)] luaerr E/business( 2629): [string "/data/user/0/com.test..."]:150: update error errorcode:19 E/business( 2629): [08-17/00:07:58.862:E:lua_helpers.cpp(105)] luaerr E/business( 2629): [string "/data/user/0/com.test..."]:208: Need a block to unpack

版本: fluuter -> flutter_orm_plugin: ^1.0.3 android dependencies -> com.github.williamwen1986:LuakitJitpack:1.0.10

复现的代码: Map<String , Field> departmentFields = new Map<String , Field>(); departmentFields["id"] = Field(FieldType.Text, primaryKey:true); departmentFields["parentId"] = Field(FieldType.Text); departmentFields["name"] = Field(FieldType.Text); departmentFields["sort"] = Field(FieldType.Integer); departmentFields["address"] = Field(FieldType.Text); departmentFields["deleted"] = Field(FieldType.Integer); FlutterOrmPlugin.createTable("test", "department", departmentFields); FlutterOrmPlugin.saveOrm("department", {"id":"test", "address":null});

另外通过主键更新或sql更新会打印
I/business( 4218): [08-17/00:16:18.255:W:lua_helpers.cpp(131)] androidPrint:[SQL:Info] No 'where' statement. All data update! I/business( 4218): [08-17/00:16:18.255:W:lua_helpers.cpp(131)] androidPrint:[SQL:Debug] No 'where' statement. All data update!
这是说明没更新成功吗

williamwen1986 commented 5 years ago

暂时没处理某个字段为null的情况,可以在上层避免传空值,那个No 'where' statement. All data update!只是普通日志,更新是成功的

williamwen1986 commented 5 years ago

当某个字段为null时候会出现这种错误,这种不会处理吗

已经fix,请更新到最新版本

yixiu30 commented 3 years ago

please update the latest version and try again

我也遇到了这个问题了,依赖的版本是1.0.14 E/business(15299): [03-05/11:29:49.077:E:lua_helpers.cpp(105)] lua_err E/business(15299): [string "/data/user/0/com.example.flutterhtm/app_data/lua/orm/cache.lua"]:72: Need a block to unpack E/business(15299): [03-05/11:29:49.079:E:lua_helpers.cpp(105)] lua_err E/business(15299): [string "/data/user/0/com.example.flutterhtm/app_data/lua/orm/class/select.lua"]:477: Need a block to unpack