Once i've got an idea to make it by using console proggie that was running by os.execute function, it was horrible enough to call it something like shit.
I've found a better and easier way to make it.
We just need to make one LUA script function and update two stored procedures in Telecaster.
So let's start from LUA:
so we write new SQL query into GlobalVariables table, it's aso good to see queries logs, but you will clear your global variables table time after another when it will be really flooded by queries. Or you can modify stored procedures (i'll write it below) to delete written query automatically.
Lets continue on stored procedures:
First: smp_insert_global_variable
And the second: smp_set_global_variable
So, if you found it useful, use it=)
If not, i won't argue about the power of possibility to run SQL queries from LUA script or console/chat command.
If you found it so easy to do - i don't really care if you can better.
And yeah i forgot: HOW TO USE xD
mssql_query("DROP Telecaster")
And bye bye dear Telecaster!
One tip to use:
If you need to execute huge queries, make a stored procedure for it and call it by mssql_query. set_global_variable() command doesnt support writing variable value with more than 1024 symbols of length.
To addition: some tests showed that wrong written query don't crash game server, just don't execute and server works good anyway, when other stored procedures are crashing GS when return any error while its execution.
Thanks for Thanksfarmer!
P.S. i don't really care if you have crashed your server or hurted your databases using THIS. Just keep your hands closer to your balls.
P.P.S. there was so much words said about that GS will update global variables table when it saves all data etc, but some tests are shown that global variables writes into database momentary, as well as queries execution using this way. Just tested it on own function that allows player to move his donation points back to shop inventory and it was working without any delays before execution. But there is no possibility to get global variable that's written by query momentary, because it must be stored in server memory and it takes time. btw its possible to refresh gameserver memory and read all variables again from table using #refresh() command (tested by my own), but first, it takes time + freeze GS, and second, it will bug markets if you don't know how to act well with this shit.
So there is no possibility to return query result data back to script function using global variables way, means this ^^ without damaging server productivity.
If i'm not right and there IS a way, correct me and share your idea