self:delete
Server
Appends a row deletion to the query
Syntax
local query = self:delete()This function only prepares the query and does not execute it. Chain db_query:execute at the end to commit the query to the core.database.
- Chaining — compatible with
:whereto target specific rows for deletion. - Multiple deletions — chain multiple
:deletecalls to append additional row deletions. - Multiple conditions — chain multiple
:wherecalls to apply additional filters to the deletion. - Without conditions — omitting
:wherewill delete all rows in the table.
Parameters
| No parameters are accepted by this function |
|---|
Returns
| Type | Name | Description |
|---|---|---|
db_query | bool | query | Query builder instance on successful execution, false otherwise |
Examples
local db = core.database.create("127.0.0.1", "root", "", "vital_sandbox")
util.thread.create(function(self)
local ok, err = self:await(db:table("players")
:delete()
:where("name", "=", "aviril")
:execute())
if not ok then
core.engine.print("error", err)
end
end):resume()local db = core.database.create("127.0.0.1", "root", "", "vital_sandbox")
util.thread.create(function(self)
local ok, err = self:await(db:table("players")
:delete()
:execute())
if not ok then
core.engine.print("error", err)
end
end):resume()