Raised This Month: $32 Target: $400
 8% 

SQLite in Sourcemod


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 06-25-2015 , 12:49   SQLite in Sourcemod
Reply With Quote #1

I plan on using a database for a plugin I am writing and I have a few questions about using sqlite:

1. Does SM support threaded queries for sqlite?

2. The main sqlite executable and python's sqlite library supports in-memory databases (that is, a database stored completely in RAM and not on a HDD). Is this supported in sourcemod? If so, how do I make one that lives in RAM? If not, is there any lag from reading a database file from the disk? (Maximum query size is about 600 entries.)

(Random note: SM 1.7 API is broken on mobile browsers.)

Thanks!

Last edited by Potato Uno; 06-25-2015 at 12:50.
Potato Uno is offline
psychonic

BAFFLED
Join Date: May 2008
Old 06-25-2015 , 14:51   Re: SQLite in Sourcemod
Reply With Quote #2

Quote:
Originally Posted by Potato Uno View Post
1. Does SM support threaded queries for sqlite?
Yes.

Quote:
Originally Posted by Potato Uno View Post
2. The main sqlite executable and python's sqlite library supports in-memory databases (that is, a database stored completely in RAM and not on a HDD). Is this supported in sourcemod? If so, how do I make one that lives in RAM?
Maybe. Try putting ":memory:" as the "database" name in databases.cfg.

Quote:
Originally Posted by Potato Uno View Post
If not, is there any lag from reading a database file from the disk? (Maximum query size is about 600 entries.)
With threaded queries, it shouldn't be a concern.
psychonic is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 06-26-2015 , 02:22   Re: SQLite in Sourcemod
Reply With Quote #3

Thanks! I'll try that out.
Potato Uno is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 07-17-2015 , 21:14   Re: SQLite in Sourcemod
Reply With Quote #4

Bumping this.

I tried this and it didn't work:

PHP Code:
    PlayerLoadouts SQLite_UseDatabase(":memory:"Errorsizeof(Error)); 
Error:

PHP Code:
unable to open database file 
Is this a bug with the sourcemod version of sqlite? Even the official sqlite docs say to use ":memory:" for a transient database, so one would assume that it should work here.

I mean it's not a big deal; I can always write an .sq3 file in the server without any problems, but for something that I'd only need to use per game before it can be destroyed, memory would have been nice.

Last edited by Potato Uno; 07-17-2015 at 21:16.
Potato Uno is offline
Nerus
Senior Member
Join Date: Aug 2010
Location: Poland
Old 12-03-2016 , 17:53   Re: SQLite in Sourcemod
Reply With Quote #5

Any news ?,

will be good to have temporary database.

My server works on SSD and for session I use sqlite to save temp data with big ratio changes for each client (scores).

So, will be improvement from sourcemod crew side, you will be able to add sqlite feature with memory (ram) support ?

Regards,
Nerus.

Last edited by Nerus; 12-03-2016 at 18:03.
Nerus is offline
psychonic

BAFFLED
Join Date: May 2008
Old 12-04-2016 , 09:04   Re: SQLite in Sourcemod
Reply With Quote #6

I took a look and found the issue causing them to not work. The version of SQLite that SM uses supports them, but SM tried to do a bunch of handling on the database name given for SQLite.

Once this Pull Request is merged, it will work.
https://github.com/alliedmodders/sourcemod/pull/565

Last edited by psychonic; 12-04-2016 at 09:04.
psychonic is offline
Nerus
Senior Member
Join Date: Aug 2010
Location: Poland
Old 12-10-2016 , 05:36   Re: SQLite in Sourcemod
Reply With Quote #7

Quote:
Originally Posted by psychonic View Post
I took a look and found the issue causing them to not work. The version of SQLite that SM uses supports them, but SM tried to do a bunch of handling on the database name given for SQLite.

Once this Pull Request is merged, it will work.
https://github.com/alliedmodders/sourcemod/pull/565
Nice work, this option will suppress my ssd .

==================================

For version sm older than 1.9 based on Linux or Windows you can create ramdisk and use it to store sqlite database:

Linux Solution:
Quote:
Create symlink for sqlite database with /dev/shm/file_name_to_store_in_ram
Windows Solution:
Quote:
Create ramdisk (e.g. ImDisk), mount it as disk partition, link file to the ramdisk partition (Link Shell Extension)
Best regards,
Nerus.

Last edited by Nerus; 12-15-2016 at 12:07.
Nerus is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:29.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode