Statement
MMO\pdo\statements · 1 symbol · generated 5 Oct 2026
Statement
Statement.php:27Wrapper on query to pdo.
- Namespace
MMO\pdo\statements- Implements
- iArray, iRenderable
- Uses traits
- tArray, tWithOptions
Index
| ALL_FLAG | ||
| CREATE_IF_NOT_EXISTS_FLAG | ||
| CREATE_TEMPORARY_FLAG | ||
| DELAYED_FLAG | ||
| DISTINCT_FLAG | ||
| DISTINCT_ROW_FLAG | ||
| HIGH_PRIORITY_FLAG | ||
| IF_EXISTS_FLAG | ||
| IGNORE_FLAG | ||
| LOW_PRIORITY_FLAG | ||
| QUICK_FLAG | ||
| STRAIGHT_JOIN_FLAG | ||
| content | ||
| handler | ||
| opts | ||
| stmt | ||
| template | ||
| addOptions($opts, $appendList) | Merge $opts into the existing options (through merge), rather than replacing them wholesale like setOptions. | |
| bindValue($pdo, $index, $value, $type, $binds) | Bind one already-emitted value onto the PDO statement. | |
| clear() | Empty the underlying content, keeping the object itself. | |
| clearOptions() | Empty the options bag. | |
| count() | \Countable::count | |
| execute() | Execute the query and set the current statement | |
| fetch($opt) | Fetch the first row of the query's result | |
| fetchAll($clear) | Fetch all the result of a query | |
| fetchAllObjects($class, $constructFirst, $args, $clear) | Fetch all the result of a query as Objects. | |
| fetchObject($class, $constructFirst, $args) | Fetch the result of a query as an Object. | |
| fetchValue($key) | Fetch the column's value of the first row of the query's result and advance fetch pointer | |
| fetchValues($key) | Fetch the column's value of all the row of the query's result | |
| flag($key, $flag, $set) | ||
| getIterator() | \IteratorAggregate::getIterator | |
| getOption($key, $default) | ||
| getOptions() | ||
| getPDOStatement() | ||
| getPlaceholders() | Extract placeholder from template | |
| isEmpty() | ||
| jsonSerialize() | \JsonSerializable::jsonSerialize -- the raw content is returned as-is (not recursively converted), so json_encode() relies on any nested iArray values being JsonSerializable themselves. | |
| keys() | ||
| loadArray($data) | Load every entry of a plain array into the content, through offsetSet (so any offsetSet() override defined by the class using this trait, e.g. | |
| offsetExists($key) | \ArrayAccess::offsetExists | |
| offsetGet($key) | \ArrayAccess::offsetGet | |
| offsetSet($key, $value) | \ArrayAccess::offsetSet -- a null $key appends ($bag[] = $value), like a plain PHP array. | |
| offsetUnset($key) | \ArrayAccess::offsetUnset -- on a list (sequential integer keys, as produced by $bag[] = ...), the element is spliced out (closing the gap and reindexing), matching \unset() semantics on a plain … | |
| prepare($binds, $sql) | Prepare a PDO statement by binding values. | |
| push($key, $fields) | ||
| render($opts) | ||
| reset() | ||
| rowCount() | ||
| setOption($key, $value) | Set (or, with a null $value, remove) a single option. | |
| setOptions($opts) | Replace the whole options bag. | |
| SplitType($key) static | Split a column:type key used by the INSERT/UPDATE value lists. | |
| toArray() | Convert the content to a plain array, recursively converting any nested iArray value (e.g. | |
| __construct($handler, $template, $content, $opts) | ||
| __toString() |
Constants12
ALL_FLAG
CREATE_IF_NOT_EXISTS_FLAG
CREATE_TEMPORARY_FLAG
DELAYED_FLAG
DISTINCT_FLAG
DISTINCT_ROW_FLAG
HIGH_PRIORITY_FLAG
IF_EXISTS_FLAG
IGNORE_FLAG
LOW_PRIORITY_FLAG
QUICK_FLAG
STRAIGHT_JOIN_FLAG
Properties5
content
handler
- Type
- iHandler
opts
- Type
- array
stmt
- Type
- null | PDOStatement
template
- Type
- string
Methods37
addOptions($opts, $appendList)
tWithOptions.php:65Merge $opts into the existing options (through merge), rather than replacing them wholesale like setOptions.
| $opts | array | the options to merge in |
| $appendList = false | bool | if true, a list-valued option is appended to (rather than replaced by) the corresponding list in $opts -- see \MMO\core\arrays\merge for the exact semantics |
| returns | void |
bindValue($pdo, $index, $value, $type, $binds)
Statement.php:128Bind one already-emitted value onto the PDO statement.
clear()
tArray.php:25Empty the underlying content, keeping the object itself.
| returns |
clearOptions()
tWithOptions.php:39Empty the options bag.
| returns | void |
count()
tArray.php:90\Countable::count
| returns | int |
execute()
Statement.php:193Execute the query and set the current statement
| returns | PDOStatement |
fetch($opt)
Statement.php:239Fetch the first row of the query's result
fetchAll($clear)
Statement.php:227Fetch all the result of a query
fetchAllObjects($class, $constructFirst, $args, $clear)
Statement.php:252Fetch all the result of a query as Objects.
fetchObject($class, $constructFirst, $args)
Statement.php:269Fetch the result of a query as an Object.
fetchValue($key)
Statement.php:286Fetch the column's value of the first row of the query's result and advance fetch pointer
| $key = 0 | string | int | the column name or index |
| returns | mixed | the value (null for a SQL NULL), or false if there is no row left or no such column |
fetchValues($key)
Statement.php:299Fetch the column's value of all the row of the query's result
flag($key, $flag, $set)
Statement.php:163getIterator()
tArray.php:97\IteratorAggregate::getIterator
| returns | Traversable |
getOption($key, $default)
tWithOptions.php:49getOptions()
tWithOptions.php:20| returns | array | every option currently set |
getPDOStatement()
Statement.php:76| returns | null | PDOStatement |
getPlaceholders()
Statement.php:113Extract placeholder from template
| returns | array | <key: {type, required, offset, size}> |
isEmpty()
tArray.php:33| returns | true if the underlying content has no elements |
jsonSerialize()
tArray.php:43\JsonSerializable::jsonSerialize -- the raw content is returned as-is (not recursively converted), so json_encode() relies on any nested iArray values being JsonSerializable themselves.
| returns | mixed |
keys()
tArray.php:82| returns | array | the list of keys currently set |
loadArray($data)
tArray.php:71Load every entry of a plain array into the content, through offsetSet (so any offsetSet() override defined by the class using this trait, e.g. for validation or type coercion, is honored for every entry).
offsetExists($key)
tArray.php:130\ArrayAccess::offsetExists
offsetGet($key)
tArray.php:115\ArrayAccess::offsetGet
offsetSet($key, $value)
tArray.php:122\ArrayAccess::offsetSet -- a null $key appends ($bag[] = $value), like a plain PHP array.
offsetUnset($key)
tArray.php:107\ArrayAccess::offsetUnset -- on a list (sequential integer keys, as produced by $bag[] = ...), the element is spliced out (closing the gap and reindexing), matching \unset() semantics on a plain PHP list; on an associative array, the key is simply removed.
prepare($binds, $sql)
Statement.php:92Prepare a PDO statement by binding values.
| $binds = [] | array | |
| $sql = null | null | string | |
| returns | PDOStatement |
push($key, $fields)
Statement.php:175render($opts)
Statement.php:70reset()
Statement.php:105| returns | void |
rowCount()
Statement.php:309| returns | int |
setOption($key, $value)
tWithOptions.php:77Set (or, with a null $value, remove) a single option.
setOptions($opts)
tWithOptions.php:30Replace the whole options bag.
SplitType($key)
staticStatement.php:159Split a column:type key used by the INSERT/UPDATE value lists.
| $key | string | e.g. 'age', 'age:int', 'counter:raw' |
| returns | array | string, 1: ?string} the column, and the bind type -- 'raw' meaning "render this value verbatim, do not bind it" (for a SQL expression such as counter+1), null meaning "infer from the value" |
toArray()
tArray.php:56Convert the content to a plain array, recursively converting any nested iArray value (e.g. another object using this same trait) into its own plain-array form as well.
| returns | array |
__construct($handler, $template, $content, $opts)
Statement.php:59__toString()
Statement.php:66| returns | string |