0

I need to run dynamically INSERT and CREATE Sqlite statements.

"CREATE TABLE IF NOT EXISTS Menu"+counter+" (itemid INTEGER PRIMARY KEY, test TEXT, type TEXT, table TEXT)";

"INSERT OR IGNORE INTO Menu"+counter+" (itemid , test, type, table) VALUES (?, ?, ?, ?)";

I got on both statements a syntax error if i try to run.

http://docs.phonegap.com/en/1.2.0/phonegap_storage_storage.md.html#SQLError SQLError.SYNTAX_ERR

1 Answer 1

2

table is a reserved keyword, and needs to be quoted in both statements if used as a field name.

I suggest you find another name, but to keep it, surround it with ";

'CREATE TABLE IF NOT EXISTS Menu'+counter+
  ' (itemid INTEGER PRIMARY KEY, test TEXT, type TEXT, "table" TEXT)'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.