Query/src/Drivers/PDOStatementInterface.php

175 lines
4.9 KiB
PHP
Raw Normal View History

2016-10-12 22:12:25 -04:00
<?php declare(strict_types=1);
2016-09-07 17:39:19 -04:00
/**
* Query
*
* SQL Query Builder / Database Abstraction Layer
*
2018-01-19 13:43:19 -05:00
* PHP version 7.1
2016-09-07 17:39:19 -04:00
*
* @package Query
* @author Timothy J. Warren <tim@timshomepage.net>
2018-01-19 13:43:19 -05:00
* @copyright 2012 - 2018 Timothy J. Warren
2016-09-07 17:39:19 -04:00
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query
*/
namespace Query\Drivers;
use PDO;
/**
* Interface created from official PHP Documentation
*/
interface PDOStatementInterface {
/**
* Bind a column to a PHP variable
*
* @param mixed $column Number or name of the column in the result set
2016-10-12 20:32:23 -04:00
* @param mixed $param Name of the PHP variable to which the column will be bound
2016-09-07 17:39:19 -04:00
* @param int $type Data type of the parameter, specified by the PDO::PARAM_* constants
* @param int $maxlen A hint for pre-allocation
* @param mixed $driverdata Optional parameter(s) for the driver
* @return boolean
*/
public function bindColumn($column, &$param, $type, $maxlen, $driverdata);
/**
* Binds a parameter to the specified variable name
*
* @param mixed $parameter Parameter identifier. For a prepared statement using named placeholders, this will be a
* parameter name of the form :name. For a prepared statement using question mark placeholders, this will be the
* 1-indexed position of the parameter.
2016-10-12 20:32:23 -04:00
* @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter.
2016-10-13 21:55:23 -04:00
* @param int $dataType Explicit data type for the parameter using the PDO::PARAM_* constants. To return an INOUT
2016-09-07 17:39:19 -04:00
* parameter from a stored procedure, use the bitwise OR operator to set the PDO::PARAM_INPUT_OUTPUT bits
* for the data_type parameter.
* @param int $length Length of the data type. To indicate that a parameter is an OUT parameter from a stored procedure,
* you must explicitly set the length.
2016-10-13 21:55:23 -04:00
* @param mixed $driverOptions
2016-09-07 17:39:19 -04:00
* @return boolean
*/
2016-10-13 21:55:23 -04:00
public function bindParam($parameter, &$variable, $dataType = PDO::PARAM_STR, $length, $driverOptions);
2016-09-07 17:39:19 -04:00
/**
* Binds a value to a corresponding named or question mark placeholder in the SQL statement that was used to
* prepare the statement
*
* @param mixed $parameter Parameter identifier. For a prepared statement using named placeholders, this will be a
* parameter name of the form :name. For a prepared statement using question mark placeholders, this will be the
* 1-indexed position of the parameter.
* @param mixed $value The value to bind to the parameter
2016-10-13 21:55:23 -04:00
* @param int $dataType Explicit data type for the parameter using the PDO::PARAM_* constants.
2016-09-07 17:39:19 -04:00
* @return boolean
*/
2016-10-13 21:55:23 -04:00
public function bindValue($parameter, $value, $dataType = PDO::PARAM_STR);
2016-09-07 17:39:19 -04:00
/**
* Frees up the connection to the server so that other SQL statements may be issued, but leaves the statement in a
* state that enables it to be executed again
*
* @return boolean
*/
public function closeCursor();
/**
* Returns the number of columns in the result set
*
* @return int
*/
public function columnCount();
/**
* Dumps the information contained by a prepared statement directly on the output
*
* @return void
*/
public function debugDumpParams();
/**
* Fetch the SQLSTATE associated with the last operation on the statement handle
*
* @return string
*/
public function errorCode();
/**
* Fetch extended error information associated with the last operation on the statement handle
*
* @return array
*/
public function errorInfo();
/**
* Run a prepared statement query
*
2016-10-13 21:55:23 -04:00
* @param array $boundInputParams
2016-09-07 17:39:19 -04:00
* @return boolean
*/
2016-10-13 21:55:23 -04:00
public function execute($boundInputParams = NULL);
2016-09-07 17:39:19 -04:00
/**
* Fetches the next row from a result set
*
2016-10-12 22:12:25 -04:00
* @param int $how
* @param int $orientation
* @param int $offset
2016-09-07 17:39:19 -04:00
* @return mixed
*/
2016-10-12 22:12:25 -04:00
public function fetch($how = PDO::ATTR_DEFAULT_FETCH_MODE, $orientation = PDO::FETCH_ORI_NEXT, $offset = 0);
2016-09-07 17:39:19 -04:00
/**
* Returns a single column from the next row of a result set
*
2016-10-13 21:55:23 -04:00
* @param int $columnNumber
2016-09-07 17:39:19 -04:00
* @return mixed
*/
2016-10-13 21:55:23 -04:00
public function fetchColumn($columnNumber = 0);
2016-09-07 17:39:19 -04:00
/**
* Fetches the next row and returns it as an object
*
2016-10-13 21:55:23 -04:00
* @param string $className
* @param array $ctorArgs
2016-09-07 17:39:19 -04:00
* @return mixed
*/
2016-10-13 21:55:23 -04:00
public function fetchObject($className = "stdClass", $ctorArgs = NULL);
2016-09-07 17:39:19 -04:00
/**
* Retrieve a statement attribute
*
* @param int $attribute
* @return mixed
*/
public function getAttribute($attribute);
/**
* Advances to the next rowset in a multi-rowset statement handle
*
* @return boolean
*/
public function nextRowset();
/**
* Returns the number of rows affected by the last SQL statement
*
* @return int
*/
public function rowCount();
/**
* Set a statement attribute
*
* @param int $attribute
* @param mixed $value
* @return boolean
*/
public function setAttribute($attribute, $value);
/**
* Set the default fetch mode for this statement
*
* @param int $mode
* @return boolean
*/
public function setFetchMode($mode);
}