View Full Version : Selecting Database for Queries

01-28-2014, 12:55 AM
How do you select a database for queries with SQLite? I'm used to PHP and connecting with the declared db name, user, and pass. :/

I've searched and searched on here but can't seem to find it. I've tried ("USE dbname") and ("USE DATABASE dbname") as a query in with my select query and before instead, no go just get this error:

SQL Error: near "USE": syntax error
Query: USE DATABASE players

If i just use the default db with the table, my query works fine so I know it's not that.

01-28-2014, 01:16 AM
Use requestsql2:

Support for multiple sqlite databases has been added for private and hosted playerworlds. If it's working fine then we can copy it to the other servers. You need to restart the server to enable it.

Server option:
First parameter: the name of the database which will be used for requestsql2 (so that you can change the associated file name without breaking scripts)
Second parameter: the filename, cannot contain path names and without extension, will be stored in databases/dbfile.db
Note: you can add several custom databases, it will tell you when a database has been closed because you have removed the configuration (can be used to securely close a database).

Script usage:
requestsql2(dbname, query, wantresult);

Overwriting the default database configuration:

The default database will be used for requestsql(query, wantresult).

The system still supports external mysql connections but they cannot be configured this way (needs my help). This is to prevent that the user name and password are shown in the server options.

01-28-2014, 01:17 AM
Yeah I just realized that. I'm completely stupid. was using requestsql instead...

thank you still.