mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 14:38:50 +00:00
Updated docs for oxmysql
This commit is contained in:
1 parent
b174c89d66
commit
81223ffd47
6 files changed
+60
-19
No files matched your search
@@ -2,4 +2,28 @@
|
||||
title: Usage
|
||||
---
|
||||
|
||||
todo - include some information about proper formatting, placeholders, bad practices, etc.
|
||||
```lua
|
||||
-- Lua
|
||||
MySQL.query('SELECT * from users WHERE identifier = ?', {identifier}, function(result)
|
||||
-- callback response
|
||||
-- same as MySQL.Async.fetchAll
|
||||
end)
|
||||
CreateThread(function()
|
||||
local result = MySQL.query.await('SELECT * from users WHERE identifier = ?', {identifier})
|
||||
-- await a promise to resolve
|
||||
-- same as MySQL.Sync.fetchAll
|
||||
end)
|
||||
```
|
||||
|
||||
```js
|
||||
// JS
|
||||
exports.oxmysql.query('SELECT * from users WHERE identifier = ?', [identifier], (result) => {
|
||||
// callback response
|
||||
})(async () => {
|
||||
const result = await exports.oxmysql.query_async('SELECT * from users WHERE identifier = ?', [identifier]);
|
||||
// await a promise to resolve
|
||||
})();
|
||||
exports.oxmysql.query_async('SELECT * from users WHERE identifier = ?', [identifier]).then((result) => {
|
||||
// utilise .then to resolve a promise like a callback
|
||||
});
|
||||
```
|
||||
Reference in new issue
Block a user