Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-28-2014, 12:55 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Selecting Database for Queries

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:

NPC Code:
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.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 01-28-2014, 01:16 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Use requestsql2:

Quote:
Originally Posted by Stefan View Post
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:
database=dbname,dbfile
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:
database=default,main_new

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.
__________________
Reply With Quote
  #3  
Old 01-28-2014, 01:17 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Yeah I just realized that. I'm completely stupid. was using requestsql instead...

thank you still.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...



Last edited by sssssssssss; 01-28-2014 at 02:08 AM..
Reply With Quote
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 +2. The time now is 12:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.