Linden
860af3ff14
refactor(transaction): parse arguments prior to establishing connection
...
Rather then acquiring a connection, throwing an error, then closing the connection.
2021-12-23 13:51:20 +11:00
Linden
0afb32858d
refactor(utils): rename parser and add additional functions
...
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.
2021-12-23 13:47:25 +11:00
Linden
f5e25e3574
refactor(config): moved typeCast function into config
2021-12-23 13:42:12 +11:00
Linden
35f198f2b5
refactor(pool): cleanup connection options and createPool defaults
...
Additionally perform initial database connection as part of this module, rather than index.
2021-12-23 13:40:54 +11:00
Linden
4e29905179
fix(execute): check resourcestate is 'started' to resolve promise
2021-12-10 10:55:27 +00:00
Linden
193da3e6c7
refactor(execute): execute queries after first tick
...
Force queries to wait until the server has ticked before sending anything.
2021-12-10 11:18:15 +11:00
Linden
cd2e73953f
test: re-enable slow query warnings
2021-12-10 11:17:02 +11:00
Linden
3928415930
test: revert recent changes
...
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.
2021-12-08 07:43:25 +11:00
Linden
45b90c4ad3
fix: performance tweaks
...
Moved getConnection and ScheduleResourceTick above the try block.
Moved connection.release into the finally block
Increased default connection timeout to 1 minute.
2021-12-06 17:55:50 +11:00
Linden
87a5123117
fix: JS sync exports check
...
Since JS is such a bad language it throws an error when doing `variable !== undefined`, so wrap the whole thing in a try block and catch the error.
2021-12-04 03:22:53 +11:00
Linden
94fe76340e
fix: undefined values
...
Various mistakes from 1.8.1
2021-12-02 19:32:38 +11:00
Linden
b7763141b7
fix(transactions): resolve error when executing transaction
2021-12-02 08:19:22 +11:00
Linden
a352273b08
refactor(execute): await connection to send query
...
Waiting for the connection to become available lets us move executiontime back into the resource.
2021-12-01 03:42:44 +11:00
Linden
e685ff5f4c
refactor: minor cleanup and formatting
2021-12-01 02:52:48 +11:00
Linden
dbe107e669
refactor: enable JS exports for more recent artifacts
...
We still don't have a bump in recommended artifact, so for now check for the existence of new(ish) native.
2021-12-01 02:51:05 +11:00
Linden
f3fc016f31
refactor(pool): new createConnection function
...
Remove the connection string parsing and send the URI directly, if it exists. For semicolon connection strings, check for and replace aliases.
2021-11-25 20:29:02 +11:00
Linden
b004ec943d
refactor(pool): permit extra user and password aliases
2021-11-15 09:09:52 +11:00
Linden
9fc06c2132
refactor(versioncheck): remove module and perform check with Lua
...
Unnecessary dependency with functionality that can be easily handled via PerformHttpRequest.
Since the check references fxmanifest instead, we will no longer maintain the version in package.json.
2021-10-29 08:14:39 +11:00
Dunak
8a3fa20408
fix(pool): Remove default database value from config
2021-10-25 10:55:42 +02:00
Dunak
5d6ca06f49
fix(parser): Check if query is string type not undefined
...
- Should fix issues when exports is wrong called with `.` instead of `:`
2021-10-24 14:56:38 +02:00
Linden
ca8cef4e26
refactor(prepare): Rename prepared export to prepare
2021-10-24 02:13:55 +11:00
Linden
2a8f4b1ea9
feat: Add an export to call prepared statements ( #54 )
...
* feat: Add an export to call prepared queries
- Utilises pool.execute (rather than query) to actually prepare parameters through mysql.
This is intended for appropriately built queries utilising placeholders and parameters, and should only be used on frequently repeated queries.
* refactor(prepare): Clean up results and add total execution time
* feat(prepare): Send scalar response for a single value
* fix(prepare): Check if result exists before getting keys
2021-10-23 09:05:01 +11:00
Linden
ec9d787be4
fix: Resolve null length on some queries
...
- Ensure parameters when checking length, and update dependencies for mysql2 patch
2021-10-19 04:26:08 +11:00
Linden
9d8a29388c
fix(parser): Only assign null values if placeholders were found
2021-10-18 01:52:22 +11:00
darksaid98
dc50fe6dbb
style: rename paramName variable
2021-10-16 19:11:09 +02:00
darksaid98
a6d483ca48
fix: nil parameters with named placeholders
...
- Fixes the remaining edge-case bug with passing nil parameters
2021-10-16 19:05:57 +02:00
Linden
fe1d6e6b05
fix(config): Reset colour after version check message
2021-10-16 10:46:29 +11:00
Linden
ce87bc488c
fix(parser): Allow queries with multiple placeholders and no parameters
...
- '...?, ?, ?', {nil, nil, nil} will set all placeholders to null
2021-10-16 10:20:35 +11:00
Linden
dc55401b78
fix: Return boolean for TINYINT
2021-10-16 10:20:35 +11:00
Linden
3b55e890a8
fix: Display correct query execution time
2021-10-16 10:20:35 +11:00
Linden
4646c6f027
fix: Assign object entries to array
...
Assigning the entries to an array first permits comparing the lengths and setting undefined entries as null
2021-10-16 10:20:35 +11:00
Linden
30a391031b
fix: Resolve error when parameter length does not match
...
- Throws a more specific error when receiving mismatch for column and value counts
- Resolves error when final parameter is nil
2021-10-16 10:20:35 +11:00
Linden
d0730c5e9b
feat: Add support for nil parameters
...
- Throws an error if no params are defined when using named parameters, otherwise seems okay
2021-10-16 10:20:35 +11:00
Linden
1266f4a7b6
chore: Update dependencies and version bump
2021-10-08 11:17:50 +11:00
Linden
1ec52903ca
feat: Add support for semicolon connection strings
2021-10-07 06:26:07 +11:00
Linden
681b39692a
fix(pool): Increase default connection timeout
...
- Servers taking a while to start may experience a timeout; this should alleviate the issue
2021-09-27 10:13:11 +10:00
darksaid98
634bbffd46
feat: version check on startup ( #28 )
2021-09-23 20:55:08 +02:00
gixels
b8249d5457
Implemented the ability to change the port.
2021-09-22 12:12:50 -04:00
dunak-debug
372a95632c
refactor: Transaction tweaks and version bump 1.4.0
2021-09-20 17:32:58 +02:00
darksaid98
faae020dd4
feat: Added transactions support ( #20 )
...
* feat: transactions
* Adds transactions function
* Adds query & param parser with ghmattimysql compatability
* feat: transaction exports
* Adds exports for using transactions
* feat: set transaction isolation level on start
* feat: accept mysql-async syntax
* fix: acquire connection from pool
* refactor: syntactic sugar in transaction.js
* feat: optional error logging
* It ain't pretty but it gets the job done.
* Revert "feat: optional error logging"
This reverts commit fdff479f34b7575c240334cff0f4f12d03e0d48f.
* feat: transaction isolation level convar
* fix: requested changes
2021-09-20 16:48:24 +02:00
dunak-debug
51ac8d1e8c
refactor: Use logical OR operator when checking callback parameter
2021-09-20 13:39:46 +02:00
dunak-debug
466f230dc4
fix: Allow passing callback as second parameter
2021-09-20 13:36:07 +02:00
dunak-debug
06b106151f
fix: Return null if query failed, show callback warning only in debug
2021-09-20 13:35:43 +02:00
Linden
c5f150e003
improvement: Only display warnings if callback is defined
...
- Non-function callbacks will display a warning.
- This makes the third argument optional for async queries.
2021-09-19 04:25:42 +10:00
dunak-debug
3f57c566df
feat: Show error trace if debug is enabled
2021-09-18 12:45:15 +02:00
Linden
5e6547611b
refactor: safeCallback provides a warning, rather than an error
...
- The query does in fact proceed, but does not send a result
2021-09-18 11:08:21 +10:00
Linden
be221b70d3
feat: Enable JS sync exports if wrapper.lua is not loaded
2021-09-18 10:28:40 +10:00
Linden
f7dea332de
improvement: Provide information when callback fails
2021-09-18 10:27:16 +10:00
Linden
d2758de972
tweak: Query execution times are less precise unless using debug mode
2021-09-18 10:24:06 +10:00
dunak-debug
c9acb09d08
refactor: Execute now return whole result object
2021-09-17 22:19:49 +02:00