[Release] MySQL Async Library - 3.3.2

Error: (node:17356) UnhandledPromiseRejectionWarning: TypeError: Cannot read property ‘3’ of null
at parseConnectingString (mysql-async.js:5027:30)
at global.on (mysql-async.js:5043:18)
at citizen:/scripting/v8/main.js:193:28
Error: (node:17356) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
Error: (node:17356) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Error calling system call ref function in resource TODO: TypeError: Cannot read property ‘query’ of undefined
stack:
TypeError: Cannot read property ‘query’ of undefined
at Object.global.exports [as callback] (mysql-async.js:4973:10)
at citizen:/scripting/v8/main.js:87:41
Error resuming coroutine: citizen:/scripting/lua/scheduler.lua:707: An error happened while calling export mysql_fetch_all of resource mysql-async (citizen:/scripting/lua/MessagePack.lua:830: missing bytes), see above for details
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:707: in method ‘mysql_fetch_all’
@mysql-async/lib/MySQL.lua:143: in field ‘fetchAll’
server.lua:305: in function ‘loadBanList’
server.lua:21: in function server.lua:10

Someone an idea?

Use a proper connection string.

Or make a sane connection string interpreter :thinking:

@Syntasu Psst. That usually happens on the default connection string, because it still expects a questionmark at the end.

@Im_Kawiz It does not hitch for me. It has to be one some specific queries?

So it’s not sane then :thinking:

I always want pie, but it’s only a pie if it has chocolate icing on top, otherwise imma spit errors!

Yes, I might throw on when it is not a pie to begin with. But that is not really a priority.

Hello, I got a Linux server very recently, problem is that in the description it is saying that the new version is not currently ok for linux, but you need to use the 2.1.1…and I mean ok from here , even though nothing makes sense since the version that is downloadable is the 2.0.2!!!Where is the 2.1.1 how do I know how to get the 2.1.1 because I tried to put mysql async in the new server but there are only errors and problems. Thank you for you help in advance.(It is a Linux server just as a reminder).

since 3.0.5 it is okay to use for linux. Just go to github and download it all fine.

Update to 3.0.7

  • Added a version to the resource.lua so scripts can ask for the version by querying the metadata.
  • Refactor to use Promises in preparation for adding transactions.
  • Make the error on the missing connection string clearer.
  • Added a warning on queries that take more than 500ms. Time can be controlled by setting
set mysql_slow_query_warning <time-in-ms>

e.g.

set mysql_slow_query_warning 50

to print all queries that take more than one server-tick to complete. Setting it to 0 should disable the slow query warnings.

2 Likes

Thank you for the support

[MySQL] [Slow Query Warning] [es_extended] [794ms] UPDATE user_inventory SET co unt = 46 WHERE identifier = ‘steam:11000010e6axxxx’ AND item = ‘bread’
[MySQL] [Slow Query Warning] [es_extended] [939ms] UPDATE user_inventory SET co unt = 50 WHERE identifier = ‘steam:11000010e6axxxx’ AND item = ‘opium_pooch’
[MySQL] [Slow Query Warning] [es_extended] [1198ms] UPDATE user_inventory SET c ount = 0 WHERE identifier = ‘steam:11000010e6axxxx’ AND item = ‘opium’

What caused the problem? And how can it be fixed?

@SpecialX How many entries does your table have?

125.466 rows… there is your issue. As @zr0iq kindly pointed out to me, use an index on the table for faster indexing.

that is easy to fix.

ALTER TABLE user_inventory
  ADD INDEX user_inventory_ident_item (identifier, item);
2 Likes

I do not understand you suggest.

Run this query in your database, it should fix your issue. An index over both rows that are queried in your WHERE statement solves the issue.

I do not have much knowledge. I just started. Would you like to suggest a step-by-step solution?

for i=1, #xPlayer.inventory, 1 do

  if ESX.LastPlayerData[xPlayer.source].items[xPlayer.inventory[i].name] ~= xPlayer.inventory[i].count then

  	table.insert(asyncTasks, function(cb)
  		MySQL.Async.execute('UPDATE user_inventory SET `count` = @count WHERE identifier = @identifier AND item = @item',
  		{
  			['@count']      = xPlayer.inventory[i].count,
  			['@identifier'] = xPlayer.identifier,
  			['@item']       = xPlayer.inventory[i].name
  		}, function(rowsChanged)
  			cb()
  		end)
  	end)

  	ESX.LastPlayerData[xPlayer.source].items[xPlayer.inventory[i].name] = xPlayer.inventory[i].count

  end

end

It literally is a step-by-step solution, just run the given query.

image