R7 Formats Not Showing Values:
#1

Код:
strcat(MySQL, "UPDATE users SET Score='%d', Money='%d', Admin='%d', Team='%d', BankBalance='%d',");
strcat(MySQL, "JailedMins='%d', JailedSecs='%d', WantedLevel='%d', BetaTesting='%d',");
strcat(MySQL, "Fishnet='%d', FishPermit='%d', On‌Drugs='%d', DrugAmount='%d',");
strcat(MySQL, "PoliceRank='%d', TempArrests='%0.1f', Crime='%s' WHERE Username='%s'");
    
mysql_format(MySQLConnection, MySQL2, MySQL, GetPlayerScore(playerid), PMoney[playerid], UserInfo[playerid][Admin], UserInfo[playerid][Team], UserInfo[playerid][BankBalance],
UserInfo[playerid][JailedMins], UserInfo[playerid][JailedSecs],	UserInfo[playerid][WantedLevel], UserInfo[playerid][BetaTesting], UserInfo[playerid][FishNet],
UserInfo[playerid][FishPermit], UserInfo[playerid][OnDrugs], UserInfo[playerid][DrugAmount], UserInfo[playerid][PoliceRank],UserInfo[playerid][CopWorkArrest],
CrimeString, UserInfo[playerid][Name]);


mysql_function_query(MySQLConnection, MySQL2, false, "NoThreadResult", "i", INVALID_PLAYER_ID);
This is the outcome but it prints the values fine but apart from the last three it's shown as:

TempArrests='%0.1f', Crime='%s' WHERE Username='%s')

Insted of numbers / Strings.

If you want the full print debug of the query click here: http://pastebin.com/sJDyGxy8

Thank you.
Reply
#2

obviously looks like some sort of mysql_format problem... '%d'? you've been here to long for that shit man.. no offence

Try format, or try MySQL R7-2 plugin

-- He said format worked, I'll pm you Jernej and Blacklite
Reply
#3

Kar: i'd like to hear your idea of "smart updating"
Reply
#4

Quote:
Originally Posted by Kar
Посмотреть сообщение
X-X why don't you use smart updating.. you've been doing this shit for so long and still make those large queries..

obviously looks like some sort of mysql_format problem... '%d'? you've been here to long for that shit man.. no offence

Try format, or try MySQL R7-2 plugin
There's nothing wrong with long queries. They are usually better than lots of short ones, and with UPDATE queries you can thread them and not bother retrieving the response.

Also one UPDATE means that you only search for the player record once - means less searching, even if your tables are indexed correctly (which they should be!).

I'd like to see how you update large amounts of account data.
Reply
#5

Blacklite, I doubt he meant sending a lot of UPDATE queries in a row.

I'd second Kar's opinion - there's no need to update the fields that rarely need to be updated in OnPlayerDisconnect. Things such as toggles.
However you have an interesting point of how only one query is needed when all this data is saved when the player quits, but I seriously doubt that there's any noticeable difference so it comes down to a personal preference.
Reply
#6

I'd just like to add that you can also use UPDATE LOW_PRIORITY (****** it if you don't know what it is). Basically using a combination of threading and UPDATE LOW_PRIORITY, the effort of saving your player stats will be sent to MySQL, and UPDATE LOW_PRIORITY means the MySQL server will do the query in its own time.

I suggest for big tables that don't get new rows very often, that you also use InnoDB as it has row locking, although with InnoDB you can't use UPDATE LOW_PRIORITY.

EDIT: Just by the way, the reason I pounced on this thread is because Kar basically said he was doing it wrong, when there was nothing outstandingly wrong in the way that Kyle's query was done.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)