SQLite Placeholders for Table Names

Please provide the following:

  1. SDK Version: 40.0.0
  2. Platforms(Android):
  3. “SQLite”

The ? works when I use it to replace values however what if I want to use it for the Table name
Like so…

const insertInit = (table) => {
    db.transaction((tx) => {
      tx.executeSql(
        "insert into '?' values('undefined')",
        [table],
        (tx, res) => console.log(`Succeeded to Insert undefined Into Table '${table}'`,),
        (tx, err) => console.log(`Falied to Insert undefined Into Table '${table}'`, err)
      )
    });
  }

When I do this I get this error :point_down:

Falied to Insert undefined Into Table 'Document' [Error: no such table: ? (code 1 SQLITE_ERROR): , while compiling: insert into '?' values('undefined')]

However when I hard code the Table Name and placehold the value, it works. But thing is I want to do it for the Table Name. Or is that even Possible?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.