[Release] MySQL Async Library - 3.3.2

Haaj everybody
Can pls somebody help me explain set this up.
I have es_rp and banking running just like essential mode.
And now I need this for cops but I don’t get it work
Thanks allready

What is it?


hello guys im getting this error on my server.

Failed to load script @async/async.lua.

is this normal or is there a fix


This is the server log but everything is setup could anyone help me please

Hi,

Can someone explain what’s the difference between fetchAll and fetchScalar please ?

Thanks

Edit: Got it.

fetchAll simply returns the whole result of the query
fetchScalar returns the first field of the first row

I don’t suppose somebody can help with the following error code.

Exception rethrown at [0]:
at (wrapper xdomain-invoke) CitizenFX.Core.InternalManager:CallRef (int,byte[],intptr&,int&)
at (wrapper remoting-invoke-with-check) CitizenFX.Core.InternalManager:CallRef (int,byte[],intptr&,int&)
at CitizenFX.Core.MonoScriptRuntime.CallRef (System.Int32 refIndex, System.Byte[] argsSerialized, System.Int32 argsSize, System.IntPtr& retvalSerialized, System.Int32& retvalSize) [0x00013] in /src/code/client/clrcore/MonoScriptRuntime.cs:151
Error running system event handling function for resource mysql-async: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: citizen:/scripting/lua/scheduler.lua:453: An error happened while calling export mysql_configure 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:453: in method 'mysql_configure’
lib/init.lua:3: in upvalue 'handler’
citizen:/scripting/lua/scheduler.lua:163: in function citizen:/scripting/lua/scheduler.lua:162
stack traceback:
[C]: in function 'error’
citizen:/scripting/lua/scheduler.lua:41: in field 'CreateThreadNow’
citizen:/scripting/lua/scheduler.lua:162: in function citizen:/scripting/lua/scheduler.lua:131
hitch warning: frame time of 257 milliseconds

Can someone help with this error?

[    170172] [ERROR] [MySQL] An critical error happens on MySQL for query "SELECT * FROM users WHERE `identifier`=@identifier; {identifier=steam:110000111c28d35}": Method 'System.Security.Cryptography.X509Certificates.X509Certificate2..ctor' not found.   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x0002c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170187]   at MySql.Data.Serialization.MySqlSession.InitSslAsync (MySql.Data.Serialization.ProtocolCapabilities serverCapabilities, MySql.Data.Serialization.ConnectionSettings cs, MySql.Data.Protocol.Serialization.IOBehavior ioBehavior, System.Threading.CancellationToken cancellationToken) [0x00044] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0 

[    170187]   at MySql.Data.Serialization.MySqlSession+<ConnectAsync>d__49.MoveNext () [0x003da] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0 

[    170203] --- End of stack trace from previous location where exception was thrown ---

[    170203]   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170203]   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170219]   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170219]   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170219]   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170234]   at MySql.Data.MySqlClient.ConnectionPool+<GetSessionAsync>d__0.MoveNext () [0x00467] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0 

[    170250] --- End of stack trace from previous location where exception was thrown ---

[    170250]   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170250]   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170266]   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170266]   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170266]   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170281]   at MySql.Data.MySqlClient.MySqlConnection+<CreateSessionAsync>d__68.MoveNext () [0x00102] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0 

[    170281] --- End of stack trace from previous location where exception was thrown ---

[    170297]   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170297]   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170297]   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170312]   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170312]   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170312]   at MySql.Data.MySqlClient.MySqlConnection+<OpenAsync>d__19.MoveNext () [0x000cb] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0 

[    170328] --- End of stack trace from previous location where exception was thrown ---

[    170328]   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170328]   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170344]   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170344]   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170344]   at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 

[    170359]   at MySQLAsync.Operation`1+<ExecuteAsync>d__3[TResult].MoveNext () [0x000aa] in <6b79789832b34a31961dbb39358e1b3f>:0
1 Like

Thankyou for this library, using it in my framework, great job.

Un grand merci frenchy :slight_smile:

Brouznouf, is possible and there is a guide on how to use MySQL Async coding in C# insted of lua?
Thx very much.

does it can be use for xampp ?

Yes, I wouldn’t think it would cause any issues. However, you’ll need to edit the values to whatever your actual server values are.

I don’t know if you’ve already figured out how to use MySQL Async in C# instead of lua, but I’ve gotten close.

Basically you can call the Exported functions in about the same way:

Exports["mysql-async"].mysql_execute("sql statement", parameters, callback);

Except the parameters are a IDictionary<string, object>, done something like this:

var parameters = new Dictionary<string, object>();
parameters.Add("@parameter", variable);

The only part that I haven’t quite figured out is the callback because I don’t quite understand how to use the CallbackDelegate class yet.
Also, don’t forget to load the mysql-async resource in your server.cfg:

start mysql-async

And if anyone could help shed some light on how I use the CallbackDelegate class in C# I think I could get MySQL Async working in my C# scripts.
Thanks in advance for any help.

So I did actually get this working by doing this in the ‘callback’:

new Action<int>(OnDatabaseCallback)

And OnDatabaseCallback just looks like this (since I don’t actually want to do anything on the callback, except maybe saying that the save happened successfully):

private void OnDatabaseCallback(int result)
{

}

So I’m a total newb. I mean, a COMPLETE newb.

Is anyone willing to sit with me in Discord or something and explain MySQL and Async to me so that I understand what it does and how resources that require it, use it and what they do with it?

Pretty please. Muchos Gracias. Love ya long time.

1 Like

I know you had this issue months ago, but the solution is just to disable SSL.

You can do this in your connection string, just add sslmode=none to the end.

For example:
server=localhost;database=gta5;userid=root;password=p4ssw0rd;sslmode=none

help me ave this erreur Error running system event handling function for resource esplugin_mysql: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: citizen:/scripting/lua/scheduler.lua:652: No such export mysql_fetch_all in resource mysql-async
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:652: in metamethod ‘__index’
@mysql-async/lib/MySQL.lua:111: in field ‘fetchAll’
server.lua:15: in upvalue ‘handler’
citizen:/scripting/lua/scheduler.lua:174: in function citizen:/scripting/lua/scheduler.lua:173
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:41: in field ‘CreateThreadNow’
citizen:/scripting/lua/scheduler.lua:173: in function citizen:/scripting/lua/scheduler.lua:138

Hello, when i try to run mysql Async i get this error and i dont know how to fix it

https://pastebin.com/vKix830A

Any help would be great

Thanks.

did you set your MySQL config in your server.cfg?

set mysql_connection_string “server=127.0.0.01;database=gta5_gamemode_essential;userid=root;password=1202”

Yep i did :slight_smile:

Hello guys,i finnaly make a local server,which’s have essential connected to MySQL,and i fix like 3 huge errors,and now i’m getting this error: An error happens on MySQL for query “SELECT * FROM users WHERE identifier=@identifier; {identifier=steam:110000107d2774a}”: Unknown database .User,name and password for DB is correct.Any ideas?