DatabaseConnection.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. /**
  3. * The Auth_OpenID_DatabaseConnection class, which is used to emulate
  4. * a PEAR database connection.
  5. *
  6. * @package OpenID
  7. * @author JanRain, Inc. <openid@janrain.com>
  8. * @copyright 2005-2008 Janrain, Inc.
  9. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache
  10. */
  11. /**
  12. * An empty base class intended to emulate PEAR connection
  13. * functionality in applications that supply their own database
  14. * abstraction mechanisms. See {@link Auth_OpenID_SQLStore} for more
  15. * information. You should subclass this class if you need to create
  16. * an SQL store that needs to access its database using an
  17. * application's database abstraction layer instead of a PEAR database
  18. * connection. Any subclass of Auth_OpenID_DatabaseConnection MUST
  19. * adhere to the interface specified here.
  20. *
  21. * @package OpenID
  22. */
  23. class Auth_OpenID_DatabaseConnection {
  24. /**
  25. * Sets auto-commit mode on this database connection.
  26. *
  27. * @param bool $mode True if auto-commit is to be used; false if
  28. * not.
  29. */
  30. function autoCommit($mode)
  31. {
  32. }
  33. /**
  34. * Run an SQL query with the specified parameters, if any.
  35. *
  36. * @param string $sql An SQL string with placeholders. The
  37. * placeholders are assumed to be specific to the database engine
  38. * for this connection.
  39. *
  40. * @param array $params An array of parameters to insert into the
  41. * SQL string using this connection's escaping mechanism.
  42. *
  43. * @return mixed $result The result of calling this connection's
  44. * internal query function. The type of result depends on the
  45. * underlying database engine. This method is usually used when
  46. * the result of a query is not important, like a DDL query.
  47. */
  48. function query($sql, $params = array())
  49. {
  50. }
  51. /**
  52. * Starts a transaction on this connection, if supported.
  53. */
  54. function begin()
  55. {
  56. }
  57. /**
  58. * Commits a transaction on this connection, if supported.
  59. */
  60. function commit()
  61. {
  62. }
  63. /**
  64. * Performs a rollback on this connection, if supported.
  65. */
  66. function rollback()
  67. {
  68. }
  69. /**
  70. * Run an SQL query and return the first column of the first row
  71. * of the result set, if any.
  72. *
  73. * @param string $sql An SQL string with placeholders. The
  74. * placeholders are assumed to be specific to the database engine
  75. * for this connection.
  76. *
  77. * @param array $params An array of parameters to insert into the
  78. * SQL string using this connection's escaping mechanism.
  79. *
  80. * @return mixed $result The value of the first column of the
  81. * first row of the result set. False if no such result was
  82. * found.
  83. */
  84. function getOne($sql, $params = array())
  85. {
  86. }
  87. /**
  88. * Run an SQL query and return the first row of the result set, if
  89. * any.
  90. *
  91. * @param string $sql An SQL string with placeholders. The
  92. * placeholders are assumed to be specific to the database engine
  93. * for this connection.
  94. *
  95. * @param array $params An array of parameters to insert into the
  96. * SQL string using this connection's escaping mechanism.
  97. *
  98. * @return array $result The first row of the result set, if any,
  99. * keyed on column name. False if no such result was found.
  100. */
  101. function getRow($sql, $params = array())
  102. {
  103. }
  104. /**
  105. * Run an SQL query with the specified parameters, if any.
  106. *
  107. * @param string $sql An SQL string with placeholders. The
  108. * placeholders are assumed to be specific to the database engine
  109. * for this connection.
  110. *
  111. * @param array $params An array of parameters to insert into the
  112. * SQL string using this connection's escaping mechanism.
  113. *
  114. * @return array $result An array of arrays representing the
  115. * result of the query; each array is keyed on column name.
  116. */
  117. function getAll($sql, $params = array())
  118. {
  119. }
  120. }