Linden
691ee508d1
feat(utils/validateResultSet): add warning for oversized result sets
...
This behaviour is generally undesirable and may lead to
excessive memory use or crashes.
2024-03-19 13:07:04 +11:00
Linden
d17559ba39
refactor(db/startTransaction): include query and values in errors
2024-03-06 13:59:23 +11:00
Linden
20083c6831
refactor(db/startTransaction): add 30s timeout to transactions
2024-03-06 13:54:15 +11:00
Linden
6a014b51e2
refactor(db/startTransaction): remove execute from cb
2024-03-05 01:05:32 +11:00
Linden
46a7dabc1e
fix(db): incorrect error handling when no callback is defined
...
Partly reverts some changes made for the experimental
transaction export.
2024-03-05 00:47:46 +11:00
Linden
c32d7af4d9
ci(release): set repo ref to main
2024-03-01 09:19:52 +11:00
Linden
8a3b8465f2
ci(release): push updates to repo
2024-03-01 09:12:27 +11:00
Linden
0f5c044050
fix(logger): potential error on error handling
2024-03-01 09:07:32 +11:00
Linden
0ede55d66c
Create FUNDING.yml
2024-02-11 16:11:44 +11:00
Linden
123a003332
refactor(db/startTransaction): use internal query functions
...
Some changes to function signature and callback.
Make null-returns commit changes rather than rollback.
2024-02-09 18:06:44 +11:00
Linden
a876f92ead
refactor(db/connection): set and get active connections
2024-02-09 18:04:16 +11:00
Linden
572c6ede88
feat(db): experimental transaction export
...
Don't use this if you don't understand it.
2024-02-09 13:14:57 +11:00
Linden
43e0df4a5b
fix(logger): strip lua scheduler errors
2024-02-09 13:14:19 +11:00
Linden
a020693a9f
ci(release): update checkout action
2024-02-02 17:11:29 +11:00
Linden
d5b5ae39be
ci(release): correct commit message
...
🤞 I'm bad at this.
2024-02-02 17:03:55 +11:00
Linden
e4e4145c8f
ci(release): update commit action
...
🤞
2024-02-02 17:01:31 +11:00
Linden
0a8b15a9b5
feat(logger): add logStorage size limit
...
Prevent excessive memory use when people use ui in production.
2024-02-02 16:50:07 +11:00
Linden
f05d375c14
refactor: update esbuild and build process
2024-02-02 16:34:57 +11:00
Linden
779ecca76f
feat: provide additional compatibility exports
2023-12-31 10:37:54 +11:00
Linden
e31d84019e
refactor(logger): non-debug query profiling
...
Use less precise query profiling (script based, rather than sql
server based). Re-enables slow query warning, and reduces
overhead when ui is enabled.
2023-12-27 23:52:47 +11:00
Linden
d0683b7f30
refactor(logger): handle error event in error logger
2023-12-27 13:44:05 +11:00
Linden
17841acc45
refactor(db): loop createConnectionPool until success
2023-11-28 12:01:55 +11:00
Linden
3fef918000
fix(db/connection): don't establish connection from getPoolConnection
...
Should prevent connection timeouts when queries are
called during server startup.
2023-11-28 12:01:55 +11:00
Linden
0f5f397814
refactor(db/connection): tweak waitForConnection logic
2023-11-28 12:01:55 +11:00
Linden
0398abc501
refactor(database): move pool and connection variables
...
Mostly reorganising module.
Added getPoolConnection helper.
2023-09-15 14:36:31 +10:00
Linden
b3f4a7aa6b
fix(ci): update lib path
2023-09-13 16:41:59 +10:00
Linden
1553b119fa
fix(ci): remove Lua definitions
2023-09-13 16:39:11 +10:00
Linden
32c9beb7d8
fix(utils/parseTransaction): parse arguments for query array
2023-09-13 15:40:18 +10:00
Linden
fedc40c109
refactor(lib): remove Lua type definitions
...
Part of a separate repo.
2023-09-06 13:32:36 +10:00
Linden
a065c1c545
fix(db/rawExecute): don't unpack responses for rawExecute
...
Oversight when implementing the rawExecute export. Technically breaking..
Return ResultSetHeader rather than just a number for affectedRows or insertId.
2023-09-06 13:29:04 +10:00
Linden
840d39493e
fix(lib/lua): show stacktrace when safeArgs throws error
2023-09-06 13:04:06 +10:00
Linden
86aaf157fa
fix: rename printError function
...
This apparently conflicts with and overrides a global used in cfx's JS runtime.
2023-09-06 12:31:22 +10:00
Linden
8daa2b7e63
fix(update): leftover console.log
2023-08-17 07:45:26 +10:00
Linden
958e18d07f
fix(database/rawTransaction): don't error on transaction failure
...
This was a compatibility-breaking change.
2023-08-08 18:14:34 +10:00
Linden
03e2a9dd8b
chore: update readme
2023-07-29 19:52:41 +10:00
Linden
f59ca17200
chore(lib): update types
2023-07-28 17:49:15 +10:00
Linden
924fd6a3cf
refactor: improve error handling
2023-07-28 17:21:13 +10:00
Linden
f3e9aa52d9
refactor(database): use setCallback
2023-07-28 06:09:35 +10:00
Linden
bcb703a11f
refactor(utils): setCallback
2023-07-28 06:09:08 +10:00
Linden
68f0dc526a
chore: upload .yarn.installed
...
yarn-be-gone. Until package.json updates at least.
2023-07-21 13:35:58 +10:00
Linden
e07947d3b9
refactor(logger): more consistent error output
2023-07-20 16:10:51 +10:00
Linden
77251b3739
refactor: type improvements
2023-07-20 16:10:08 +10:00
Linden
4870c56045
refactor(database): general code review/cleanup
2023-07-19 23:57:20 +10:00
Linden
fbc2542136
fix(utils/parseTransaction): properly handle arrays of queries
2023-07-19 20:16:23 +10:00
Linden
c2f0dca0c2
refactor(logger): output db version in debug/warning logs
2023-07-19 19:52:21 +10:00
Linden
11b7433398
refactor(database): output db version in connection message
2023-07-19 19:52:02 +10:00
Linden
f3401eb671
fix(config): export convertNamedPlaceholders
...
parseArguments relied on options.namedPlaceholders, which is now always false.
Function is now exported directly when enabled (+typed).
2023-07-19 14:29:21 +10:00
Linden
45aadf7442
refactor(logger): only enable profiling with debugging
...
Breaks slow query warnings, but most people just set the number higher
once they get warnings anyway.
Also fixes some issues:
- profile duration formatting and time (sec to ms).
- incorrect log query/param index.
2023-07-12 15:38:47 +10:00
Linden
bdbe86c0f7
fix(database): handle profiles for >100 statements in batch queries
...
Profiling is limited to the last 100 queries on a connection.
Clearing profiles after every 100th query should work well enough.
2023-07-12 13:18:55 +10:00
Linden
a8cdc5d1a1
refactor(logger): add profileBatchStatements
2023-07-12 13:16:08 +10:00
Linden
51c84a30ca
refactor(database/rawExecute): split batched query logs
2023-07-12 11:30:49 +10:00
Linden
e57a983bc0
refactor(database/rawTransaction): per-query profiling
2023-07-12 11:24:03 +10:00
Linden
c87885eb8a
refactor(web): increase query time precision
2023-07-12 01:11:39 +10:00
Linden
ade2b38bbf
fix(logger): check player ace when fetching resource data
2023-07-12 01:05:20 +10:00
Linden
1510489b63
refactor(update): improve version checking
2023-07-12 00:36:26 +10:00
Linden
d95ba8b5ce
fix(config): respect connection-string flags
2023-07-12 00:14:57 +10:00
Linden
37a3a7cd0a
fix(config): don't set connection info with falsey key
...
When using the semicolon connection string, a trailing semicolon
displays an error about an invalid configuration option.
2023-07-12 00:09:00 +10:00
Linden
b2387fc33a
refactor: minor tweaks and cleanup
...
Primarily moving connectionOptions fully to config.
Removed exported resource name.
Include error code and number when database connection fails.
2023-07-12 00:05:29 +10:00
Linden
197b92891a
refactor(database): query profiling
2023-07-11 18:40:03 +10:00
Linden
ef7f4156df
chore: update dependencies
...
mysql2 patch no longer includes types, profiling, or connection attributes.
2023-07-11 17:23:56 +10:00
Linden
fa0068e798
refactor(database): use mysql2/promise
...
Better code-flow.
Other minor changes to config.
Remove profiling (temp).
2023-07-11 16:33:01 +10:00
Linden
0caaec43e4
fix(utils/parseExecute): only set undefined parameters to null
...
Falsey values (e.g. empty string) should not be set as null.
2023-07-06 12:56:44 +10:00
Linden
8a340d60e3
refactor(utils/parseExecute): allow other methods through prepare calls
2023-07-06 12:52:14 +10:00
Linden
e1b0ff7299
fix(lib/lua): missing rawExecute.await
...
Resolves #185 .
2023-06-20 08:05:35 +10:00
Linden
9a990ca4bd
chore(lib): bump package version
2023-06-18 05:05:56 +10:00
Linden
1829ded03c
fix: don't throw errors outside of promises
2023-06-18 04:14:33 +10:00
Linden
c97a07a377
feat: isReady and awaitConnection exports
2023-06-13 02:42:54 +10:00
Linden
11b21f8ed2
refactor(db): rename serverReady variable
2023-06-13 02:23:33 +10:00
Linden
2ad0539107
refactor(lib/lua): reorganise and rewrite function factory
2023-06-13 02:18:19 +10:00
Linden
e8f1abcab7
feat(rawExecute): "prepare" alternative without unpacking
...
See #179 . Always return an array of row results (or null).
Parameters are now optional (though preferred).
2023-06-06 14:37:05 +10:00
Linden
fe9c684bf0
chore: readme
2023-05-18 18:46:23 +10:00
Linden
be8580396c
chore: patch mysql2
2023-03-07 15:44:14 +11:00
Linden
b772cd2bd2
chore: update dependencies
...
Include last changes for node package.
2023-03-07 02:13:49 +11:00
Linden
61d78dc893
chore(lib): typos
2023-01-28 16:30:35 +11:00
Linden
571691c2f5
Update README.md
2023-01-28 16:25:43 +11:00
Linden
e67557992e
chore: update dependencies & patches
...
Something will probably break.
2023-01-20 16:23:40 +11:00
Linden
5a949b9546
fix(database): throw Error before creating promise
...
Promises, even when resolved/rejected immediately after their creation, will
destroy any useful information from a stack trace when used over
events/exports.
Since some people still use the exports rather than MySQL/lib.lua, and for
some reason don't know the correct syntax for Lua exports (i.e. using
exports.oxmysql.query instead of the CORRECT exports.oxmysql:query) it's
comically common for an "untraceable" error to get spit out.
Will this help? No. Will everyone expect me to solve their issues? Yes.
Go update your scripts to use MySQL/lib.lua and we can all get along
stress-free.
2022-11-18 08:58:43 +11:00
Linden
4bff0109ca
fix(config): update mysql_debug when using oxmysql_debug command
...
Polling change isn't very compatible with this; will change in the future, but
for now keep it simple.
2022-11-08 18:06:52 +11:00
Linden
bc8a874743
refactor(database): waitForConnection
2022-11-08 17:29:05 +11:00
Linden
2a5e110e29
fix(database/rawExecute): append extra null values
2022-11-08 16:57:51 +11:00
Linden
283e3194cf
fix(utils/parseExecute): incorrect parameter reassignment
2022-11-08 16:57:02 +11:00
Linden
25f8feb793
fix(execute): handle nil values in nested arrays
...
Lua tables are msgpacked with the "without_hole" setting.
Nested tables being sent with "prepare" failed to account for
nil values in tables unpacking into objects.
2022-11-08 15:17:01 +11:00
Linden
b5190f98e9
refactor(src/config): poll convars
2022-11-07 16:58:56 +11:00
Linden
70a464fb83
fix(src/config): only parse JSON for valid connection fields
...
Should have set valid keys in the first place.
Resolves #147
2022-11-03 05:08:00 +11:00
Linden
c292cb44b0
refactor(lib/define): improve Lua types
2022-10-12 18:35:01 +11:00
Linden
b604a3c356
fix(src/config): parse JSON objects in connection string
...
Some connection properties take an object/array (i.e. ssl, flags).
2022-09-21 14:10:23 +10:00
Linden
8fe63bc88a
chore: update dependencies and patch
2022-09-21 13:57:55 +10:00
Linden
6b0e20aed3
chore: include .yarn.installed
...
Since the cfx yarn resource will forcibly try to run for resources even if
they don't want it or support it, I'll add this dumb file when using source code.
2022-08-24 20:22:45 +10:00
Linden
ff00cd0e82
fix(utils/parseArguments): check parameter truthiness
2022-08-24 18:41:05 +10:00
Linden
77f0d32e07
fix(update): correct semver comparison
2022-08-23 20:14:58 +10:00
Linden
f0dd9ce1a6
fix(utils): named placeholders check
...
Should always check parameters is an object (and not an array).
2022-08-13 17:12:48 +10:00
Linden
71c32f9d2f
tweak(utils): check if namedPlaceholders are enabled
...
Named placeholders were being converted regardless of config flag.
2022-08-13 16:23:47 +10:00
Linden
521aa8f03d
refactor: move connectionOptions to config
...
We'll also ensure namedPlaceholders is boolean and export the object.
2022-08-13 16:22:45 +10:00
Linden
7796c80f69
feat(config): add command to modify mysql_debug
...
Allow toggling debug prints for specific resources during runtime.
2022-08-12 19:47:30 +10:00
Linden
c92d1f3219
tweak(logger): mysql_debug array-check
...
If the convar output is an array, check if the query was invoked by
a resource in mysql_debug.
2022-08-12 18:56:22 +10:00
Linden
fca0b66fc8
tweak(config): accept a JSON array for mysql_debug
2022-08-12 18:54:32 +10:00
Linden
211d678b8d
chore(fxmanifest): update description
...
oxmysql has always worked with RedM, but habit leads to FiveM bias.
2022-08-09 03:03:57 +10:00
Linden
8ea5aad876
ci(release): version bumper
2022-07-28 14:54:38 +10:00
Linden
613570167c
feat: provide exports for ghmattimysql
...
Rather than people weirdly renaming the resource, just provide event
handlers for ghmattimysql exports.
2022-07-28 14:48:23 +10:00
Linden
1477812b38
refactor(lib/lua): improve definitions
...
Improve return types and support callbacks.
2022-07-12 14:23:39 +10:00