-
SELECT
Statements that read a Row =>.fetchAll
e.g.SELECT * FROM characters WHERE cid = @cid LIMIT 1
-
SELECT
Statements that read a singular value from a singular row =>.fetchScalar
e.g.SELECT name FROM characters WHERE cid = @cid LIMIT 1
-
INSERT
Statements =>.Insert
or.execute
; Execute returns the number of rows inserted, Insert returns the Last Insert Id. -
UPDATE / DELETE
Statements =>.execute
-
Multiple
UPDATE / DELETE / INSERT
Statements that belong together =>.transaction
; this ensures that if one fails, noone of them are in the database. -
On bad machines you should prefer
Async
andThreaded
options, on good machines you can use someSync
calls.
So I’m giving it a try on what I understand and using something simple as a test so I have this in the server filee:
RegisterServerEvent('kom:save')
AddEventHandler('kom:save', function(head)
MySQL.Async.execute(
'UPDATE `users` SET `skin` = @head WHERE `identifier` = @identifier',
{
['@identifier'] = player.getIdentifier(),
['@head'] = head
})
end)
and in the client this is suppose to trigger when I close a menu
myHead = 'testme'
TriggerServerEvent('kom:save', myHead)
It doesn’t seem to do anything to the database at all and I don’t get any errors…
Any help would be greatly appreciated.
Thank you,
Kombowz
AddEventHandler('kom:save', function(head)
print("Save event called")
print(json.encode(head))
...
debug it step by step. Also enable debug mode in the server.cfg by setting set mysql_debug true
(if I remember correctly)
Hello! Is it possibel (in that case how?) to make some sort of command that works from the console that saves all the players in-game? So they dont get a rollback when they dont have time to dissconect in time
Hi guys, i have a random problem…
My server makes a random timeout for all players and the console return this error:
[ 43187828] [ERROR] [MySQL] An critical error happens on MySQL for query "SELECT * FROM owned_vehicles {=}": MySqlSession is not connected. at MySql.Data.Serialization.MySqlSession.VerifyConnected () [0x00052] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43187828] at MySql.Data.Serialization.MySqlSession.ReceiveReplyAsync (MySql.Data.Protocol.Serialization.IOBehavior ioBehavior, System.Threading.CancellationToken cancellationToken) [0x00000] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43187828] --- End of stack trace from previous location where exception was thrown ---
[ 43187828] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at MySql.Data.Serialization.MySqlSession.TryAsyncContinuation (System.Threading.Tasks.Task`1[TResult] task) [0x00016] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43187828] at (wrapper delegate-invoke) System.Func`2[System.Threading.Tasks.Task`1[System.ArraySegment`1[System.Byte]],MySql.Data.Serialization.PayloadData]:invoke_TResult_T (System.Threading.Tasks.Task`1<System.ArraySegment`1<byte>>)
[ 43187828] at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[TAntecedentResult,TResult].InnerInvoke () [0x00024] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Threading.Tasks.Task.Execute () [0x00010] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] --- End of stack trace from previous location where exception was thrown ---
[ 43187828] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at MySql.Data.MySqlClient.Results.ResultSet+<>c__DisplayClass8_0+<<ScanRowAsync>g__ScanRowAsyncAwaited0>d.MoveNext () [0x00075] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43187828] --- End of stack trace from previous location where exception was thrown ---
[ 43187828] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1+ConfiguredValueTaskAwaiter[TResult].GetResult () [0x0001e] in <4ac30274d31c4b8099694c24336fcb22>:0
[ 43187828] at MySql.Data.MySqlClient.Results.ResultSet+<ReadAsync>d__6.MoveNext () [0x000cb] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43187828] --- End of stack trace from previous location where exception was thrown ---
[ 43187828] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at MySql.Data.MySqlClient.Results.ResultSet+<ReadEntireAsync>d__3.MoveNext () [0x00079] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43187828] --- End of stack trace from previous location where exception was thrown ---
[ 43187828] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at MySql.Data.MySqlClient.MySqlDataReader+<NextResultAsync>d__5.MoveNext () [0x0009e] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43187828] --- End of stack trace from previous location where exception was thrown ---
[ 43187828] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43187828] at MySql.Data.MySqlClient.MySqlDataReader.NextResult () [0x00012] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43187828] at MySql.Data.MySqlClient.MySqlDataReader.DoClose () [0x00013] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43187828] at MySql.Data.MySqlClient.MySqlDataReader.Close () [0x00000] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43187828] at System.Data.Common.DbDataReader.Dispose (System.Boolean disposing) [0x00003] in <c660f5a12cac430aa34fafb29a22e588>:0
[ 43187828] at MySql.Data.MySqlClient.MySqlDataReader.Dispose (System.Boolean disposing) [0x0000b] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43187828] at System.Data.Common.DbDataReader.Dispose () [0x00000] in <c660f5a12cac430aa34fafb29a22e588>:0
[ 43187828] at (wrapper remoting-invoke-with-check) System.Data.Common.DbDataReader:Dispose ()
[ 43187828] at MySql.Data.MySqlClient.MySqlConnection.CloseDatabase () [0x00011] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43187828] at MySql.Data.MySqlClient.MySqlConnection.DoClose () [0x00018] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43187828] at MySql.Data.MySqlClient.MySqlConnection.Dispose (System.Boolean disposing) [0x00003] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43187828] at System.ComponentModel.Component.Dispose () [0x00000] in <7d13762c3f3046279fc4d30c52f6f595>:0
[ 43187828] at MySQLAsync.Operation`1+<ExecuteAsync>d__3[TResult].MoveNext () [0x0022f] in <6b79789832b34a31961dbb39358e1b3f>:0
[ 43188828] Exception thrown by a task: System.AggregateException: One or more errors occurred. ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
[ 43188828] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at MySql.Data.ValueTaskExtensions+<>c__DisplayClass0_0`2[T,TResult].<ContinueWith>b__0 (System.Threading.Tasks.Task`1[TResult] task) [0x0000c] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43188828] at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[TAntecedentResult,TResult].InnerInvoke () [0x00024] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Threading.Tasks.Task.Execute () [0x00010] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] --- End of stack trace from previous location where exception was thrown ---
[ 43188828] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at MySql.Data.Serialization.MySqlSession.TryAsyncContinuation (System.Threading.Tasks.Task`1[TResult] task) [0x00016] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43188828] at (wrapper delegate-invoke) System.Func`2[System.Threading.Tasks.Task`1[System.ArraySegment`1[System.Byte]],MySql.Data.Serialization.PayloadData]:invoke_TResult_T (System.Threading.Tasks.Task`1<System.ArraySegment`1<byte>>)
[ 43188828] at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[TAntecedentResult,TResult].InnerInvoke () [0x00024] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Threading.Tasks.Task.Execute () [0x00010] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] --- End of stack trace from previous location where exception was thrown ---
[ 43188828] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at MySql.Data.MySqlClient.Results.ResultSet+<>c__DisplayClass8_0+<<ScanRowAsync>g__ScanRowAsyncAwaited0>d.MoveNext () [0x00075] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43188828] --- End of stack trace from previous location where exception was thrown ---
[ 43188828] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1+ConfiguredValueTaskAwaiter[TResult].GetResult () [0x0001e] in <4ac30274d31c4b8099694c24336fcb22>:0
[ 43188828] at MySql.Data.MySqlClient.Results.ResultSet+<ReadAsync>d__6.MoveNext () [0x000cb] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43188828] --- End of stack trace from previous location where exception was thrown ---
[ 43188828] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at MySQLAsync.FetchAll+<ReaderAsync>d__2.MoveNext () [0x0016c] in <6b79789832b34a31961dbb39358e1b3f>:0
[ 43188828] --- End of inner exception stack trace ---
[ 43188828] ---> (Inner Exception #0) System.IO.EndOfStreamException: Attempted to read past the end of the stream.
[ 43188828] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at MySql.Data.ValueTaskExtensions+<>c__DisplayClass0_0`2[T,TResult].<ContinueWith>b__0 (System.Threading.Tasks.Task`1[TResult] task) [0x0000c] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43188828] at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[TAntecedentResult,TResult].InnerInvoke () [0x00024] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Threading.Tasks.Task.Execute () [0x00010] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] --- End of stack trace from previous location where exception was thrown ---
[ 43188828] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at MySql.Data.Serialization.MySqlSession.TryAsyncContinuation (System.Threading.Tasks.Task`1[TResult] task) [0x00016] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43188828] at (wrapper delegate-invoke) System.Func`2[System.Threading.Tasks.Task`1[System.ArraySegment`1[System.Byte]],MySql.Data.Serialization.PayloadData]:invoke_TResult_T (System.Threading.Tasks.Task`1<System.ArraySegment`1<byte>>)
[ 43188828] at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[TAntecedentResult,TResult].InnerInvoke () [0x00024] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Threading.Tasks.Task.Execute () [0x00010] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] --- End of stack trace from previous location where exception was thrown ---
[ 43188828] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188828] at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188844] at MySql.Data.MySqlClient.Results.ResultSet+<>c__DisplayClass8_0+<<ScanRowAsync>g__ScanRowAsyncAwaited0>d.MoveNext () [0x00075] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43188844] --- End of stack trace from previous location where exception was thrown ---
[ 43188844] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188844] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188844] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188844] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188844] at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188844] at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1+ConfiguredValueTaskAwaiter[TResult].GetResult () [0x0001e] in <4ac30274d31c4b8099694c24336fcb22>:0
[ 43188844] at MySql.Data.MySqlClient.Results.ResultSet+<ReadAsync>d__6.MoveNext () [0x000cb] in <5d2e43c2aa6f4da0bb43a6a12077ad51>:0
[ 43188844] --- End of stack trace from previous location where exception was thrown ---
[ 43188844] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188844] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188844] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188844] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188844] at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
[ 43188844] at MySQLAsync.FetchAll+<ReaderAsync>d__2.MoveNext () [0x0016c] in <6b79789832b34a31961dbb39358e1b3f>:0 <---
Its very random!
Sometimes its get days without falling, can anyone help me please? Thanks.
I think this did not occur on my test; as I believe this happened on the for connection pools with a similar error, but in the last version some errors got rewritten. Maybe it is the same.
In these that depends highly on how many call you do how. If you send a lot of MySQL Async queries this might happen, e.g. more than 150 per second.
If it is your code, you should use some Threaded
calls (in the newer version) in between to soften the load for the Async part. Which should be with sane Threaded
usage handle up to maybe 220qps on a bad system configuration.
If your usage is any higher, you might need to switch for GHMattiMySQL. Which really starts to shine on a server with 4 or more cores.
edit: If you got less than four cores, you are in any case usually better off with mysql-async.
i am getting this error and i do not know what line i have wrong or if i need to add this progrm to my database and if that is the case how do i add this to my database and i am on linux umbutu if that changes anything
any help would be appereciated it also will not start my server with this it does not pop up on the list of serversMost likely your mysql_connection_string
convar in your server.cfg
is incorrect (if it could not connect, it would tell you). What does your connection string look like?
i do not have that in my server.cfg where should it be
yea… don’t put tilts around the connection string… Why do you think you need those?
Not to mention that password is probably different than yours. I would read up about setting Convars in the FiveM’s server.cfg
and how to setup a user and database in MySQL
ok and is it the password for the computer or for the dabase
Obviously the password for whatever user you are using to connect to MySQL server/database.
Again, it’s probably best for you to read up about MySQL users, how to create one for a specific database and give it a password. Use those credentials in your mysql_connection_string
convar to connect
But running root/root is so much easier! /s
I think in addition to reading about convars, everyone needs to understand the gist of MySQL and databases in general. Running a FiveM server isn’t all just drag and drop, there is a good bit of understanding required.
Someone wanna help me out here, my logs are spammed with this and the server is lagging every time this happens, and it usually happens between every minute to five minutes. https://pastebin.com/nNg91aRR
I only use the standard ESX and extended that’s it and it’s requirements ofc, I understand ESX isn’t really within this topic but it seems to be an issues with the plugin itself. Not sure.
Hello,
How could I use the “last_insert_id” with this? For example:
MySQL.Async.execute(
'INSERT INTO characters(code...)',
{ })
How could I get the auto increment value on this? If it makes a difference, the field name is “cid”
Thanks in advance… Couldn’t find this information anywhere.
By using .insert
; instead of .execute
, it returns that automatically. In case you didn’t figure by now.
Thankfully I figured this out but thanks anyways !
Is it possible to use DB Browser for SQLite to view / write to the sql.sql
database?
When opening the file with DB Browser, I’m met with an SQLCipher encryption menu asking me to enter a password which I never set (yes I tried password, PASSWORD, and the password I used to make the MySQL admin account when installing MySQL).
If no, is there any other simple database viewer that is compatible? Thanks.
Hey i got this error
`Error resuming coroutine: citizen:/scripting/lua/scheduler.lua:655: No such export mysql_sync_fetch_all in resource mysql-async
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:655: in metamethod ‘__index’
@mysql-async/lib/MySQL.lua:56: in field ‘fetchAll’
server/main.lua:24: in function ‘LoadShop’
server/main.lua:18: in function <server/main.lua:14>