1<?php
2
3/**
4 * The Auth_OpenID_DatabaseConnection class, which is used to emulate
5 * a PEAR database connection.
6 *
7 * @package OpenID
8 * @author JanRain, Inc. <openid@janrain.com>
9 * @copyright 2005-2008 Janrain, Inc.
10 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache
11 */
12
13/**
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.
22 *
23 * @package OpenID
24 */
25class Auth_OpenID_DatabaseConnection {
26    /**
27     * Sets auto-commit mode on this database connection.
28     *
29     * @param bool $mode True if auto-commit is to be used; false if
30     * not.
31     */
32    function autoCommit($mode)
33    {
34    }
35
36    /**
37     * Run an SQL query with the specified parameters, if any.
38     *
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.
42     *
43     * @param array $params An array of parameters to insert into the
44     * SQL string using this connection's escaping mechanism.
45     *
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.
50     */
51    function query($sql, $params = array())
52    {
53    }
54
55    /**
56     * Starts a transaction on this connection, if supported.
57     */
58    function begin()
59    {
60    }
61
62    /**
63     * Commits a transaction on this connection, if supported.
64     */
65    function commit()
66    {
67    }
68
69    /**
70     * Performs a rollback on this connection, if supported.
71     */
72    function rollback()
73    {
74    }
75
76    /**
77     * Run an SQL query and return the first column of the first row
78     * of the result set, if any.
79     *
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.
83     *
84     * @param array $params An array of parameters to insert into the
85     * SQL string using this connection's escaping mechanism.
86     *
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
89     * found.
90     */
91    function getOne($sql, $params = array())
92    {
93    }
94
95    /**
96     * Run an SQL query and return the first row of the result set, if
97     * any.
98     *
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.
102     *
103     * @param array $params An array of parameters to insert into the
104     * SQL string using this connection's escaping mechanism.
105     *
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.
108     */
109    function getRow($sql, $params = array())
110    {
111    }
112
113    /**
114     * Run an SQL query with the specified parameters, if any.
115     *
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.
119     *
120     * @param array $params An array of parameters to insert into the
121     * SQL string using this connection's escaping mechanism.
122     *
123     * @return array $result An array of arrays representing the
124     * result of the query; each array is keyed on column name.
125     */
126    function getAll($sql, $params = array())
127    {
128    }
129}
130
131