Commit Graph
48 Commits
Author SHA1 Message Date
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
dunak-debug 73ad12ed02 refactor: Show error type of nil params 2021-09-17 22:19:26 +02:00
dunak-debug 4654460e22 fix: Don´t throw error if parameter is zero or false, check for undefined 2021-09-17 20:01:47 +02:00
dunak-debug e23ba224aa fix: Execute export result checking 2021-09-17 18:09:11 +02:00
dunak-debug 878a2eb6c0 fix: **Use query instead of execute always**
- mysql2 typeCast doesn´t work on prepared statements
2021-09-17 18:06:03 +02:00
dunak-debug 290e23c190 refactor: Split files into src folder, fix parser 2021-09-17 17:20:17 +02:00
dunak-debug 8df05c748b refactor: remove typescript and refactor 2021-08-17 02:58:31 +02:00
dunak-debug d2a9a433bb fix(callback): use process._tickCallback() fix (process.nextTick())
- this fixes whole issue with slow queries
- https://github.com/alcoholiclobster/fivem-mongodb/blob/400ac6615a334d43531a7a1824f2e8b540246fe2/index.js#L105
- setImmediate will just make performance worse
- now it also works in coroutine if yielded
- also i´m not sure why tickCallback helps, if somebody know i would be glad to know :D
- process.nextTick() is issue maybe, it works only for natives and not node functions
- process.nextTick isn't firing until the socket timeout callback fires
- discord conversation about it https://discord.com/channels/192358910387159041/433008322732490778/479523175869317130
2021-08-16 21:42:18 +02:00
dunak-debug f4dc666a98 Revert "fix(callback): forgot to wrap setImmediate on execute export"
This reverts commit ea98463224.
2021-08-16 21:36:04 +02:00
dunak-debug baa91dab4e Revert "fix(callback): use setImmediate to callback on main thread"
This reverts commit e9a18b5a46.
2021-08-16 21:35:55 +02:00
dunak-debug ea98463224 fix(callback): forgot to wrap setImmediate on execute export 2021-08-16 20:09:37 +02:00
dunak-debug e9a18b5a46 fix(callback): use setImmediate to callback on main thread
- maybe fix of random query times inside coroutines
2021-08-16 19:43:47 +02:00
dunak-debug c242e03baf feat(mysql): setup insert, single, scalar exports
- renamed test.lua to wrapper.lua
- use local function for documentation (maybe?)
- setup sync wrappers
2021-08-16 15:29:00 +02:00
dunak-debug b2ade77589 feat(mysql): setup execute export
- also setup test.lua for testing
2021-08-16 00:12:28 +02:00
dunak-debug 7afd440931 fix(webpack): fixed resolving .js extension when building
- also removed eslint
2021-08-15 16:48:29 +02:00
dunak-debug 1f675b44c4 Setup node package 2021-08-15 16:13:48 +02:00