[345] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
| 4 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
| 5 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
| 6 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
---|
| 7 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
| 8 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
---|
| 9 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
| 10 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
| 11 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
| 12 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
---|
| 13 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 14 | * |
---|
| 15 | * This software consists of voluntary contributions made by many individuals |
---|
| 16 | * and is licensed under the LGPL. For more information, see |
---|
| 17 | * <http://www.doctrine-project.org>. |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | namespace Doctrine\DBAL\Driver; |
---|
| 21 | |
---|
| 22 | use \PDO; |
---|
| 23 | |
---|
| 24 | /** |
---|
| 25 | * Statement interface. |
---|
| 26 | * Drivers must implement this interface. |
---|
| 27 | * |
---|
| 28 | * This resembles (a subset of) the PDOStatement interface. |
---|
| 29 | * |
---|
| 30 | * @author Konsta Vesterinen <kvesteri@cc.hut.fi> |
---|
| 31 | * @author Roman Borschel <roman@code-factory.org> |
---|
| 32 | * @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
---|
| 33 | * @link www.doctrine-project.org |
---|
| 34 | * @since 2.0 |
---|
| 35 | */ |
---|
| 36 | interface Statement extends ResultStatement |
---|
| 37 | { |
---|
| 38 | /** |
---|
| 39 | * Binds a value to a corresponding named or positional |
---|
| 40 | * placeholder in the SQL statement that was used to prepare the statement. |
---|
| 41 | * |
---|
| 42 | * @param mixed $param Parameter identifier. For a prepared statement using named placeholders, |
---|
| 43 | * this will be a parameter name of the form :name. For a prepared statement |
---|
| 44 | * using question mark placeholders, this will be the 1-indexed position of the parameter |
---|
| 45 | * |
---|
| 46 | * @param mixed $value The value to bind to the parameter. |
---|
| 47 | * @param integer $type Explicit data type for the parameter using the PDO::PARAM_* constants. |
---|
| 48 | * |
---|
| 49 | * @return boolean Returns TRUE on success or FALSE on failure. |
---|
| 50 | */ |
---|
| 51 | function bindValue($param, $value, $type = null); |
---|
| 52 | |
---|
| 53 | /** |
---|
| 54 | * Binds a PHP variable to a corresponding named or question mark placeholder in the |
---|
| 55 | * SQL statement that was use to prepare the statement. Unlike PDOStatement->bindValue(), |
---|
| 56 | * the variable is bound as a reference and will only be evaluated at the time |
---|
| 57 | * that PDOStatement->execute() is called. |
---|
| 58 | * |
---|
| 59 | * Most parameters are input parameters, that is, parameters that are |
---|
| 60 | * used in a read-only fashion to build up the query. Some drivers support the invocation |
---|
| 61 | * of stored procedures that return data as output parameters, and some also as input/output |
---|
| 62 | * parameters that both send in data and are updated to receive it. |
---|
| 63 | * |
---|
| 64 | * @param mixed $param Parameter identifier. For a prepared statement using named placeholders, |
---|
| 65 | * this will be a parameter name of the form :name. For a prepared statement |
---|
| 66 | * using question mark placeholders, this will be the 1-indexed position of the parameter |
---|
| 67 | * |
---|
| 68 | * @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter. |
---|
| 69 | * |
---|
| 70 | * @param integer $type Explicit data type for the parameter using the PDO::PARAM_* constants. To return |
---|
| 71 | * an INOUT parameter from a stored procedure, use the bitwise OR operator to set the |
---|
| 72 | * PDO::PARAM_INPUT_OUTPUT bits for the data_type parameter. |
---|
| 73 | * @return boolean Returns TRUE on success or FALSE on failure. |
---|
| 74 | */ |
---|
| 75 | function bindParam($column, &$variable, $type = null); |
---|
| 76 | |
---|
| 77 | /** |
---|
| 78 | * errorCode |
---|
| 79 | * Fetch the SQLSTATE associated with the last operation on the statement handle |
---|
| 80 | * |
---|
| 81 | * @see Doctrine_Adapter_Interface::errorCode() |
---|
| 82 | * @return string error code string |
---|
| 83 | */ |
---|
| 84 | function errorCode(); |
---|
| 85 | |
---|
| 86 | /** |
---|
| 87 | * errorInfo |
---|
| 88 | * Fetch extended error information associated with the last operation on the statement handle |
---|
| 89 | * |
---|
| 90 | * @see Doctrine_Adapter_Interface::errorInfo() |
---|
| 91 | * @return array error info array |
---|
| 92 | */ |
---|
| 93 | function errorInfo(); |
---|
| 94 | |
---|
| 95 | /** |
---|
| 96 | * Executes a prepared statement |
---|
| 97 | * |
---|
| 98 | * If the prepared statement included parameter markers, you must either: |
---|
| 99 | * call PDOStatement->bindParam() to bind PHP variables to the parameter markers: |
---|
| 100 | * bound variables pass their value as input and receive the output value, |
---|
| 101 | * if any, of their associated parameter markers or pass an array of input-only |
---|
| 102 | * parameter values |
---|
| 103 | * |
---|
| 104 | * |
---|
| 105 | * @param array $params An array of values with as many elements as there are |
---|
| 106 | * bound parameters in the SQL statement being executed. |
---|
| 107 | * @return boolean Returns TRUE on success or FALSE on failure. |
---|
| 108 | */ |
---|
| 109 | function execute($params = null); |
---|
| 110 | |
---|
| 111 | /** |
---|
| 112 | * rowCount |
---|
| 113 | * rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement |
---|
| 114 | * executed by the corresponding object. |
---|
| 115 | * |
---|
| 116 | * If the last SQL statement executed by the associated Statement object was a SELECT statement, |
---|
| 117 | * some databases may return the number of rows returned by that statement. However, |
---|
| 118 | * this behaviour is not guaranteed for all databases and should not be |
---|
| 119 | * relied on for portable applications. |
---|
| 120 | * |
---|
| 121 | * @return integer Returns the number of rows. |
---|
| 122 | */ |
---|
| 123 | function rowCount(); |
---|
| 124 | } |
---|