简体   繁体   中英

Specify location of sqlite file when inmemory db flushed to disk

I am using sqlite to act as a temporary store for data as it passes through a processing system and ideally want this to be in memory so I use:

new SQLiteConnection("Data Source = :memory:");

however as this database gets larger eventually it gets flushed to disk. This all works really well but my question is I'd like to be able to specify where sqlite creates this file when it needs to flush it to disk. At the moment it creats etilqs_ files under %TEMP%, I'd like to configure this to be on a different drive.

Haven't tested, but try this:

new SQLiteConnection("Data Source = :memory:; PRAGMA temp_store_directory = 'yourCustomPathHere'");

Based on this and this .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM