so Im trying to create new SQLite table which name is set by String created in my app. String is created from int userID and curret date (to string)
LocalDate date = LocalDate.now();
public void save() {
String db;
db = String.valueOf("uid" + userID + date.toString());
try {
PreparedStatement pst = conn.prepareStatement("CREATE TABLE ?(name TEXT, kcal FLOAT, protein FLOAT, carbs FLOAT, fat FLOAT)");
pst.setString(1, db);
pst.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
Finnal string looks like this for example: uid02016-12-05
Unfortunatelly, I got
org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (near "?": syntax error)
and errors pointing to my PreparedStatement, i bet there is something wrong with '?', but how to do it other way?