Include some js samples

This commit is contained in:
Linden committed 2021-09-19 07:35:49 +10:00
1 parent 7ac73ccdb4
commit 93754a8efc
6 files changed
+60 -26

No files matched your search

+10 -4
View File
@@ -1,14 +1,20 @@
# Insert
Execute a query and returns the AUTO_INCREMENT id, if it is defined.
Execute a query and returns the AUTO_INCREMENT id, if valid.
### Usage
```lua
exports.oxmysql:insert(query, {}, function(insertId)
print('Inserted new row with id '..insertId)
end)
print('I will be printed before query result')
```
```lua
local insertId = exports.oxmysql:insertSync(query, {})
print('Inserted new row with id '..insertId)
```
```js
exports.oxmysql.insert(query, {}, (insertId) => {
console.log(`Inserted new row with id ${insertId}`)
})
const insertId = await exports.oxmysql.insertSync(query, {})
console.log(`Inserted new row with id ${insertId}`)
```