Hoa central
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Hoa\Database\Layer\Pdo\Statement Class Reference
Inheritance diagram for Hoa\Database\Layer\Pdo\Statement:

Public Member Functions

 __construct (\PDOStatement $statement)
 
 execute (Array $bindParameters=null)
 
 bindParameter ($parameter, &$value, $type=null, $length=null)
 
 fetchAll ()
 
 fetchFirst ()
 
 fetchLast ()
 
 fetchNext ()
 
 fetchPrior ()
 
 fetchColumn ($column=0)
 
 closeCursor ()
 
 errorCode ()
 
 errorInfo ()
 

Protected Member Functions

 setStatement (\PDOStatement $statement)
 
 getStatement ()
 
 fetch ($orientation=\PDO::FETCH_ORI_NEXT)
 

Protected Attributes

 $_statement = null
 

Detailed Description

Class .

Wrap PDOStatement.

Definition at line 49 of file Statement.php.

Constructor & Destructor Documentation

Hoa\Database\Layer\Pdo\Statement::__construct ( \PDOStatement  $statement)

Create a statement instance.

Parameters
\PDOStatement$statementThe PDOStatement instance.
Returns
void

Definition at line 66 of file Statement.php.

67  {
68  $this->setStatement($statement);
69 
70  return;
71  }
setStatement(\PDOStatement $statement)
Definition: Statement.php:79

Here is the call graph for this function:

Member Function Documentation

Hoa\Database\Layer\Pdo\Statement::bindParameter (   $parameter,
$value,
  $type = null,
  $length = null 
)

Bind a parameter to te specified variable name.

Parameters
mixed$parameterParameter name.
mixed$valueParameter value.
int$typeType of value.
int$lengthLength of data type.
Returns
bool
Exceptions

Implements Hoa\Database\IDal\WrapperStatement.

Definition at line 128 of file Statement.php.

133  {
134  if (null === $type) {
135  return $this->getStatement()->bindParam($parameter, $value);
136  }
137 
138  if (null === $length) {
139  return $this->getStatement()->bindParam($parameter, $value, $type);
140  }
141 
142  return $this->getStatement()->bindParam($parameter, $value, $type, $length);
143  }

Here is the call graph for this function:

Hoa\Database\Layer\Pdo\Statement::closeCursor ( )

Close the cursor, enabling the statement to be executed again.

Returns
bool
Exceptions

Implements Hoa\Database\IDal\WrapperStatement.

Definition at line 235 of file Statement.php.

236  {
237  return $this->getStatement()->closeCursor();
238  }

Here is the call graph for this function:

Hoa\Database\Layer\Pdo\Statement::errorCode ( )

Fetch the SQLSTATE associated with the last operation on the statement handle.

Returns
string
Exceptions

Implements Hoa\Database\IDal\WrapperStatement.

Definition at line 247 of file Statement.php.

248  {
249  return $this->getStatement()->errorCode();
250  }

Here is the call graph for this function:

Hoa\Database\Layer\Pdo\Statement::errorInfo ( )

Fetch extends error information associated with the last operation on the statement handle.

Returns
array
Exceptions

Implements Hoa\Database\IDal\WrapperStatement.

Definition at line 259 of file Statement.php.

260  {
261  return $this->getStatement()->errorInfo();
262  }

Here is the call graph for this function:

Here is the caller graph for this function:

Hoa\Database\Layer\Pdo\Statement::execute ( Array  $bindParameters = null)

Execute a prepared statement.

Parameters
array$bindParametersBind parameters values if bindParam is not called.
Returns
Exceptions

Implements Hoa\Database\IDal\WrapperStatement.

Definition at line 105 of file Statement.php.

106  {
107  if (false === $this->getStatement()->execute($bindParameters)) {
108  throw new Database\Exception(
109  '%3$s (%1$s/%2$d)',
110  0,
111  $this->errorInfo()
112  );
113  }
114 
115  return $this;
116  }
execute(Array $bindParameters=null)
Definition: Statement.php:105

Here is the call graph for this function:

Hoa\Database\Layer\Pdo\Statement::fetch (   $orientation = \PDO::FETCH_ORI_NEXT)
protected

Fetch the next row in the result set.

Parameters
int$orientationMust be one of the ::FETCH_ORI_* constants.
Returns
mixed
Exceptions

Definition at line 164 of file Statement.php.

165  {
166  return $this->getStatement()->fetch(
167  \PDO::FETCH_ASSOC,
168  $orientation
169  );
170  }

Here is the call graph for this function:

Here is the caller graph for this function:

Hoa\Database\Layer\Pdo\Statement::fetchAll ( )

Return an array containing all of the result set rows.

Returns
array
Exceptions

Implements Hoa\Database\IDal\WrapperStatement.

Definition at line 151 of file Statement.php.

152  {
153  return $this->getStatement()->fetchAll(\PDO::FETCH_ASSOC);
154  }

Here is the call graph for this function:

Hoa\Database\Layer\Pdo\Statement::fetchColumn (   $column = 0)

Return a single column from the next row of the result set or false if there is no more row.

Parameters
int$columnColumn index.
Returns
mixed
Exceptions

Implements Hoa\Database\IDal\WrapperStatement.

Definition at line 224 of file Statement.php.

225  {
226  return $this->getStatement()->fetchColumn($column);
227  }

Here is the call graph for this function:

Hoa\Database\Layer\Pdo\Statement::fetchFirst ( )

Fetch the first row in the result set.

Returns
mixed
Exceptions

Implements Hoa\Database\IDal\WrapperStatement.

Definition at line 178 of file Statement.php.

179  {
180  return $this->fetch(\PDO::FETCH_ORI_FIRST);
181  }
fetch($orientation=\PDO::FETCH_ORI_NEXT)
Definition: Statement.php:164

Here is the call graph for this function:

Hoa\Database\Layer\Pdo\Statement::fetchLast ( )

Fetch the last row in the result set.

Returns
mixed
Exceptions

Implements Hoa\Database\IDal\WrapperStatement.

Definition at line 189 of file Statement.php.

190  {
191  return $this->fetch(\PDO::FETCH_ORI_LAST);
192  }
fetch($orientation=\PDO::FETCH_ORI_NEXT)
Definition: Statement.php:164

Here is the call graph for this function:

Hoa\Database\Layer\Pdo\Statement::fetchNext ( )

Fetch the next row in the result set.

Returns
mixed
Exceptions

Implements Hoa\Database\IDal\WrapperStatement.

Definition at line 200 of file Statement.php.

201  {
202  return $this->fetch(\PDO::FETCH_ORI_NEXT);
203  }
fetch($orientation=\PDO::FETCH_ORI_NEXT)
Definition: Statement.php:164

Here is the call graph for this function:

Hoa\Database\Layer\Pdo\Statement::fetchPrior ( )

Fetch the previous row in the result set.

Returns
mixed
Exceptions

Implements Hoa\Database\IDal\WrapperStatement.

Definition at line 211 of file Statement.php.

212  {
213  return $this->fetch(\PDO::FETCH_ORI_PRIOR);
214  }
fetch($orientation=\PDO::FETCH_ORI_NEXT)
Definition: Statement.php:164

Here is the call graph for this function:

Hoa\Database\Layer\Pdo\Statement::getStatement ( )
protected

Get the statement instance.

Returns

Definition at line 92 of file Statement.php.

93  {
94  return $this->_statement;
95  }

Here is the caller graph for this function:

Hoa\Database\Layer\Pdo\Statement::setStatement ( \PDOStatement  $statement)
protected

Set the statement instance.

Parameters
\PDOStatement$statementThe PDOStatement instance.
Returns

Definition at line 79 of file Statement.php.

80  {
81  $old = $this->_statement;
82  $this->_statement = $statement;
83 
84  return $old;
85  }

Here is the caller graph for this function:

Member Data Documentation

Hoa\Database\Layer\Pdo\Statement::$_statement = null
protected

Definition at line 56 of file Statement.php.


The documentation for this class was generated from the following file: