[Release] MySQL Async Library - 3.3.2

I talked with @JoshhIM his answer was not that conclusive with yes or no, except for some graphs that were indicating “probably yes”, but i figured switching to 3.0.8 might fix it, until i put out the next version which returns back to mysql 2.15.0

I was waiting for a reply, before rolling back that change from mysql-async 3.0.8.

Hey zr0iq,

Just a massive thank you from me.
Without your work, a lot of servers would be sub par.

Luff Luff :revolving_hearts:
Dk

1 Like

Changes

  • Go back to mysql.js 2.15
  • Add transactions
  • Errors are now always red, unless the debug output is only written to files.
  • Use stylus for styling

Transaction examples:

  local sqls = { 'UPDATE test_users SET last_name = @ln1 WHERE id = @id1', 'UPDATE test_users SET last_name = @ln2 WHERE id = @id2' }
  local params = { id1 = 21, id2 = 22, ['@ln1'] = 'MySQL-Async1', ['@ln2'] = 'MySQL-Async2' }
  MySQL.Async.transaction(sqls, params, function(result)
    if result then
      print('Success1')
    else
      print('Failure1')
    end
  end)
  local sqls = { 
    { query = 'UPDATE test_users SET last_name = @ln1 WHERE id = @id1', parameters = { id1 = 23, ['@ln1'] = 'MySQL-Async3' } },
    { query = 'UPDATE test_users SET last_name = @ln2 WHERE id = @id2', parameters = { id2 = 24, ['@ln2'] = 'MySQL-Async4' } }
  }
  MySQL.Async.transaction(sqls, function(result)
    if result then
      print('Success2')
    else
      print('Failure2')
    end
  end)
  local sqls = { 
    { query = 'UPDATE test_users SET last_name = @ln1 WHERE id = @id1', parameters = { id1 = 25, ['@ln1'] = 'MySQL-Async3' } },
    { query = 'UPDATE test_users SET last_name = @ln2 WHERE idd = @id2', parameters = { id2 = 26, ['@ln2'] = 'MySQL-Async4' } }
  }
  MySQL.Async.transaction(sqls, function(result)
    if result then
      print('Success3')
    else
      print('Failure3')
    end
  end)

This will print:

Success1
Success2
Failure3

Both updates of the Failure3 print are not commited to the database, as they are transactions.

edit: Also MySQL.Sync.transaction exists. See that there is two different syntaxes you can use.

1 Like

Like 3-4 scripts got bugged cause of the new update. How do I fix it?

1 Like

hello i got this 2k id’s

guys how i can add the utf-8 in the database ? ty

this plugin not working with mysql 8.0
any future updates for newer mysql versions?

mysql-asnyc generate server thread warning. How can reduce this tick time ?

3 Likes

who knows how to fix it please help.

Someone know how to fix this error ?

nui://mysql-async/ui/app.js:14, Uncaught TypeError: Cannot read property 'type' of undefined

Ubuntu cannot connect mysql

I use Ubuntu 18.04, fivem server version: 1462-ba3c7493bf62c6fab054987761 c41d3b6c696889/, MySQL version: 5.7, mysql-async version: 3.2, I can not connect to the remote server, after debugging, I found that socket has been opened, but can not send and receive data packets, resulting in MySQL can not log on and be canceled. But I can use localhost to connect to the local server, and I can use Windows 10 and mysql-async 3.2 to connect to my MySQL 5.7 server. Now I don’t know how to solve it. I need help. Thank you.

I have the same error. Anyone know how to fix?

.type is used 48 times over approximately 17568 lines of code in that JS file, you will need to provide a bit more information about what you were doing at the time of the error, to narrow down the cause of the issue.

[vRP/C#] query exception vRP/init_user_identity : System.AggregateException: One or more errors occurred. (Parameter '@registration' must be defined. To use this as a variable, set 'Allow User Variables=true' in the connection string.) ---> MySql.Data.MySqlClient.MySqlException: Parameter '@registration' must be defined. To use this as a variable, set 'Allow User Variables=true' in the connection string.
  at MySql.Data.MySqlClient.MySqlStatementPreparer+ParameterSqlParser.OnNamedParameter (System.Int32 index, System.Int32 length) [0x0005b] in <c9032194188746cfa5d8bb7625c7912b>:0
  at MySql.Data.MySqlClient.MySqlParser.Parse (System.String sql) [0x001be] in <c9032194188746cfa5d8bb7625c7912b>:0
  at MySql.Data.MySqlClient.MySqlStatementPreparer.ParseAndBindParameters () [0x0003a] in <c9032194188746cfa5d8bb7625c7912b>:0
  at MySql.Data.MySqlClient.CommandExecutors.TextCommandExecutor.ExecuteReaderAsync (System.String commandText, MySql.Data.MySqlClient.MySqlParameterCollection parameterCollection, System.Data.CommandBehavior behavior, MySql.Data.Protocol.Serialization.IOBehavior ioBehavior, System.Threading.CancellationToken cancellationToken) [0x000c6] in <c9032194188746cfa5d8bb7625c7912b>:0
  at MySql.Data.MySqlClient.CommandExecutors.TextCommandExecutor.ExecuteNonQueryAsync (System.String commandText, MySql.Data.MySqlClient.MySqlParameterCollection parameterCollection, MySql.Data.Protocol.Serialization.IOBehavior ioBehavior, System.Threading.CancellationToken cancellationToken) [0x00094] in <c9032194188746cfa5d8bb7625c7912b>:0
  at vRP.MySQL+<>c__DisplayClass11_2.<e_query>b__0 () [0x0022c] in <8dfc0861f4df44189d833de5e878b97b>:0
   Exception_EndOfInnerExceptionStack
---> (Inner Exception #0) MySql.Data.MySqlClient.MySqlException (0x80004005): Parameter '@registration' must be defined. To use this as a variable, set 'Allow User Variables=true' in the connection string.
  at MySql.Data.MySqlClient.MySqlStatementPreparer+ParameterSqlParser.OnNamedParameter (System.Int32 index, System.Int32 length) [0x0005b] in <c9032194188746cfa5d8bb7625c7912b>:0
  at MySql.Data.MySqlClient.MySqlParser.Parse (System.String sql) [0x001be] in <c9032194188746cfa5d8bb7625c7912b>:0
  at MySql.Data.MySqlClient.MySqlStatementPreparer.ParseAndBindParameters () [0x0003a] in <c9032194188746cfa5d8bb7625c7912b>:0
  at MySql.Data.MySqlClient.CommandExecutors.TextCommandExecutor.ExecuteReaderAsync (System.String commandText, MySql.Data.MySqlClient.MySqlParameterCollection parameterCollection, System.Data.CommandBehavior behavior, MySql.Data.Protocol.Serialization.IOBehavior ioBehavior, System.Threading.CancellationToken cancellationToken) [0x000c6] in <c9032194188746cfa5d8bb7625c7912b>:0
  at MySql.Data.MySqlClient.CommandExecutors.TextCommandExecutor.ExecuteNonQueryAsync (System.String commandText, MySql.Data.MySqlClient.MySqlParameterCollection parameterCollection, MySql.Data.Protocol.Serialization.IOBehavior ioBehavior, System.Threading.CancellationToken cancellationToken) [0x00094] in <c9032194188746cfa5d8bb7625c7912b>:0
  at vRP.MySQL+<>c__DisplayClass11_2.<e_query>b__0 () [0x0022c] in <8dfc0861f4df44189d833de5e878b97b>:0 <---

[vRP] task 266 failed.
[vRP] task 266 failed.
Sending heartbeat to live-internal.fivem.net:30110
Received a vouch for Black List, they have 2 vouches and need 2.
Black List is the new arbitrator, with an overwhelming 2 vote/s.
Syncing weather for: Black List
steam:110033
[gd_farm] Sending owned field data to uid 2
Black List: fahad
Uncle Fahad: ������
Black List: ���������� ������ ��������������
Black List: �������� ���������� ����������
Uncle Fahad: ��������
Black List: �������� �������� ������ ��
Uncle Fahad: �������� ������ ��
Black List: �������� ��������
[vRP] 95.1899 disconnected (user_id = 2459)
Sending heartbeat to live-internal.fivem.net:30110
QUEUE: ���� KliZeR ����[steam:110070c8] was placed 1/1 in queue
QUEUE: ���� KliZeR ����[steam:110070c8] is loading into the server
[vRP] ���� KliZeR ���� (149.200) rejected: identification error

Did you pass it an undefined variable? What did you do to cause this error?

The error pop up when you spawn in the server, but it only show 1 time when you spawn it’s not spamming the error.

this is how it looks when the error comes

[143078] Creating script environments for mysql-async
[143187] Creating script environments for essentialmode
[143234] nui://mysql-async/ui/app.js:14, Uncaught TypeError: Cannot read property 'type' of undefined
[143234] 
[143344] Creating script environments for async
[143500] Creating script environments for es_extended

Does the script still work? If so, I wound’t worry too much.

Yes it works great :slight_smile:

Yes, error came direct from spawning. I dont find any problems, but wanted to see if there is solution to fix. Or add it into bug list. Rest works very well.

[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:655: in metamethod ‘__index’
@mysql-async/lib/MySQL.lua:147: in field ‘fetchAll’
server/main.lua:7: in function ‘loadWhiteList’
server/main.lua:28: in function <server/main.lua:24>

Help please