Closed indilo53 closed 7 years ago
Can i have an example of a table with the values and the query so i can repeat this myself ?
Yes of course : https://pastebin.com/42CF662C
The following works :
AddEventHandler('onMySQLReady', function ()
MySQL.Async.fetchAll('SELECT identifier FROM users', {}, function(users)
print(json.encode(users))
end)
end)
The following don't works
AddEventHandler('onMySQLReady', function ()
MySQL.Async.fetchAll('SELECT last_property FROM users', {}, function(users)
print(json.encode(users))
end)
end)
does this works ?:
AddEventHandler('onMySQLReady', function ()
MySQL.Async.fetchAll('SELECT last_property AS property FROM users', {}, function(users)
print(json.encode(users))
end)
end)
No this doesn't works, but anyway the intent here is to SELECT * FROM users
I have not tested the code but I may have spotted the bug :
for (int i=0; i < reader.FieldCount; i++) {
if (reader.IsDBNull(i)) {
line.Add(reader.GetName(i), null);
}
line.Add(reader.GetName(i), reader.GetValue(i));
}
Does it miss a else ? So it will be like this :
for (int i=0; i < reader.FieldCount; i++) {
if (reader.IsDBNull(i)) {
line.Add(reader.GetName(i), null);
} else {
line.Add(reader.GetName(i), reader.GetValue(i));
}
}
yes it must be this, we look at it tonight and do a new version of the DLL thanks
Np, thank you for the lib !
Hello, I have this error when I select fields containing NULL values (FXServer) :
Error invoking callback for event onMySqlQueryFetchAll: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException (System.ExceptionResource resource) [0x0000b] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 at System.Collections.Generic.DictionarymB (System.Data.Common.DbDataReader reader) [0x00000] in <770da12052ea4c79ad17ef8af7c55d61>:0
at MySqlAsync.QueryProcess.Call[TParam,TResult] (System.Boolean error, System.Func`2[T,TResult] transform) [0x00070] in <770da12052ea4c79ad17ef8af7c55d61>:0
at MySqlAsync.MySqlAsync.m 8 (System.Int32 key, System.Boolean error) [0x0000c] in <770da12052ea4c79ad17ef8af7c55d61>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000e7] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at CitizenFX.Core.EventHandlerEntry+d__5.MoveNext () [0x00133] in <008df89e273548edb4a43c48cb9c2e12>:0
2[TKey,TValue].Insert (TKey key, TValue value, System.Boolean add) [0x0007c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 at System.Collections.Generic.Dictionary
2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0 at MySqlAsync.MySqlAsync.ReaderToDictionary (System.Data.Common.DbDataReader reader) [0x00041] in <770da12052ea4c79ad17ef8af7c55d61>:0 at MySqlAsync.MySqlAsync.