Raised This Month: $32 Target: $400
 8% 

[CS:GO] Can I use SQL in the course of the game?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fastmancz
Senior Member
Join Date: Jul 2013
Location: Czech Republic
Old 03-21-2017 , 16:39   [CS:GO] Can I use SQL in the course of the game?
Reply With Quote #1

Hello,

I have to you question. Can I use SQL queries during the game? Because I have a problem that sometimes crashes the server. I use standard SQL query (SQL_TQuery).

Example:
PHP Code:
public void MySQL(Handle ownerHandle hquery, const char[] errorany client)
{
    if(
hquery == INVALID_HANDLE)
    {
        
LogError("[SQL]  Error: %s\n\n\n"error);
    }

    
char steamid[32];
    
GetClientAuthId(clientAuthId_Enginesteamidsizeof(steamid));
    
Format(querysizeof(query), "SELECT * FROM xxxxx WHERE steamid LIKE '%s'"steamid);
    
SQL_TQuery(DBMySQL_Dataqueryclient);

    
CloseHandle(h_query);
}

public 
void MySQL_Data(Handle ownerHandle hquery, const char[] errorany client)
{
    if(
hquery == INVALID_HANDLE)
    {
        
LogError("[SQL]  Error: %s\n\n\n"error);
    }
    .....
    
    
CloseHandle(h_query);

It can also cause this, that I did not use closed handles (return Plugin_Handled, etc.)?

Thank you for the explanation and answer.
__________________


Main owner of the CMGPORTAL.CZ.
---------------------------------------
My plugins:
[CS:GO] Panorama - Timeleft
[CS:GO] JailBreak - Be quiet, please!
Fastmancz is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 03-21-2017 , 18:59   Re: [CS:GO] Can I use SQL in the course of the game?
Reply With Quote #2

what is 'h_query' and why are you closing it? Most plugins use sql queries mid game perfectly fine.
Mitchell is offline
Fastmancz
Senior Member
Join Date: Jul 2013
Location: Czech Republic
Old 03-22-2017 , 02:10   Re: [CS:GO] Can I use SQL in the course of the game?
Reply With Quote #3

Thank you for the reply. I checked what it is. I have found that basically I do not use it.

PHP Code:
Handle h_query INVALID_HANDLE
Is it possible to somehow check the handles? I mean the debug plugin. I found the command:
sm_dump_handles

Thanks for answer.
__________________


Main owner of the CMGPORTAL.CZ.
---------------------------------------
My plugins:
[CS:GO] Panorama - Timeleft
[CS:GO] JailBreak - Be quiet, please!
Fastmancz is offline
Totenfluch
AlliedModders Donor
Join Date: Jan 2012
Location: Germany
Old 03-22-2017 , 08:53   Re: [CS:GO] Can I use SQL in the course of the game?
Reply With Quote #4

Invalid info
Spoiler
__________________
Notable Projects:
Event Item Spawner | Scissors, Rock, Paper for ZephStore
tVip | Smart Link Remover
PLG & GGC - CS:GO Roleplay

and countless more...

I can make a helicopter shoot missles if you want me to...

Last edited by Totenfluch; 03-24-2017 at 09:04.
Totenfluch is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 03-22-2017 , 09:48   Re: [CS:GO] Can I use SQL in the course of the game?
Reply With Quote #5

Quote:
Originally Posted by Totenfluch View Post
you should close hquery not h_query
You shouldn't need to close that either, unless the wiki is passing out bad information.
Mitchell is offline
Fastmancz
Senior Member
Join Date: Jul 2013
Location: Czech Republic
Old 03-22-2017 , 13:19   Re: [CS:GO] Can I use SQL in the course of the game?
Reply With Quote #6

Thanks for reply. How do I know which handles is the need to close? It is necessary for SQL_TQuery to close the handles?
__________________


Main owner of the CMGPORTAL.CZ.
---------------------------------------
My plugins:
[CS:GO] Panorama - Timeleft
[CS:GO] JailBreak - Be quiet, please!
Fastmancz is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 03-22-2017 , 13:52   Re: [CS:GO] Can I use SQL in the course of the game?
Reply With Quote #7

Quote:
Originally Posted by Fastmancz View Post
Thanks for reply. How do I know which handles is the need to close? It is necessary for SQL_TQuery to close the handles?
You should only have to open 1 database handle globally if you want to use it consistently and just create threaded queries using 'SQL_TQuery' without closing any of the handles inside of it unless you pass a datapack through it, you need to close that.
Drixevel is offline
Fastmancz
Senior Member
Join Date: Jul 2013
Location: Czech Republic
Old 03-23-2017 , 14:20   Re: [CS:GO] Can I use SQL in the course of the game?
Reply With Quote #8

Thanks for reply. I looked in the log and I found this:

Mysql Error: Lost connection to MySQL server during query

Which in turn will cause a server crash. Where there may be an error?
__________________


Main owner of the CMGPORTAL.CZ.
---------------------------------------
My plugins:
[CS:GO] Panorama - Timeleft
[CS:GO] JailBreak - Be quiet, please!
Fastmancz is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 03-24-2017 , 07:53   Re: [CS:GO] Can I use SQL in the course of the game?
Reply With Quote #9

Code similar to what you gave in your first post shouldn't crash the server and neither should losing your database connection. You might want to try posting a crash dump if possible (perhaps using Accelerator).
Fyren is offline
Reply


Thread Tools
Display Modes

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 -4. The time now is 16:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode