sqlite in memory?

Just starting out? Need help? Post your questions and find answers here.
jerico2day
User
User
Posts: 37
Joined: Mon Jul 13, 2009 5:41 pm

sqlite in memory?

Post by jerico2day »

Is it possible to create and use an sqlite database in memory? I found this thread:

http://www.purebasic.fr/english/viewtopic.php?t=27149

But the code no longer works and I can't wrap my head around it.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: sqlite in memory?

Post by ts-soft »

use the native pb functions:

Code: Select all

UseSQLiteDatabase()

If OpenDatabase(0, ":memory:", "", "")
  If DatabaseUpdate(0, "CREATE TABLE info (test VARCHAR(255));")
    Debug "Table created"
  EndIf
EndIf
Here a more complete example
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
jerico2day
User
User
Posts: 37
Joined: Mon Jul 13, 2009 5:41 pm

Re: sqlite in memory?

Post by jerico2day »

Ah wonderful. Thanks!
kinglestat
Enthusiast
Enthusiast
Posts: 746
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Re: sqlite in memory?

Post by kinglestat »

you can also set the temporary storage #PRAGMA to MEMORY and create your table in temp...eg CREATE TABLE temp.mytable.....

this way you can operate both ways ;) I have a post to this effect somewhere on the forum dont ask me where I am hopeless in navigating the web (and this forum in particular!)
I may not help with your coding
Just ask about mental issues!

http://www.lulu.com/spotlight/kingwolf
http://www.sen3.net
Post Reply