Statement.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 MIT license. For more information, see
  17. * <http://www.doctrine-project.org>.
  18. */
  19. namespace Doctrine\DBAL\Driver;
  20. /**
  21. * Statement interface.
  22. * Drivers must implement this interface.
  23. *
  24. * This resembles (a subset of) the PDOStatement interface.
  25. *
  26. * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
  27. * @author Roman Borschel <roman@code-factory.org>
  28. * @link www.doctrine-project.org
  29. * @since 2.0
  30. */
  31. interface Statement extends ResultStatement
  32. {
  33. /**
  34. * Binds a value to a corresponding named or positional
  35. * placeholder in the SQL statement that was used to prepare the statement.
  36. *
  37. * @param mixed $param Parameter identifier. For a prepared statement using named placeholders,
  38. * this will be a parameter name of the form :name. For a prepared statement
  39. * using question mark placeholders, this will be the 1-indexed position of the parameter.
  40. * @param mixed $value The value to bind to the parameter.
  41. * @param integer $type Explicit data type for the parameter using the PDO::PARAM_* constants.
  42. *
  43. * @return boolean TRUE on success or FALSE on failure.
  44. */
  45. function bindValue($param, $value, $type = null);
  46. /**
  47. * Binds a PHP variable to a corresponding named or question mark placeholder in the
  48. * SQL statement that was use to prepare the statement. Unlike PDOStatement->bindValue(),
  49. * the variable is bound as a reference and will only be evaluated at the time
  50. * that PDOStatement->execute() is called.
  51. *
  52. * Most parameters are input parameters, that is, parameters that are
  53. * used in a read-only fashion to build up the query. Some drivers support the invocation
  54. * of stored procedures that return data as output parameters, and some also as input/output
  55. * parameters that both send in data and are updated to receive it.
  56. *
  57. * @param mixed $column Parameter identifier. For a prepared statement using named placeholders,
  58. * this will be a parameter name of the form :name. For a prepared statement using
  59. * question mark placeholders, this will be the 1-indexed position of the parameter.
  60. * @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter.
  61. * @param integer|null $type Explicit data type for the parameter using the PDO::PARAM_* constants. To return
  62. * an INOUT parameter from a stored procedure, use the bitwise OR operator to set the
  63. * PDO::PARAM_INPUT_OUTPUT bits for the data_type parameter.
  64. * @param integer|null $length You must specify maxlength when using an OUT bind
  65. * so that PHP allocates enough memory to hold the returned value.
  66. *
  67. * @return boolean TRUE on success or FALSE on failure.
  68. */
  69. function bindParam($column, &$variable, $type = null, $length = null);
  70. /**
  71. * Fetches the SQLSTATE associated with the last operation on the statement handle.
  72. *
  73. * @see Doctrine_Adapter_Interface::errorCode()
  74. *
  75. * @return string The error code string.
  76. */
  77. function errorCode();
  78. /**
  79. * Fetches extended error information associated with the last operation on the statement handle.
  80. *
  81. * @see Doctrine_Adapter_Interface::errorInfo()
  82. *
  83. * @return array The error info array.
  84. */
  85. function errorInfo();
  86. /**
  87. * Executes a prepared statement
  88. *
  89. * If the prepared statement included parameter markers, you must either:
  90. * call PDOStatement->bindParam() to bind PHP variables to the parameter markers:
  91. * bound variables pass their value as input and receive the output value,
  92. * if any, of their associated parameter markers or pass an array of input-only
  93. * parameter values.
  94. *
  95. *
  96. * @param array|null $params An array of values with as many elements as there are
  97. * bound parameters in the SQL statement being executed.
  98. *
  99. * @return boolean TRUE on success or FALSE on failure.
  100. */
  101. function execute($params = null);
  102. /**
  103. * Returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement
  104. * executed by the corresponding object.
  105. *
  106. * If the last SQL statement executed by the associated Statement object was a SELECT statement,
  107. * some databases may return the number of rows returned by that statement. However,
  108. * this behaviour is not guaranteed for all databases and should not be
  109. * relied on for portable applications.
  110. *
  111. * @return integer The number of rows.
  112. */
  113. function rowCount();
  114. }