Add TYPE_USERNAME and TYPE_PLAYERIP
PatrickGTR opened this issue · comments
Related to discussion on discord -> https://discord.com/channels/231799104731217931/231799180127895553/891657642961948703
I have a suggestions about this, since username and IP is a string, why not just do something like this:
stock MySQL_BindUsername(Statement:statement, param, playerid) {
new playerName[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, playerName, sizeof(playerName));
stmt_bind_value(statement, param, TYPE_STRING, playerIp);
}
stock MySQL_BindIp(Statement:statement, param, playerid) {
new playerIp[16 + 1];
GetPlayerIp(playerid, playerIp, sizeof(playerIp));
stmt_bind_value(statement, param, TYPE_RAW_STRING, playerIp);
}
By doing this, you don't have to create new TYPE for binding the query.
I have a suggestions about this, since username and IP is a string, why not just do something like this:
stock MySQL_BindUsername(Statement:statement, param, playerid) { new playerName[MAX_PLAYER_NAME + 1]; GetPlayerName(playerid, playerName, sizeof(playerName)); stmt_bind_value(statement, param, TYPE_STRING, playerIp); } stock MySQL_BindIp(Statement:statement, param, playerid) { new playerIp[16 + 1]; GetPlayerIp(playerid, playerIp, sizeof(playerIp)); stmt_bind_value(statement, param, TYPE_RAW_STRING, playerIp); }By doing this, you don't have to create new TYPE for binding the query.
Good shout, I don't have time right now but if you can do it, do some tests and make pull request! Thanks.