mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 06:28:54 +00:00
update functions for 1.9.0, finally write prepare and common issues
This commit is contained in:
1 parent
c07dfc085c
commit
40dee21923
10 files changed
+227
-154
No files matched your search
@@ -1,51 +0,0 @@
|
||||
---
|
||||
title: Execute
|
||||
---
|
||||
Generic function that can be utilised for any query, synonymous with fetch.
|
||||
When selecting data it will return all matching rows and columns, otherwise it will return field data such as insertid, affectedRows, etc.
|
||||
|
||||
!!! info "Example"
|
||||
=== "Lua"
|
||||
**Async**
|
||||
```lua
|
||||
exports.oxmysql:execute('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
|
||||
if result then
|
||||
for _, v in pairs(result) do
|
||||
print(v.identifier, v.firstname, v.lastname)
|
||||
end
|
||||
end
|
||||
end)
|
||||
```
|
||||
**Sync**
|
||||
```lua
|
||||
CreateThread(function()
|
||||
local result = exports.oxmysql:executeSync('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
if result then
|
||||
for _, v in pairs(result) do
|
||||
print(v.identifier, v.firstname, v.lastname)
|
||||
end
|
||||
end
|
||||
end)
|
||||
```
|
||||
=== "JavaScript"
|
||||
**Async**
|
||||
```js
|
||||
exports.oxmysql.execute('SELECT * FROM users WHERE identifier = ?', [playerIdentifier], function(result) {
|
||||
if (result) {
|
||||
result.forEach((v) => {
|
||||
console.log(v.identifier, v.firstname, v.lastname)
|
||||
})
|
||||
}
|
||||
})
|
||||
```
|
||||
**Sync**
|
||||
```js
|
||||
setImmediate(async () => {
|
||||
const result = await exports.oxmysql.executeSync('SELECT * FROM users WHERE identifier = ?', [playerIdentifier]) {
|
||||
if (result) {
|
||||
result.forEach((v) => {
|
||||
console.log(v.identifier, v.firstname, v.lastname)
|
||||
})
|
||||
}
|
||||
})
|
||||
```
|
||||
Reference in new issue
Block a user