AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   MySQL Queries (https://forums.alliedmods.net/showthread.php?t=98616)

Mlk27 07-27-2009 08:05

MySQL Queries
 
When executing multiple queries using SQL_QueryAndIgnore, do I need to exec each of them in separate handle? Or this is already fine?

Code:
new iError, szError[256] new Handle:hSQLConnection = SQL_Connect(g_hSQLTuple, iError, szError, charsmax(szError)) if(hSQLConnection != Empty_Handle) {     SQL_QueryAndIgnore(hSQLConnection,         "CREATE TABLE IF NOT EXISTS rm_servers (\             serverip VARCHAR(32) NOT NULL PRIMARY KEY, \             servername VARCHAR(64) NOT NULL) \         ENGINE=MyISAM DEFAULT CHARSET=utf8;"         )     SQL_QueryAndIgnore(hSQLConnection,         "INSERT INTO rm_servers SET serverip='%s', \         servername='%s' ON DUPLICATE KEY UPDATE servername='%s'", g_ServerIp, g_ServerName, g_ServerName)     SQL_FreeHandle(hSQLConnection) } else {     log_amx("config_init(): SQL Error #%d - %s", iError, szError)     set_fail_state(szError) }


All times are GMT -4. The time now is 18:19.

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