in reply to Transfer a in-memory SQLite database to disk

No need to mess with ATTACH. DBD::SQLite provides an sqlite_backup_to_file method.

(And, to respond to the earlier "shouldn't you just be creating the db on disk in the first place?" comment, I know of this method thanks to a game I was working on that ran from an in-memory database and periodically checkpointed itself to disk.)

Replies are listed 'Best First'.
Re^2: Transfer a in-memory SQLite database to disk
by saumitra121 (Novice) on Jul 03, 2012 at 12:59 UTC
    thanks...that's exactly what I was looking for.

    For future visitors...below is the syntax to backup a in-memory database to disk.

    $dbh = DBI->connect('dbi:SQLite:dbname=:memory:'); .... .... do something .... $dbh->sqlite_backup_to_file($filename);

Re^2: Transfer a in-memory SQLite database to disk
by Anonymous Monk on Jul 03, 2012 at 11:04 UTC

    Neato :)

    JIC , grep -ri attach DBD-SQLite-1.37 </t>

    t/16_column_info.t 31:# 3. Attach a memory database 32:ok( $dbh->do('ATTACH DATABASE ":memory:" AS db3'), 'ATTACH DATABASE + ":memory:" AS db3' ); 34:# 4. Create a table on the attached database t/35_table_info.t 55:# Attach a memory database 56:ok( $dbh->do('ATTACH DATABASE ":memory:" AS db3'), 'ATTACH DATABASE + ":memory:" AS db3' ); 58:# Create a table on the attached database 94:# Create another table "one" on the attached database