dvdoug /
DB
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Database Access Layer |
||
| 4 | * @package DB |
||
| 5 | * @author Doug Wright |
||
| 6 | */ |
||
| 7 | namespace DVDoug\DB; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * Represents a prepared statement and, after the statement is executed, an associated result set |
||
| 11 | * @author Doug Wright |
||
| 12 | * @package DB |
||
| 13 | */ |
||
| 14 | interface StatementInterface extends \Traversable { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Used query string |
||
| 18 | */ |
||
| 19 | public function getQueryString(); |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Executes a prepared statement |
||
| 23 | * @return bool. |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 24 | */ |
||
| 25 | public function execute(); |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Fetches the next row(s) from the result set as an associative array |
||
| 29 | * @param bool $aAllRows true to fetch all remaining rows, false for next row only |
||
| 30 | * @param bool $aGroupByFirstCol whether to group the results by the first column |
||
| 31 | * @return array|bool |
||
| 32 | */ |
||
| 33 | public function fetchAssoc($aAllRows = true, $aGroupByFirstCol = false); |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Fetches the next row(s) from a 2-column result set as a key=>value pairs |
||
| 37 | * @param bool $aAllRows true to fetch all remaining rows, false for next row only |
||
| 38 | * @param bool $aGroupByFirstCol whether to group the results by the first column |
||
| 39 | * @return array|bool |
||
| 40 | */ |
||
| 41 | public function fetchKeyPair($aAllRows = true, $aGroupByFirstCol = false); |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Fetches the next row(s) from the result set as an object |
||
| 45 | * @param string $aClassName if specified, object will be created as instance of this type |
||
| 46 | * @param array $aConstructorArguments arguments to pass to constructor |
||
| 47 | * @param bool $aRunConstructorFirst whether the constructor should be run before/after the object's members are set |
||
| 48 | * @param bool $aAllRows true to fetch all remaining rows, false for next row only |
||
| 49 | * @param bool $aGroupByFirstCol whether to group the results by the first column |
||
| 50 | * @return array|bool |
||
| 51 | */ |
||
| 52 | public function fetchObj($aClassName = NULL, $aConstructorArguments = array(), $aRunConstructorFirst = true, $aAllRows = true, $aGroupByFirstCol = false); |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Fetches the next row into the specified object |
||
| 56 | * @param string $aObject object to update |
||
| 57 | * @return array|bool |
||
| 58 | */ |
||
| 59 | public function fetchIntoObj($aObject); |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Binds a value to a variable |
||
| 63 | * @param string $aParam parameter name of the form :name |
||
| 64 | * @param mixed $aVariable mixed The variable to bind to the parameter |
||
| 65 | * @param int $aDataType data type for the parameter using the DatabaseInterface::PARAM_* constants. |
||
| 66 | * @return bool |
||
| 67 | */ |
||
| 68 | public function bindParamToVariable($aParam, &$aVariable, $aDataType = DatabaseInterface::PARAM_IS_STR); |
||
| 69 | |||
| 70 | /** |
||
| 71 | * Binds a column to a variable |
||
| 72 | * @param string $aColumn column name |
||
| 73 | * @param mixed $aVariable mixed The variable to bind to the result |
||
| 74 | * @param int $aDataType data type for the column using the DatabaseInterface::PARAM_* constants. |
||
| 75 | * @return bool |
||
| 76 | */ |
||
| 77 | public function bindResultColumn($aColumn, &$aVariable, $aDataType = DatabaseInterface::PARAM_IS_STR); |
||
| 78 | |||
| 79 | /** |
||
| 80 | * Binds a value to a parameter |
||
| 81 | * @param string $aParam parameter name of the form :name |
||
| 82 | * @param mixed $aValue mixed The value to bind to the parameter |
||
| 83 | * @param int $aDataType data type for the parameter using the DatabaseInterface::PARAM_* constants. |
||
| 84 | * @return bool |
||
| 85 | */ |
||
| 86 | public function bindParamToValue($aParam, $aValue, $aDataType = DatabaseInterface::PARAM_IS_STR); |
||
| 87 | |||
| 88 | /** |
||
| 89 | * Closes the cursor, enabling the statement to be executed again. |
||
| 90 | * @return bool |
||
| 91 | */ |
||
| 92 | public function closeCursor(); |
||
| 93 | } |
||
| 94 |