Query Syntax

Query Concepts

When deciding how to structure queries, SLDB tries to make it as natural feeling as possible. To do this we tried to follow standard query syntax while adding standardization to the order of arguments required.

Queries are initialized by a call to a query function within the SLDB Object. Most basic queries will use query functions that are named after the queries primary operator or command. Basic queries such as select, insert, delete, and update can be called by their corresponding query functions.

Query Types

Select

class SLDB
select($table, $fields, $where)
select($table, $fields, $where, $limit)
Parameters:
  • $table (string) – Table to query.
  • $fields (array) – Field names to return.
  • $where (array) – Field name/value pairs required to select.
Returns:

SLDB result array, or NULL if there is an internal error.

Insert

class SLDB
insert(string $table, $values)
Parameters:
  • $values (array) – Field name/value pairs to insert as a new row.
Returns:

SLDB result array, or NULL if there is an internal error.

Update

class SLDB
update($table, $where, $values)
update($table, $where, $values, $limit)
Parameters:
  • $table (string) – Table to query.
  • $where (array) – Field name/value pairs to query against.
  • $values (array) – Field name/value pairs to set.
Returns:

SLDB result array, or NULL if there is an internal error.

Delete

class SLDB
delete($table, $where)
delete($table, $where, $limit)
Parameters:
  • $table (string) – Table to query.
  • $where (array) – Field name/value pairs required to delete.
Returns:

SLDB result array, or NULL if there is an internal error.