mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 06:28:54 +00:00
feat(mysql): start moving docs
This commit is contained in:
1 parent
ee76abb4db
commit
7f636ad7e7
11 files changed
+566
-1
No files matched your search
@@ -0,0 +1,41 @@
|
||||
---
|
||||
title: insert
|
||||
---
|
||||
Inserts a new entry into the database and returns the insert id for the row, if valid.
|
||||
|
||||
:::tip Example
|
||||
Lua
|
||||
|
||||
**Callback**
|
||||
```lua
|
||||
-- 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.insert.await('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', {playerIdentifier,firstName, lastName})
|
||||
print(id)
|
||||
end)
|
||||
```
|
||||
=== JavaScript"
|
||||
**Callback**
|
||||
```js
|
||||
exports.oxmysql.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', [playerIdentifier,
|
||||
firstName, lastName], function(id) {
|
||||
console.log(id)
|
||||
})
|
||||
```
|
||||
**Promise**
|
||||
```js
|
||||
(async () => {
|
||||
const id = exports.oxmysql.insert_async('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ',
|
||||
[playerIdentifier, firstName, lastName]) {
|
||||
console.log(id)
|
||||
})()
|
||||
```
|
||||
Reference in new issue
Block a user