flutter_sqlite_demo
flutter_sqlite_demo copied to clipboard
没有约定key 主键唯一
abort at 12 in [INSERT INTO book (name, author, price, publishingHouse, _id) VALUES (?, ?, ?, ?, ?)]: UNIQUE constraint failed: book._id
E/flutter (11772): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: DatabaseException(UNIQUE constraint failed: book._id (code 1555)) sql 'INSERT INTO book (name, author, price, publishingHouse, _id) VALUES (?, ?, ?, ?, ?)' args [flutter大全0, flutter, 0.1, 中国出版, 0]}
E/flutter (11772): #0 wrapDatabaseException (package:sqflite/src/exception.dart:126:7)
E/flutter (11772):
E/flutter (11772): #1 SqfliteDatabase.txnRawInsert.
E/flutter (11772):
E/flutter (11772): #4 SqfliteDatabase.txnSynchronized (package:sqflite/src/database.dart:293:43)
E/flutter (11772):
E/flutter (11772): #5 SqfliteDatabase.txnWriteSynchronized (package:sqflite/src/database.dart:314:7)
E/flutter (11772): #6 SqfliteDatabase.txnRawInsert (package:sqflite/src/database.dart:337:12)
E/flutter (11772): #7 SqfliteDatabaseExecutor.rawInsert (package:sqflite/src/database.dart:29:10)
E/flutter (11772): #8 SqfliteDatabaseExecutor.insert (package:sqflite/src/database.dart:38:12)
E/flutter (11772): #9 BookSqlite.insert (package:flutter_sqlite_demo/Book.dart:73:24)
E/flutter (11772):
E/flutter (11772): #10 _MyHomePageState.insertData (package:flutter_sqlite_demo/main.dart:62:22)
E/flutter (11772):
E/flutter (11772): #11 _MyHomePageState.initState (package:flutter_sqlite_demo/main.dart:31:5)
E/flutter (11772): #12 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4061:58)
E/flutter (11772): #13 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3912:5)
E/flutter (11772): #14 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3094:14)
E/flutter (11772): #15 Element.updateChild (package:flutter/src/widgets/framework.dart:2897:12)
E/flutter (11772): #16 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5129:14)
E/flutter (11772): #17 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3094:14)
E/flutter (11772): #18 Element.updateChild (package:flutter/src/widgets/framework.dart:2897:12)
E/flutter (11772): #19 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3954:16)
E/flutter (11772): #20 Element.rebuild (package:flutter/src/widgets/framework.dart:3731:5)
E/flutter (11772): #21 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3917:5)
E/flutter (11772): #22 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3912:5)
E/flutter (11772): #23 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3094:14)