First I use System.Data.SQLite v1.0.111 to open a connection to in-memory database as below.
SQLiteConnection dest= new SQLiteConnection("FullUri='file:db1?mode=memory&cache=shared'");
dest.Open();
Then I have another sqlite database on file which is opened as below.
SQLiteConnection src= new SQLiteConnection(@"Data Source=C:\db1.sqlite");
src.Open();
Next, I tried to VACUUM INTO SQL to copy the file database into in-memory database, and it gave me an error.
using( SQLiteCommand cmd = src.CreateCommand() )
{
cmd.CommandText = $"VACUUM main INTO 'file:db1?mode=memory&cache=shared';";
cmd.ExecuteNonQuery();
}
SQLiteException: out of memory
at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)
at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
at System.Data.SQLite.SQLiteDataReader.NextResult()
at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery(CommandBehavior behavior)
at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
The database in file is small(20KB), but it says out of memory?
Thank you