MySQL fetching data error invalid data type - NULL - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL fetching data error invalid data type - NULL (
/showthread.php?tid=612310)
MySQL fetching data error invalid data type - NULL -
Hargrave - 16.07.2016
Hey folks!
I'm new to all this so excuse me if this is a dumb question, thanks. So I am currently trying to fix up an old gamemode just for fun, and apparently whenever I start up the server I get these errors saying I have invalid data type when using cache_get_row_int and cache_get_row_float. All these have DEFAULT NULL.
Examples:
Код:
[DEBUG] CMySQLResult::GetRowData - row: '5', field: '19', data: "NULL"
[ERROR] cache_get_row_int - invalid datatype
[DEBUG] CMySQLResult::GetRowData - row: '6', field: '12', data: "NULL"
[ERROR] cache_get_row_float - invalid datatype
Shouldn't it ignore the data when it's NULL and not retrieve the actual word NULL? I'd think it should avoid it and not give a result of NULL, because that would obviously cause a problem when it's a string and integer. I'm using BlueG's MysQL R39-5. Anyone got any suggestions?
// If any further information is needed to solve this problem, let me know.
Re: MySQL fetching data error invalid data type - NULL -
Konstantinos - 16.07.2016
If you try to retrieve any data with
cache_get_row_int and
cache_get_row_float functions and its datatype is not integer and float respectively, it will display the error and that is a fine behavior if you ask me.
Default values shouldn't be set to NULL to begin with. If for whatever reason you want to keep them NULL, there's a macro "ismysqlnull" in the a_mysql.inc file. You retrieve with cache_get_row, if it is not null converting manually but that is by far worse method.