Commit Graph
132 Commits
Author SHA1 Message Date
Linden 5d69db51da refactor(database): new URI parser 2022-04-30 04:13:31 +10:00
Linden c07fa4a451 refactor(transaction): support new transaction syntax
Adds a third accepted syntax for transactions, distinct from the mysql-async
compatible implementations.
2022-04-21 13:25:40 +10:00
Linden da83eff989 revert(execute): transaction api
Somebody, somewhere, will experience compatibility issues with any
change made to oxmysql.
2022-04-21 12:07:47 +10:00
Linden 23bcf90885 refactor(update): add convar for mysql_versioncheck
For those who don't like to be reminded of updates.
Also don't report errors during fetch, since it doesn't matter to users.
2022-04-03 06:14:21 +11:00
Linden 050eef58b9 fix(execute): revert to promise api
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.
2022-04-03 06:10:13 +11:00
Linden fa1cdcc668 fix(execute): incorrect response parsing
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.
2022-04-03 03:52:07 +11:00
Linden 9ef9b0d8c9 fix(utils/typeCast): typeerror
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.
2022-04-02 19:52:58 +11:00
Linden c9e402ccdc fix(query): less verbose errors 2022-04-02 01:37:56 +11:00
Linden defe3afb75 refactor(index): redundant code 2022-03-30 05:55:48 +11:00
Linden ef0dfaac84 refactor(execute): remove mysql2 promise api
Changing from promises to callbacks gives ~20% increased performance.
Single prepared statements won't use transactions (no extra overhead).
2022-03-30 05:54:54 +11:00
Linden 7b01898959 refactor(transaction): individual transaction logging
I should bother patching mysql2 types, but idc
2022-03-27 08:55:20 +11:00
Linden 6c8934f906 perf(execute): ignore results if cb is undefined
Do not parse results when a callback argument was not received.
Minor improvements to response parsing.
2022-03-27 08:37:11 +11:00
Linden f82fa72643 fix(execute): incorrect execution time for multiple queries
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).
2022-03-27 08:32:39 +11:00
Linden 9fec9cccba refactor(execute): don't use transactions for SELECT statements 2022-03-27 07:11:00 +11:00
Linden d34bbc45f5 fix(execute): properly await all query responses 2022-03-26 00:58:27 +11:00
Linden 3582e72122 refactor(execute): use transactions and parse values
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.
2022-03-25 19:00:29 +11:00
Linden dea98f7c5b refactor(database): move from mysql2/promise to callback api
Micro-optimisation for rawQuery. rawExecute and rawTransaction will
still utilise the promise api (pool.promise()).
2022-03-25 06:07:57 +00:00
Linden dd05cb8e68 refactor(database): response is always a callback now 2022-03-25 05:38:18 +00:00
Linden 901e6c0baa refactor(index): simpler creation of async exports 2022-03-25 05:32:11 +00:00
Linden 86d85dfa00 fix(execute): handle nil parameters in prepared statements
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.
2022-03-25 04:41:39 +00:00
Cuchi 4417b728fa feat(logger/command): Warning message when mysql command is run from server (#97) 2022-03-18 17:25:03 +01:00
Linden afc04fc553 fix(db): move query responses to their own try block
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.
2022-03-07 15:13:07 +11:00
Linden 4bbbe1efc2 refactor(index): cease resistance against 0 iq fivem community
Why did I think maintaining this type of resource would be a good idea?
2022-03-03 19:51:00 +11:00
Linden cd62fdd904 refactor(utils/parseArguments): Reduce redundant assignments
More in-line with 1.9.3 parser; reduced garbage and improved performance. Should handle JSON better.
2022-03-02 23:24:52 +11:00
Linden 895d08ef0f fix(db): Define pool type 2022-03-02 22:56:47 +11:00
Linden e0a2a41870 fix(db/rawTransaction): Await scheduleTick 2022-03-02 22:56:07 +11:00
Linden 9e50d8ddd0 fix(utils/parseArguments): Missing type check 2022-02-28 16:01:08 +11:00
Linden 6d96c1104b refactor(db): Delay connection until first tick 2022-02-28 16:00:30 +11:00
Linden 31d971837d fix(update): Catch errors when fetching GitHub API 2022-02-25 17:23:46 +11:00
Linden ec53b3282d refactor(utils/scheduleTick): Await database connection 2022-02-25 17:11:28 +11:00
Linden 2d28c447ec fix(db/rawExecute): Parse multiple returned rows 2022-02-24 10:59:12 +11:00
Linden e29ca87c98 fix(utils): Do not convert placeholders if query contains JSON 2022-02-24 10:24:27 +11:00
Jaime Filho 8611cc0762 fix: Add charset to cast binary and json data correctly 2022-02-18 19:12:46 -03:00
Linden afbfb21a3d fix(src/update): Remove .zip from release url 2022-02-15 14:56:16 +11:00
Linden 86e51e79ef refactor(update): Use GitHub releases API
Compare current version to latest release.
2022-02-14 22:25:59 +11:00
Linden 2ea78f1b1b Merge branch 'refactor' into main 2022-02-14 22:23:28 +11:00
Luke 21fab4167b Revert "fix(logger): Require command ace permission to open ui"
This reverts commit 9369873481.
2022-02-13 19:26:57 +01:00
Luke 9369873481 fix(logger): Require command ace permission to open ui 2022-02-11 13:03:53 +01:00
Linden 3cfa080cfc fix(utils/typeCast): Ensure field.packet is defined
Apparently this can be undefined.
2022-02-11 05:15:29 +11:00
Linden 7096237ce2 refactor(utils/typeCast): Change BIT and BLOB types
BIT fields should only cast as boolean if they have a length of 1.
2022-02-10 17:23:42 +11:00
Linden 4975a17a31 fix(db/execute): Parse responses during prepare
Prepare should return the most appropriate result type (scalar, single, query, update, etc.)
2022-02-10 16:57:28 +11:00
Luke 553775c9a0 feat(nui): Display the amount of slow queries 2022-02-02 13:55:30 +01:00
Luke b0ea8e1172 feat(nui): Display slow queries with yellow text color 2022-01-27 17:23:45 +01:00
Luke 31fb361c4c feat(nui): Fetch chart data from resources 2022-01-27 12:47:13 +01:00
dunak-debug 2200b0b0f5 chore: Remove logger mock data 2022-01-23 13:22:17 +01:00
erik.balog 38e30c6640 fix: Scalar return value 2022-01-23 13:10:34 +01:00
dunak-debug f89f232b1c feat(ui): Render spinner until data fetched 2022-01-08 14:40:13 +01:00
dunak-debug 3554ba2fc8 feat(ui): Implement sorting function (WIP) 2022-01-08 14:15:17 +01:00
dunak-debug 21ded71fde fix: Return correct scalar value 2022-01-07 23:41:11 +01:00
Luke 238d7cd589 fix(nui): Data fetching into manual pagination
Perhaps don't need the loading state...?
2022-01-04 22:04:13 +01:00