smartDBVersion: 0.8.3Release date: 17.05.2012Support Url: http://c-o-g.deDescription:smartDB allows the use of MySQL in EventScripts Python. With smartDB you can use "normal" MySQL commands, functions (eg views) and a "keystruktur" as it is already known from EventScripts.
Coders have the opportunity here, a direct support of MySQL, by using the "smartDB.mysql" and "smartDB.easyDB" classes in their script.
Administrators have the opportunity to use "smartDB.easyDB" or "keycommand" replacement, without changes in the source.
Examples:Use native MySQL with cursorPYTHON:
| from smartDB import smartDB |
| |
| sql = mysql(<HOST> , <PORT> , <USER> , <PASSWD> , <DATABASE>) |
| |
| def sql(): |
| mysql = "SELECT * FROM table" |
| sql.cursor.execute(str(mysql)) |
| rows = sql.cursor.fetchall() |
| for row in rows: |
| pass |
| |
Use easyDB with key syntax and own db:PYTHON:
| from smartDB import smartDB |
| |
| db = smartDB.easyDB(<HOST> , <PORT> , <USER> , <PASSWD> , <DATABASE>) |
| |
| def commands(): |
| db.grouplist() |
| db.grouplist(<groupname>) |
| db.groupcreate(<groupname>) |
| db.keycreate(<groupname>,<keyname>) |
| db.groupsave(<groupname>,<location>) |
| db.keycreate(<groupname>,<location>) |
| db.keysetvalue(<groupname>,<keyname>,<valuename>,<value>) |
| db.keygetvalue(<groupname>,<keyname>,<valuename>) |
| db.groupdelete(<keygroupname>) |
| db.groupname(<keygroupname> , <new keygroupname>) |
| db.keydelete(<keygroupname> ,<keyname>) |
| |
Use easyDB with key syntax and shared db:PYTHON:
| from smartDB import smartDB |
| |
| smartDB.edb.grouplist() |
| smartDB.edb.grouplist(<groupname>) |
| smartDB.edb.groupcreate(<groupname>) |
| smartDB.edb.keycreate(<groupname>,<keyname>) |
| smartDB.edb.groupsave(<groupname>,<location>) |
| smartDB.edb.keycreate(<groupname>,<location>) |
| smartDB.edb.keysetvalue(<groupname>,<keyname>,<valuename>,<value>) |
| smartDB.edb.keygetvalue(<groupname>,<keyname>,<valuename>) |
| smartDB.edb.groupdelete(<keygroupname>) |
| smartDB.edb.groupname(<keygroupname> , <new keygroupname>) |
| smartDB.edb.keydelete(<keygroupname> ,<keyname>) |
| |
Use keycommand replacement:ATTENTION, EXPERIMENTAL MAY BREAK SOME SCRIPTS !PYTHON:
| es.keycreate() |
| es.keydelete() |
| es.keygetvalue() |
| es.keysetvalue() |
| es.keygroupcreate() |
| es.keygroupload() |
| es.keygrouprename() |
| es.keygroupsave() |
| es.keylist() |
| |
Istallation:1. Copy the folder "smartDB" in the eventscripts folder (cstrike / addons / eventscripts).
2. Launch the plugin by entering "es_load smartDB" in the server console (or RCon).
3. Now the config is generated in "cstrike / addons / eventscripts / smartDB". Set your MySQL server settings!
4. Add the startup command (es_laod smartDB) in the "autoexec.cfg" a (cstrike / cfg).
5. Start the server!
Thanks to:1. GODJonez (Coding Help es.key replacement)
2. Ayuto (Further explanation es.key replacement)
DOWNLOADVersion history:0.8.3 (17.05.2012) - Automatic database disconnect added
0.8.2 (11.05.2012)- smartDB beta release