[Plugin] [REL] MySQL Plugin (Now on github!)

I need R7 Windows files anybody have it?
Reply

Quote:
Originally Posted by fonia5
Посмотреть сообщение
I need R7 Windows files anybody have it?
http://forum.sa-mp.com/showpost.php?...postcount=5140
Reply

after I learn about orm and i got download basic account script.
i have some question about orm_destroy. how important that is.
because in the script don't have that fuction. and i worry about that.

Following this code.
Код:
enum E_PLAYERS
{
	ORM:ORM_ID,
	
	ID,
	Name[MAX_PLAYER_NAME],
	Password[129],
	Money,
	
	bool:IsLoggedIn,
	bool:IsRegistered,
	LoginAttempts,
	LoginTimer
};
new Player[MAX_PLAYERS][E_PLAYERS];

new MysqlRaceCheck[MAX_PLAYERS];
Код:
public OnPlayerConnect(playerid)
{
	MysqlRaceCheck[playerid]++;
	//reset player data
	for(new E_PLAYERS:e; e < E_PLAYERS; ++e)
	    Player[playerid][e] = 0;

	GetPlayerName(playerid, Player[playerid][Name], MAX_PLAYER_NAME);
	
	//create orm instance and register all needed variables
	new ORM:ormid = Player[playerid][ORM_ID] = orm_create("players", SQL);

	orm_addvar_int(ormid, Player[playerid][ID], "id");
	orm_addvar_string(ormid, Player[playerid][Name], MAX_PLAYER_NAME, "username");
	orm_addvar_string(ormid, Player[playerid][Password], 129, "password");
	orm_addvar_int(ormid, Player[playerid][Money], "money");
	orm_setkey(ormid, "username");
	
	//tell the orm system to load all data, assign it to our variables and call our callback when ready
	orm_load(ormid, "OnPlayerDataLoaded", "dd", playerid, MysqlRaceCheck[playerid]);
	return 1;
}
Код:
public OnPlayerDisconnect(playerid,reason)
{
	MysqlRaceCheck[playerid]++;
	if(Player[playerid][IsLoggedIn] && Player[playerid][ID] > 0)
	orm_save(Player[playerid][ORM_ID]); //if Player[playerid][ID] has a valid value, orm_save sends an UPDATE query, else an INSERT query
	return 1;
}
as u see in the OnPlayerDisconnect it doesn't destroy ORM instance what happen if i make it happen
when another player join new ORM also create ?
and so. if i use the same code when player disconnect and new player join with the same id number.
the ORM id will create a new one id. isn't it? or it use the old orm id or something else.

you can just explain the easyway with me.
(Just a newbie worry about his script please help )
Reply

Whoops, that's indeed a mistake. The ORM instance should be destroyed in OnPlayerDisconnect and OnGameModeExit of course.
Reply

I want to load data into a seperate variable from a specific field and then save data from another variable into the same field. Will orm_delvar and then orm_addvar_string suffice or do I have to redo something..?
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
Whoops, that's indeed a mistake. The ORM instance should be destroyed in OnPlayerDisconnect and OnGameModeExit of course.
lol feel abit happy im a love your script. thanks for answer i will place orm_destroy
Reply

Quote:
Originally Posted by Cell_
Посмотреть сообщение
I want to load data into a seperate variable from a specific field and then save data from another variable into the same field. Will orm_delvar and then orm_addvar_string suffice or do I have to redo something..?
like this ?
Код:
new  variable1, variable2;
orm_addvar_int(ormid, variable1, "Field");//first addvar
andthen you load data in before u save again just set the variable1 by normally function
such variable1 = variable2;
and then orm_save
Reply

Quote:
Originally Posted by Kapupc
Посмотреть сообщение
like this ?
Код:
new  variable1, variable2;
orm_addvar_int(ormid, variable1, "Field");//first addvar
andthen you load data in before u save again just set the variable1 by normally function
such variable1 = variable2;
and then orm_save
What if I don't want to reset the first variable? Is there a better way to doing what I said?
Reply

orm_delvar and orm_addvar should suffice.
Reply

It's been months since the example account scripts were added and still the ORM one doesn't even save/load the money.
Edit: I haven't tried the cache one as I learned the caching system on my own.
Reply

In der Regel versuchen, neue Plug-in zu verbinden und dann die Fehler

C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1256) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (125 : error 017: undefined symbol "mysql_num_rows"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1260) : error 017: undefined symbol "mysql_fetch_int"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1264) : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1269) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1271) : error 017: undefined symbol "mysql_num_rows"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1273) : error 017: undefined symbol "mysql_fetch_int"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1277) : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1292) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1294) : error 017: undefined symbol "mysql_fetch_row_format"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1296) : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2331) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (233 : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2339) : error 017: undefined symbol "mysql_store_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2340) : error 017: undefined symbol "mysql_fetch_row_format"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (235 : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2895) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2985) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2986) : error 017: undefined symbol "mysql_store_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2987) : error 017: undefined symbol "mysql_fetch_row"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3040) : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3199) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3200) : error 017: undefined symbol "mysql_store_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3201) : error 017: undefined symbol "mysql_fetch_row"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3204) : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (325 : error 035: argument type mismatch (argument 1)
Reply

@Latron:

Use
Code:
text here
before posting any errors and this is an English forum. Those error looks like you're trying to compile with older include of MySQL.
Reply

In general, try to connect new plug-in and then the error

C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1256) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (125 : error 017: undefined symbol "mysql_num_rows"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1260) : error 017: undefined symbol "mysql_fetch_int"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1264) : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1269) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1271) : error 017: undefined symbol "mysql_num_rows"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1273) : error 017: undefined symbol "mysql_fetch_int"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1277) : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1292) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1294) : error 017: undefined symbol "mysql_fetch_row_format"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1296) : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2331) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (233 : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2339) : error 017: undefined symbol "mysql_store_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2340) : error 017: undefined symbol "mysql_fetch_row_format"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (235 : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2895) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2985) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2986) : error 017: undefined symbol "mysql_store_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2987) : error 017: undefined symbol "mysql_fetch_row"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3040) : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3199) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3200) : error 017: undefined symbol "mysql_store_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3201) : error 017: undefined symbol "mysql_fetch_row"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3204) : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (325 : error 035: argument type mismatch (argument 1)[/QUOTE]
Reply

Quote:
Originally Posted by Latron
Посмотреть сообщение
In general, try to connect new plug-in and then the error

C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1256) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (125 : error 017: undefined symbol "mysql_num_rows"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1260) : error 017: undefined symbol "mysql_fetch_int"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1264) : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1269) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1271) : error 017: undefined symbol "mysql_num_rows"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1273) : error 017: undefined symbol "mysql_fetch_int"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1277) : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1292) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1294) : error 017: undefined symbol "mysql_fetch_row_format"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (1296) : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2331) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (233 : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2339) : error 017: undefined symbol "mysql_store_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2340) : error 017: undefined symbol "mysql_fetch_row_format"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (235 : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2895) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2985) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2986) : error 017: undefined symbol "mysql_store_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (2987) : error 017: undefined symbol "mysql_fetch_row"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3040) : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3199) : error 035: argument type mismatch (argument 1)
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3200) : error 017: undefined symbol "mysql_store_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3201) : error 017: undefined symbol "mysql_fetch_row"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (3204) : error 017: undefined symbol "mysql_free_result"
C:\Users\Лев\Desktop\Сервер\gamemodes\NevadaSQ.pwn (325 : error 035: argument type mismatch (argument 1)
[/QUOTE]

Like everyone else who is upgrading from R5/R7 -> R33+, you are going to have to do a full re-code.
Reply

Hello !

My MySQL no load: Look:

http://www.upimg.fr/ih/rpcv.png

Thx
Reply

https://github.com/pBlueG/SA-MP-MySQ.../README.md#faq
Reply

I've got a problem with the latest MySQL plugin (R39-2).
I got no errors, my gamemode starts up properly, but when launching the game, I get no register/login dialog.

I've added some printf statements through the code and the problem lies in calling the callback with mysql_tquery.

OnPlayerConnect:
pawn Код:
// Try to get the password from the SQL-table (he might have already registered and needs to login properly by entering the password, or he might be a new player)
    printf("Executing Player_PasswordLoad");
    Player_PasswordLoad(playerid);
pawn Код:
// This function is called when the player logs in (OnPlayerConnect) and sends a query to try to retrieve the password for this player
Player_PasswordLoad(playerid)
{
    printf("Executed Player_PasswordLoad");
    // Setup local variables
    new Query[128];

    // Try to get the password from the SQL-table
    mysql_format(SQL_db, Query, sizeof(Query), "SELECT Password FROM %s WHERE PlayerName = '%e' LIMIT 1", table_playerdata, APlayerData[playerid][PlayerName]);
    printf("Running query to select password");
    printf("Query: %s", Query);
    mysql_tquery(SQL_db, Query, "Player_OnPasswordLoad", "i", playerid);
}

// This custom callback is called when a player connects to the server (MySQL received a query to get his password using the function "Player_PasswordLoad")
forward Player_OnPasswordLoad(playerid);
public Player_OnPasswordLoad(playerid)
{
    printf("Executed Player_OnPasswordLoad");
    // Check if this player's account exists (number of rows should be 1)
    if (cache_get_row_count(SQL_db) == 1)
    {
        // Store the password from the query-result
        cache_get_row(0, 0, APlayerData[playerid][PlayerPassword], SQL_db, 130);
        printf("Password: %s", APlayerData[playerid][PlayerPassword]);
        // Ask the player to enter his password to login
        ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, "Welcome", "Please login by entering your password:", "Login", "Cancel");
    }
    else // The player isn't registered yet (he has no account), so let him enter a password to register his account
        ShowPlayerDialog(playerid, DialogRegister, DIALOG_STYLE_PASSWORD, "Welcome", "Please register by entering your password:", "Register", "Cancel");

    return 1;
}
The last printf-statement that gets executed is:
Running query to select password
Query: SELECT Password FROM playerdata WHERE PlayerName = 'PowerPC603' LIMIT 1

The callback "Player_OnPasswordLoad" isn't executed at all ("Executed Player_OnPasswordLoad" doesn't get printed onto the server console).
The query is recorded into the MySQL logs though, it's only the callback that doesn't get executed.


I reverted back to MySQL plugin R34 by replacing:
- pawno/include/a_mysql.inc
- plugins/mysql.dll
- plugins/mysql.pdb
- deleting libmysql.dll from the root folder of the server

I didn't modify any code, only recompiled the code after replacing the include/plugin files.

Then everything works fine and I get my register/login dialog and I can properly login.
Also, every printf-statement you see in my code gets printed to the console.

What could be the problem?
I'm using samp server 0.3z R4.
I'm running 1 filterscript and the gamemode, which only connects to the database but doesn't use it (yet).
So the callback cannot be in 2 different scripts.
Another user experienced the same problem as me a few pages back (page 507), he's also using R39-2.

Log from R39-2:
Код:
[00:45:32] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT Password FROM %s WHERE PlayerName = '%e' LIMIT 1"
[00:45:32] [DEBUG] mysql_tquery - connection: 1, query: "SELECT Password FROM playerdata WHERE PlayerName = 'PowerPC603' ", callback: "Player_OnPasswordLoad", format: "i"
[00:45:32] [DEBUG] CMySQLQuery::Execute[Player_OnPasswordLoad] - starting query execution
[00:45:32] [DEBUG] CMySQLQuery::Execute[Player_OnPasswordLoad] - query was successfully executed within 0.369 milliseconds
[00:45:32] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[00:45:32] [DEBUG] Calling callback "Player_OnPasswordLoad"..
[00:45:32] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[00:45:44] [DEBUG] mysql_close - connection: 1
[00:45:44] [DEBUG] CMySQLConnection::Disconnect - connection was closed
[00:45:44] [DEBUG] CMySQLConnection::Disconnect - connection was closed
[00:45:44] [DEBUG] CMySQLHandle::~CMySQLHandle - deconstructor called
Log from R34:
Код:
[00:51:28] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT Password FROM %s WHERE PlayerName = '%e' LIMIT 1"
[00:51:28] [DEBUG] mysql_tquery - connection: 1, query: "SELECT Password FROM playerdata WHERE PlayerName = 'PowerPC603' ", callback: "Player_OnPasswordLoad", format: "i"
[00:51:28] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called
[00:51:28] [DEBUG] mysql_tquery - scheduling query "SELECT Password FROM playerdata WHERE PlayerName = 'PowerPC603' LIMIT 1"..
[00:51:28] [DEBUG] CMySQLQuery::Execute[Player_OnPasswordLoad(i)] - starting query execution
[00:51:28] [DEBUG] CMySQLQuery::Execute[Player_OnPasswordLoad(i)] - query was successful
[00:51:28] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[00:51:28] [DEBUG] CMySQLQuery::Execute[Player_OnPasswordLoad(i)] - data being passed to ProcessCallbacks()
[00:51:28] [DEBUG] Calling callback "Player_OnPasswordLoad"..
[00:51:28] [DEBUG] cache_get_row_count - connection: 1
[00:51:28] [DEBUG] cache_get_row - row: 0, field_idx: 0, connection: 1, max_len: 130
[00:51:28] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '0', data: "96655ca25611e89ba5090709b70950605691cd8e4578f4d1d1fd8a9ceca49e921451de31a7d3d37abd01691b82a6d8256075b11790a779b803a320d27727d78"
[00:51:28] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[00:51:28] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called
[00:51:31] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT * FROM %s WHERE PlayerName = '%e' LIMIT 1"
[00:51:31] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM playerdata WHERE PlayerName = 'PowerPC603' LIMIT 1", callback: "Player_OnAccountLoad", format: "i"
[00:51:31] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called
[00:51:31] [DEBUG] mysql_tquery - scheduling query "SELECT * FROM playerdata WHERE PlayerName = 'PowerPC603' LIMIT 1"..
[00:51:31] [DEBUG] CMySQLQuery::Execute[Player_OnAccountLoad(i)] - starting query execution
[00:51:31] [DEBUG] CMySQLQuery::Execute[Player_OnAccountLoad(i)] - query was successful
[00:51:31] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[00:51:31] [DEBUG] CMySQLQuery::Execute[Player_OnAccountLoad(i)] - data being passed to ProcessCallbacks()
[00:51:31] [DEBUG] Calling callback "Player_OnAccountLoad"..
[00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "SpeedInMph", connection: 1
[00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "SpeedInMph", data: "0"
[00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "ID", connection: 1
[00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "ID", data: "3"
[00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Fines", connection: 1
[00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Fines", data: "0"
[00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Tickets", connection: 1
[00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Tickets", data: "0"
[00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "TicketCost", connection: 1
[00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "TicketCost", data: "0"
[00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Money", connection: 1
[00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Money", data: "811256"
[00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Score", connection: 1
[00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Score", data: "5961"
[00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "AdminLevel", connection: 1
[00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "AdminLevel", data: "6"
[00:51:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "JailTime", connection: 1
[00:51:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "JailTime", data: "0"
[00:51:31] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[00:51:31] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called
[00:51:43] [DEBUG] mysql_close - connection: 1, wait: true
[00:51:43] [DEBUG] CMySQLConnection::Disconnect - connection was closed
[00:51:43] [DEBUG] CMySQLConnection::Disconnect - connection was closed
[00:51:43] [DEBUG] CMySQLHandle::~CMySQLHandle - deconstructor called
Another problem is, when I look at my logs, the filterscript (which holds my register/login system and alot more), only connects once to the MySQL server, gets data from the database using non-threaded queries (mysql_query) as this data must be loaded before the server is ready to accept players (gas-stations, police-stations, speedcams, vehicledata, ...), then the gamemode is loaded, which connects 3 times in a row to the MySQL server.
While in the code, there is only 1 mysql_connect statement.

Using R34, both scripts connect only once as there are only 2 connect log-entries instead of 4.


For now, I'll just be using R34 instead of the latest R39-2.
Reply

Could you show me your complete mysql_log.txt? (with all logs from the filterscript and gamemode; debug logging ofc)
Reply

Any idea what this:
pawn Код:
[23:04:12] [ERROR] "mysql_format" - invalid connection handle (id: -1)
[23:04:12] [ERROR] "mysql_tquery" - invalid connection handle (id: -1)
can be?

i'm trying save this:


pawn Код:
mysql_format(SQL, szQuery, sizeof(szQuery),"UPDATE `accounts` SET `skin` = '%d', `sex` = '%d', `age` = '%d', `from` = '%d', `sta` = '%d' WHERE `x` = '%d' LIMIT 1",  PlayerInfo[playerid][Skin], PlayerInfo[playerid][Sex], PlayerInfo[playerid][Age], PlayerInfo[playerid][From], PlayerInfo[playerid][sta], PlayerInfo[playerid][X]);
mysql_tquery(SQL, szQuery, "OnQueryFinish", "ii", THREAD_NO_RESULT, playerid);
but is not saving.

p.s: its loading and registering new accounts, only that values dont save, strange.
Reply

Quote:
Originally Posted by PT
Посмотреть сообщение
Any idea what this:
pawn Код:
[23:04:12] [ERROR] "mysql_format" - invalid connection handle (id: -1)
[23:04:12] [ERROR] "mysql_tquery" - invalid connection handle (id: -1)
can be?

i'm trying save this:


pawn Код:
mysql_format(SQL, szQuery, sizeof(szQuery),"UPDATE `accounts` SET `skin` = '%d', `sex` = '%d', `age` = '%d', `from` = '%d', `sta` = '%d' WHERE `x` = '%d' LIMIT 1",  PlayerInfo[playerid][Skin], PlayerInfo[playerid][Sex], PlayerInfo[playerid][Age], PlayerInfo[playerid][From], PlayerInfo[playerid][sta], PlayerInfo[playerid][X]);
mysql_tquery(SQL, szQuery, "OnQueryFinish", "ii", THREAD_NO_RESULT, playerid);
but is not saving.

p.s: its loading and registering new accounts, only that values dont save, strange.
Are you saving the connection ID through mysql_connect? Or you might have messed up the pool parameter of mysql_connect?

pawn Код:
new SQL = mysql_connect( ... );
pawn Код:
native mysql_connect(const host[], const user[], const database[], const password[], port = 3306, bool:autoreconnect = true, pool_size = 2); // <-- this one
If anything doesn't works, try replacing SQL with 1 instead.

pawn Код:
mysql_tquery(1, szQuery, "OnQueryFinish", "ii", THREAD_NO_RESULT, playerid);
Reply


Forum Jump:


Users browsing this thread: 19 Guest(s)