Statement.php 5.6 KB

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