1

I recently met a problem while writing simple app on Android. Problem seems to appear every time I put '?' into query:

SQLiteStatement statement = db.compileStatement("DROP TABLE IF EXISTS ?");
statement.bindString(1, "TableName");
statement.execute();

I got exception:

E/SQLiteLog: (1) near "?": syntax error

E/APP_LOG: android.database.sqlite.SQLiteException: near "?": syntax error (code 1): , while compiling: DROP TABLE IF EXISTS ?

Everything works fine if You replace '?' by TableName:

SQLiteStatement statement = db.compileStatement("DROP TABLE IF EXISTS TableName");
statement.execute();

Does anyone know why I get this error? I've read it's because incorrect spaces (0xA0 instead of 0x20) but that wasn't it.

Community
  • 1
  • 1
WarNaX
  • 83
  • 7

0 Answers0