我使用SQLite Manager执行以下SQL命令时遇到问题:
CREATE TABLE "types" ("id" INTEGER PRIMARY KEY, "name" TEXT, "kind" TEXT, "length" INTEGER);
它生成以下语法错误:
SQLiteManager:
CREATE TABLE "types" ("id" INTEGER PRIMARY KEY, "name" TEXT, "kind" TEXT, "length" INTEGER); [ near "": syntax error ]
Exception Name: NS_ERROR_FAILURE
Exception Message: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)
[mozIStorageConnection.createStatement]
但我看不出声明中有任何问题。有人能帮我吗?
更新:我发现了错误:我从文本编辑器中复制了这行:
CREATE TABLE "types" ("id" INTEGER PRIMARY KEY, "name" TEXT, "kind" TEXT, "length" INTEGER)?;
在文本编辑器中没有结束。同样在SQLite Manager中?不可见。但在命令线上,我可以看到有一个?如果我从剪贴板粘贴行。如果?删除后,它在SQLite Manager中完美工作:D
这可以毫无问题地工作。
$ sqlite3
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> CREATE TABLE "types" ("id" INTEGER PRIMARY KEY, "name" TEXT, "kind" TEXT, "length" INTEGER);
sqlite> .schema
CREATE TABLE "types" ("id" INTEGER PRIMARY KEY, "name" TEXT, "kind" TEXT, "length" INTEGER);