mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-01 22:21:51 +00:00
update syntax and include aliases
This commit is contained in:
1 parent
6cf83ac4d1
commit
e6da9843ea
8 files changed
+73
-24
No files matched your search
+11
-3
@@ -5,24 +5,32 @@ Inserts a new entry into the database and returns the insert id for the row, if
|
||||
|
||||
!!! info "Example"
|
||||
=== "Lua"
|
||||
|
||||
**Callback**
|
||||
```lua
|
||||
MySQL.Async.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', {playerIdentifier, firstName, lastName}, function(id)
|
||||
-- Alias: exports.oxmysql:insert
|
||||
-- Alias: MySQL.Async.insert
|
||||
|
||||
MySQL.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', {playerIdentifier, firstName, lastName}, function(id)
|
||||
print(id)
|
||||
end)
|
||||
```
|
||||
**Promise**
|
||||
```lua
|
||||
-- Alias: exports.oxmysql:insert_async
|
||||
-- Alias: MySQL.Sync.insert
|
||||
|
||||
CreateThread(function()
|
||||
local id = MySQL.Sync.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', {playerIdentifier, firstName, lastName})
|
||||
local id = MySQL.insert.await('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', {playerIdentifier, firstName, lastName})
|
||||
print(id)
|
||||
end)
|
||||
```
|
||||
|
||||
=== "JavaScript"
|
||||
|
||||
**Callback**
|
||||
```js
|
||||
exports.oxmysql.insert_callback('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', [playerIdentifier, firstName, lastName], function(id) {
|
||||
exports.oxmysql.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', [playerIdentifier, firstName, lastName], function(id) {
|
||||
console.log(id)
|
||||
})
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user