4 * The Auth_OpenID_DatabaseConnection class, which is used to emulate
5 * a PEAR database connection.
8 * @author JanRain, Inc. <openid@janrain.com>
9 * @copyright 2005-2008 Janrain, Inc.
10 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache
14 * An empty base class intended to emulate PEAR connection
15 * functionality in applications that supply their own database
16 * abstraction mechanisms. See {@link Auth_OpenID_SQLStore} for more
17 * information. You should subclass this class if you need to create
18 * an SQL store that needs to access its database using an
19 * application's database abstraction layer instead of a PEAR database
20 * connection. Any subclass of Auth_OpenID_DatabaseConnection MUST
21 * adhere to the interface specified here.
25 class Auth_OpenID_DatabaseConnection {
27 * Sets auto-commit mode on this database connection.
29 * @param bool $mode True if auto-commit is to be used; false if
32 function autoCommit($mode)
37 * Run an SQL query with the specified parameters, if any.
39 * @param string $sql An SQL string with placeholders. The
40 * placeholders are assumed to be specific to the database engine
41 * for this connection.
43 * @param array $params An array of parameters to insert into the
44 * SQL string using this connection's escaping mechanism.
46 * @return mixed $result The result of calling this connection's
47 * internal query function. The type of result depends on the
48 * underlying database engine. This method is usually used when
49 * the result of a query is not important, like a DDL query.
51 function query($sql, $params = array())
56 * Starts a transaction on this connection, if supported.
63 * Commits a transaction on this connection, if supported.
70 * Performs a rollback on this connection, if supported.
77 * Run an SQL query and return the first column of the first row
78 * of the result set, if any.
80 * @param string $sql An SQL string with placeholders. The
81 * placeholders are assumed to be specific to the database engine
82 * for this connection.
84 * @param array $params An array of parameters to insert into the
85 * SQL string using this connection's escaping mechanism.
87 * @return mixed $result The value of the first column of the
88 * first row of the result set. False if no such result was
91 function getOne($sql, $params = array())
96 * Run an SQL query and return the first row of the result set, if
99 * @param string $sql An SQL string with placeholders. The
100 * placeholders are assumed to be specific to the database engine
101 * for this connection.
103 * @param array $params An array of parameters to insert into the
104 * SQL string using this connection's escaping mechanism.
106 * @return array $result The first row of the result set, if any,
107 * keyed on column name. False if no such result was found.
109 function getRow($sql, $params = array())
114 * Run an SQL query with the specified parameters, if any.
116 * @param string $sql An SQL string with placeholders. The
117 * placeholders are assumed to be specific to the database engine
118 * for this connection.
120 * @param array $params An array of parameters to insert into the
121 * SQL string using this connection's escaping mechanism.
123 * @return array $result An array of arrays representing the
124 * result of the query; each array is keyed on column name.
126 function getAll($sql, $params = array())