-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v1.9.0 - lib/MySQL and export deprecation #77
Comments
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
Upon request I've added aliases for functions in lib/MySQL. You can use either, and some exports are no longer being deprecated to support this syntax (if you want to continue utilising exports directly, though it's not recommended).
|
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
Just double checking, reading that I can call |
Yes, they call the same export. |
Yes as Linden said. MySQL.query is syntax provided by us and MySQL.Async.fetchAll is alias for mysql-async compatibility |
Hello, Store is not supported on this version? |
exports.oxmysql:fetchSync I can't find what I should replace this with. |
Hello, I have the latest QBCore running, and trying to convert the older exports:oxmysql to MySQL But its just not working, we just get the same error stating attempt to index a nil value (global 'MySQL') |
exports.oxmysql:fetch updated with new exports.oxmysql:execute old exports.oxmysql:execute changed with exports.oxmysql:query Link of oxmysql new exports overextended/oxmysql#77 (comment)
@SmithyPD Did you add dependency 'oxmysql'
server_script "@oxmysql/lib/MySQL.lua" |
I have several old resources that are built around mysql-async and ghmattimysql. Can I just update the fxmanifest.lua of these resources without altering any of the scripts or will that break functionality? I do understand that changing the code will increase performance of the queries, but I'd rather get around to that at a later time. |
hi, where can i find version 2.0.0 of oxmysql? because ox inventory gives me this error: ox_inventory requires version '2.0.0' of 'oxmysql' (current version: 1.9.2). thank you |
Though this was going to be part of v2.0.0 I want to get some changes to the resource out ASAP to improve functionality, performance, etc.
This update serves as a good transition period for people to begin swapping calls to
exports.oxmysql
and use the syntax provided by@oxmysql/lib/MySQL.lua
. I'll be working on documentation changes soon, but you can reference this issue for converting your queries. If you absolutely don't want to use the lib (it's recommended at this point) you can use the new_async
exports, but you'll get better performance otherwise.You can utilise either mysql-async syntax with complete backwards compatibility, or use the more accurate oxmysql syntax, i.e.
Summary
sync
suffix were renamed to_async
Javascript
Obviously the Lua library isn't an option for you; I've considered making a node_module so you can do
MySQL.fetchScalar, MySQL.execute
etc. for the slightly easier syntax and benefit of annotations, but don't expect anything.For now you can continue using exports, though you might want to replace all and change
executeSync
toexecute_async
or whatever else.Functions and counterparts
The exports used for ghmattimysql and previous versions of oxmysql. The header is the correct syntax to use with lib/MySQL.
MySQL.update / MySQL.Async.execute
Returns the number of affected rows
MySQL.update.await / MySQL.Sync.execute
Returns the number of affected rows
MySQL.query / MySQL.Async.fetchAll
Returns an array of matching rows or result data
MySQL.query.await / MySQL.Sync.fetchAll
Returns an array of matching rows or result data
MySQL.scalar / MySQL.Async.fetchScalar
Returns the value of the first column in a single row
MySQL.scalar.await / MySQL.Sync.fetchScalar
Returns the value of the first column in a single row
MySQL.insert / MySQL.Async.insert
Returns the row id of the inserted value
MySQL.insert.await / MySQL.Sync.insert
Returns the row id of the inserted value
MySQL.transaction / MySQL.Async.transaction
Returns true if the transaction succeeds
MySQL.transaction.await / MySQL.Sync.transaction
Returns true if the transaction succeeds
OxMySQL only
These functions have no counterparts in mysql-async and ghmattimysql.
MySQL.single / MySQL.Async.fetchSingle
Returns the value of a single row
MySQL.single.await / MySQL.Sync.fetchSingle
Returns the value of a single row
MySQL.prepare / MySQL.Async.prepare
The return type will differ based on the query submitted.
Parameters can be a single table containing placeholders (perform one query) or contain multiple tables with a set of placeholders.
MySQL.prepare.await / MySQL.Sync.prepare
The return type will differ based on the query submitted.
Parameters can be a single table containing placeholders (perform one query) or contain multiple tables with a set of placeholders.
Replace all
Use VSCode, Nodepad++ or whatever you use to edit and utilise
Replace All
within your resource directory.See comment below for a list of function aliases.
The text was updated successfully, but these errors were encountered: