Add boolean to disable throwing error for query.
Reject promises when using _async exports.
Return errors as strings instead of Error (fails to serialise).
Fixes#122
Several reports of increased chances to hit a deadlock since v2.2.2, and
three reports of a timeout during prepare since v2.2.4.
Simpler to revert to the old prepare function and api (with improvements)
than to work out the solution.
Look into rewriting prepare in the future or including the mariadb connector,
which doesn't suffer from the same perf issues.
Fixes several regressions and issues from ef0dfaa.
Sending a single parameter would set 'single' to true, ignoring multiple
results from the database and returning 'null'.
SELECT should not trigger transactions, not the other way around.
Results should not be parsed when no callback is defined.
BLOB's with a value of null cannot be iterated, resulting in an
error while trying to return [...field.buffer()].
Minor change to weird typecasting on date values.
When sending bulk-statements using prepare, the execution time
would always be calculated based on the start of the first query.
This would mistakenly report successive queries as taking longer,
and possibly report slow queries (i.e. when saving all players).
Parse each value while iterating prepared statements, ensuring
objects are remapped to arrays and NULL values are properly
inserted.
Utilise transactions to rollback changes in the event of an error.
Lua tables are msgpacked with the 'without_hole' setting, resulting
in an object. rawQuery already handles this and converts an object
into an array (filling null where appropriate).
Give rawExecute the same treatment.
This reverts commit 7582973e4e.
Calling coroutine.yield causes issues with the Lua scrt's scheduling. Notably, calling Citizen.Wait will result in the thread never being resumed.
Other resources with script errors (notably "attempt to index a nil value") would mistakenly report the query as failed, and people would assume ANY reported errors were because of oxmysql, even through it was their own awful script.
No errors should be thrown in oxmysql when an error occurs in a function reference.
When using callback functions and throwing an error (i.e. attempt to index a nil value), it would respond about an error in a nested ref call.
Don't catch callback errors.
Since lib/MySQL is loaded into a resource as a module, it would technically require any resources linking to oxmysql to be licensed under GPLv3.
LGPL exists to provide this exception when dynamically linking modules.
i.e.
MySQL.Async.fetchAll = MySQL.query
MySQL.Sync.fetchAll = MySQL.query.await
MySQL.Async.fetchScalar = MySQL.scalar
MySQL.Sync.fetchScalar = MySQL.scalar.await
More information in issue #77
Exports now utilise more accurate names to reflect their behaviour, with less confusion for JS users (await executeSync is no more).
Exports return promises or callback results directly to reduce promise chaining.
Promise exports now fully utilise JS, with Lua being removed from the resource - version checking runs through JS instead.
Various improvements to lib/MySQL as well as introduction of a prepare wrapper.
query refers to the old execute function.
preparedStatement renamed to execute.
Parse arguments before establishing connection.
Utilise response function to determine and return correct values to the export.
execute now accepts an array of values when performing a single query, rather than requiring an array within an array.
Create a handler for ScheduleResourceTick.
Handle serverReady function and isReady state.
Rewrite parameter parser to wrap all export arguments, ensure parameter and callbacks, and improve placeholder resolution.
Setup a response function to handle export return values.
mysql2 calls some code, namely _resolveNamedPlaceholders, that is handled by oxmysql before the query is executed.
Other changes:
Calculate query execution time as part of the Query command.
Check for undefined parameters during placeholder resolution.
People are experiencing errors that I've been unable to reproduce, but 1.8.3 apparently works fine.
Revert changes that were made.
This disables slow query warnings for now.
Moved getConnection and ScheduleResourceTick above the try block.
Moved connection.release into the finally block
Increased default connection timeout to 1 minute.