PDO
About 1 min
PDO
PDO result wrapper for Hazaar DBI, providing methods to interact with PDOStatement results.
class PDO extends \Hazaar\DBI\Result\ResultSupports fetching rows, columns, objects, and processing result metadata for advanced type handling.
Properties
public $typeMap
private array $typeMap = array (
'numeric' => 'int',
'int2' => 'int',
'int4' => 'int',
'int8' => 'int',
'float8' => 'float',
'timestamp' => 'Hazaar\\Util\\DateTime',
'timestamptz' => 'Hazaar\\Util\\DateTime',
'date' =>
array (
0 => 'Hazaar\\Util\\DateTime',
1 =>
array (
'format' => 'Y-m-d',
),
),
'bool' => 'boolean',
'money' => 'Hazaar\\Money',
'bytea' =>
array (
0 => 'string',
1 =>
array (
'prepare' => 'stream_get_contents',
),
),
)Methods
__construct
Construct a new PDO result wrapper for the given PDOStatement.
public __construct(\PDOStatement $statement): voidParameters
| Parameter | Type | Description |
|---|---|---|
$statement | \PDOStatement | the PDO statement to wrap |
createWithAdapter
Create a new PDO result wrapper and associate it with a DBI adapter.
public createWithAdapter(Adapter $adapter, \PDOStatement $statement): selfParameters
| Parameter | Type | Description |
|---|---|---|
$adapter | Adapter | the DBI adapter instance |
$statement | \PDOStatement | the PDO statement to wrap |
toString
Get the SQL query string for this result.
public toString(): stringrowCount
Get the number of rows affected or returned by the query.
public rowCount(): intcolumnCount
Get the number of columns in the result set.
public columnCount(): intfetch
public fetch(int $fetchStyle = '\PDO::FETCH_ASSOC', int $cursorOrientation = '\PDO::FETCH_ORI_NEXT', int $cursorOffset, false $): voidParameters
| Parameter | Type | Description |
|---|---|---|
$fetchStyle | int | |
$cursorOrientation | int | |
$cursorOffset | int | |
$ | false |
fetchAll
public fetchAll(int $fetchMode = '\PDO::FETCH_ASSOC', mixed $fetchArgument): voidParameters
| Parameter | Type | Description |
|---|---|---|
$fetchMode | int | |
$fetchArgument | mixed |
fetchColumn
Fetch a single column from the next row in the result set.
public fetchColumn(int $columnNumber): mixedParameters
| Parameter | Type | Description |
|---|---|---|
$columnNumber | int | the column index to fetch (default 0) |
fetchObject
public fetchObject(string $className = 'stdClass', array $constructorArgs): objectParameters
| Parameter | Type | Description |
|---|---|---|
$className | string | |
$constructorArgs | array |
row
Fetch the next row as a Row object, with optional cursor orientation and offset.
public row(int $cursorOrientation = '\PDO::FETCH_ORI_NEXT', int $offset): ?RowParameters
| Parameter | Type | Description |
|---|---|---|
$cursorOrientation | int | cursor orientation constant (default FETCH_ORI_NEXT) |
$offset | int | row offset (default 0) |
rows
public rows(): voidprepareResult
protected prepareResult(array $record): voidParameters
| Parameter | Type | Description |
|---|---|---|
$record | array |
processStatement
Process the PDOStatement metadata and populate column type information.
private processStatement(\PDOStatement $statement): boolParameters
| Parameter | Type | Description |
|---|---|---|
$statement | \PDOStatement | the PDO statement to process |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:25 +0000