Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sqlite help
Author Message
azmanomer
Journeyman
*

Posts: 139
Likes Given: 4
Likes Received: 18 in 16 posts
Joined: Nov 2013
Reputation: 1



Post: #1
Sqlite help
I have tables for each accounts and i want to update their one column which are the same name "status" is it possibly to that with one command without for loop? If its not possible than another question is it possible to take a backup db when server save and restore db when i start the sphere?
example;
1th question example
i got "a,b,c,d,e,f,g,h,t,c" tables and they all have status column in sphere_serv_triggers.scp
[FUNCTION f_onserver_save]
ldb.connect
if <ldb.connected>
update all status to 1 where status 0 ---> is this possible?
ldb.close
endif

2th question example
i got database called "spheredb" and "a,b,c,d,e,f,g,h,t,c" tables and they all have status column in sphere_serv_triggers.scp
[FUNCTION f_onserver_save]
ldb.connect
if <ldb.connected>
backup "spheredb" name it "spheredb_backup" ----> is this possible?
ldb.close
endif

[FUNCTION f_onserver_start]
ldb.connect
if <ldb.connected>
restore from "spheredb_backup" to "spheredb" ----> is this possible?
ldb.close
endif


sorry for my english Smile
09-29-2015 08:10 AM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #2
RE: Sqlite help
1: 'UPDATE 'tablename' SET 'status' = x

2: Since SQlite databases are easily accessed in SphereSvr's folder you might want to think about creating a .rar or .zip, there is a backup script somewhere in the dowloads section for saves, you can adapt it for DB too.
09-29-2015 04:44 PM
Find all posts by this user Like Post Quote this message in a reply
azmanomer
Journeyman
*

Posts: 139
Likes Given: 4
Likes Received: 18 in 16 posts
Joined: Nov 2013
Reputation: 1



Post: #3
RE: Sqlite help
Yeah i used syscmd and created batch files to create backup and restore it i hope it wont give me any error in the future.
09-29-2015 10:22 PM
Find all posts by this user Like Post Quote this message in a reply
Extreme
Grandmaster Poster
***

Posts: 1,140
Likes Given: 217
Likes Received: 89 in 76 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #4
Re: RE: Sqlite help
(09-29-2015 10:22 PM)azmanomer Wrote:  Yeah i used syscmd and created batch files to create backup and restore it i hope it wont give me any error in the future.

Did it work? Smile

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
09-30-2015 08:30 AM
Find all posts by this user Like Post Quote this message in a reply
azmanomer
Journeyman
*

Posts: 139
Likes Given: 4
Likes Received: 18 in 16 posts
Joined: Nov 2013
Reputation: 1



Post: #5
RE: Sqlite help
yep Tongue
09-30-2015 08:49 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)