title: Android sqlite can't create TEMP table
body: <p>I'd like to create and use a temporary table in a android sqlite database.<br>
  SQL statement is executed without any exception but no table is created!<br>
  Running my app with the sample code below, I got no tables:</p>
  
  <p><strong>START EDIT</strong></p>
  
  <pre><code>public class DatabaseHelper extends SQLiteOpenHelper {
  public static final String DB_NAME = "mydb.db";
  private static DatabaseHelper instance;
  
  public static synchronized DatabaseHelper getHelper(Context context){
      if (instance == null)
          instance = new DatabaseHelper(context);
      return instance;
  }
  
  private DatabaseHelper(Context c) {
      super(c,DB_NAME,null,1);
  }
  
  @Override
  public void onConfigure(SQLiteDatabase db) {
      super.onConfigure(db);
      db.enableWriteAheadLogging ();
      db.setLocale(Locale.getDefault());
  }
  
  @Override
  public void onCreate(SQLiteDatabase db) {
      // lots of table creation
      db.execSQL("CREATE TABLE my_table (id INTEGER PRIMARY KEY, value TEXT)");
      // more tables ....
  }}
  ...... sample 
  DatabaseHelper databaseHelper = DatabaseHelper.getHelper(this);
  </code></pre>
  
  <p><strong>END EDIT</strong></p>
  
  <pre><code>SQLiteDatabase db = databaseHelper.getWritableDatabase();
  db.execSQL("create TEMP table my_temp_table (id integer primary key, value text)"); // no exceptions
  
  Cursor cursor = db.query("SQLITE_TEMP_MASTER", null, null, null, null, null, null);
  
  while( cur.moveToNext()) {
      // no lines (no temporary tables)
  }
  </code></pre>
  
  <p>If I create a temporary table from a select statement and then query (within the same db connection) the created table, I get "no such table .... exception"!</p>
  
  <pre><code>db.execSQL("create TEMP table my_temp_table as select * from my_table");
  Cursor cursor = db.query("temp.my_temp_table", null, null, null, null, null, null);
  ^^^ no such table: temp.my_temp_table(code 1): , while compiling: SELECT * FROM temp.my_temp_table
  </code></pre>
  
  <p>What is confusing me is that ... the same sql code works perfectly within SQLiteStudio i.e. outside the app and outside the android device.
  Maybe I forgot to enable something or ... I need specific device permission?</p>