title: Attach in-memory database in Android
body: <p>I created in-memory database in Android. I put <b>null</b> in <b>name</b> parameter in SQLiteOpenHelper constructor:</p>
  
  <pre><code>SQLiteOpenHelper(context, null, null, 1);
  </code></pre>
  
  <p>Also I created some <i>doc_orders_products</i> table in the in-memory db.</p>
  
  <p>Now I'm trying attach this in-memory db to my main on-disk db. 
  What name of in-memory db should I use in ATTACH command?</p>
  
  <p>I tried:</p>
  
  <pre><code>mainDB.execSQL("ATTACH DATABASE ':memory:' AS temp_db");
  </code></pre>
  
  <p>and</p>
  
  <pre><code>mainDB.execSQL("ATTACH DATABASE '' AS temp_db");
  </code></pre>
  
  <p>Both ATTACH command performs well even when in-memory db isn't created at all.
  But when I try get access to tables in the in-memory db, they are not present. I get exception. E.g.:</p>
  
  <pre><code>10-11 14:07:46.782: E/AndroidRuntime(2107): Caused by: 
  android.database.sqlite.SQLiteException: no such table: 
  temp_db.doc_orders_products (code 1): , while compiling: 
  INSERT INTO temp_db.doc_orders_products SELECT * FROM 
  main.doc_orders_products WHERE doc_id=3
  </code></pre>
  
  <p>Is it possible to attach in-memory db to on-disk db? What correct way is to do it?</p>
  
  <p>Thanks.</p>