SCS 2.x Module : SQLITE3 Support of sqlite3 library Author : Stephane Bisaro, aka iri Date : September 21, 2010 Version 1.0 License : LGPL v3 (see COPYING file) -===============================================- Installation : Copy entire folder "sqlite3" to your "dms/db" folder. If "db" doesn't exist, create it. Requirement : sqlite3 library for scol should be installed before use this module For more informations, please visit the Scolring web site : http://www.scolring.org/ -===============================================- How to use ? Include this module to your project, via the module directory (shortcut F6) : category db, module : sqlite3 Double-click and set the editor : You have a choice between (check you want) : - a database in a file - or a database in memory (RAM) - or a database in a temporary file Note : except the first option, all datas (and database) will be lost when the server stops. If you want keep then, you must choice the first option (database in a file). Note 2 : to create a database in a file, create this file with your file manager, in your user partition. For example : worlds/myworld/db/myworld.db So, click to "Browse" in the editor module and select your file. Now, you can set one or several links : module.event >> sqlite3.run Allows to run any supported SQLite request. In the parameter field, the request must be at the first line. The result is in the paramter of the "return" event. In the second and the third line, you can set the flag of the response (return) : ATTRIBUT and / or VALUE If these lines are empty, the "return" event will be ignored. Examples : SELECT Login FROM clients; VALUE ATTRIBUT Login Guest\ 1 SELECT Login FROM clients; VALUE Guest 1 module.event >> sqlite3.runEx If no parameter set, the empty event 'returnEx' is returned If a parameter set, see also action 'run' above. It can send a specific SQLite request to each new client connected. The sql request must be the first line of the parameter. This request can have one or several of these keywords : - %login -> to replace by the login of the client - %ip -> to replace by the ip of the client - %lang -> to replace by the default language of the client - %ress* -> to replace by the DMS resource of the client, resource named * examples : INSERT INTO clients (Login, IP, Language) VALUES ('%login', '%ip', '%lang'); -> insert to the table named 'clients' the login, ip and language of the client INSERT INTO avatars (Login, AvatarUsed) VALUES ('%login', '%ressAvatar'); -> insert to the table named 'avatars', the login and the value of the DMS resource 'Avatar' ... If any, the result is in the parameter of the "returnEx" event. Warning : you should set the flag to the response : ATTRIBUT and/or VALUE (see sqlite3.run action above). sqlite3.return >> module.action Return the result of any sql request (from 'run' action, see above). sqlite3.returnEx >> module.action See 'runEx' action above sqlite3.log >> log.log Log all requests, results and errors sqlite3.destroyed >> module.action If a client is destroyed / disconnected, the parameter of this event contains his login No zone is needed