Updated docs for oxmysql

This commit is contained in:
userMacieG committed 2022-03-22 17:46:46 +01:00
1 parent b174c89d66
commit 81223ffd47
6 files changed
+60 -19

No files matched your search

+25 -1
View File
@@ -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
});
```