質問

i have a problem with the following SQL command using SQLite Manager:

CREATE TABLE "types" ("id" INTEGER PRIMARY KEY, "name" TEXT, "kind" TEXT, "length" INTEGER);

It generates the following syntax error:

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]

But i cannot see any problem in the statement. Can anybody help me with this?

Update: I found the bug: I copied the line out of a text editor:

CREATE TABLE "types" ("id" INTEGER PRIMARY KEY, "name" TEXT, "kind" TEXT, "length" INTEGER)?;

In the text editor there is no ? at the end. Also in SQLite Manager the ? is not visible. But on command line i can see there is a ? if i paste the line from clipboard. If the ? is removed it works perfectly in SQLite Manager :D

役に立ちましたか?

解決

This works without problems.

$ 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);
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top