I want to get a name with edittext from user, and set this name as new table name in SQLite. Like
database.execSQL("CREATE TABLE IF NOT EXISTS variable_name (...)")
CodePudding user response:
Names of elements, such as table names, column names, trigger names, index names etc cannot be passed as variables within SQL to SQLite for SQLite to resolve. You would have to resolve the variable name when building the SQL statement.
e.g.
database.execSQL("CREATE TABLE IF NOT EXISTS " variable_name " (...)");