mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-03 06:28:53 +00:00
new docs
This commit is contained in:
1 parent
3cebaf7fa5
commit
b5eba8423f
229 files changed
+6238
-10690
No files matched your search
@@ -0,0 +1,18 @@
|
||||
Placeholders allow for query parameters to be safely executed, preventing [common SQL injection methods](https://bobby-tables.com/).
|
||||
|
||||
Parameters can be passed an an array or map (referred to as named named parameters).
|
||||
|
||||
```lua
|
||||
local identifier = 'license:abc123'
|
||||
local group = 'admin'
|
||||
|
||||
MySQL.scalar('SELECT `username` FROM `users` WHERE `identifier` = ? AND `group` = ?', { identifier, group })
|
||||
|
||||
-- Named placeholders (deprecated)
|
||||
MySQL.scalar('SELECT `username` FROM `users` WHERE `identifier` = @identifier AND `group` = @group', {
|
||||
group = group
|
||||
identifier = identifier
|
||||
})
|
||||
```
|
||||
|
||||
These are distinct from prepared statements which are handled by the MySQL server; you can use `MySQL.prepare` for more optimised and secure queries.
|
||||
Reference in new issue
Block a user