6 * Interface for database drivers.
7 * The Driver API conforms to the ADODB pseudo standard
8 * for database drivers.
10 * @file RedBeanPHP/Driver.php
11 * @author Gabor de Mooij and the RedBeanPHP Community
15 * copyright (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community
16 * This source file is subject to the BSD/GPLv2 License that is bundled
17 * with this source code in the file license.txt.
22 * Runs a query and fetches results as a multi dimensional array.
24 * @param string $sql SQL query to execute
25 * @param array $bindings list of values to bind to SQL snippet
29 public function GetAll( $sql, $bindings = array() );
32 * Runs a query and fetches results as a column.
34 * @param string $sql SQL query to execute
35 * @param array $bindings list of values to bind to SQL snippet
39 public function GetCol( $sql, $bindings = array() );
42 * Runs a query and returns results as a single cell.
44 * @param string $sql SQL query to execute
45 * @param array $bindings list of values to bind to SQL snippet
49 public function GetOne( $sql, $bindings = array() );
52 * Runs a query and returns results as an associative array
53 * indexed by the first column.
55 * @param string $sql SQL query to execute
56 * @param array $bindings list of values to bind to SQL snippet
60 public function GetAssocRow( $sql, $bindings = array() );
63 * Runs a query and returns a flat array containing the values of
66 * @param string $sql SQL query to execute
67 * @param array $bindings list of values to bind to SQL snippet
71 public function GetRow( $sql, $bindings = array() );
74 * Executes SQL code and allows key-value binding.
75 * This function allows you to provide an array with values to bind
76 * to query parameters. For instance you can bind values to question
77 * marks in the query. Each value in the array corresponds to the
78 * question mark in the query that matches the position of the value in the
79 * array. You can also bind values using explicit keys, for instance
80 * array(":key"=>123) will bind the integer 123 to the key :key in the
81 * SQL. This method has no return value.
83 * @param string $sql SQL query to execute
84 * @param array $bindings list of values to bind to SQL snippet
86 * @return array Affected Rows
88 public function Execute( $sql, $bindings = array() );
91 * Returns the latest insert ID if driver does support this
96 public function GetInsertID();
99 * Returns the number of rows affected by the most recent query
100 * if the currently selected driver driver supports this feature.
104 public function Affected_Rows();
107 * Returns a cursor-like object from the database.
109 * @param string $sql SQL query to execute
110 * @param array $bindings list of values to bind to SQL snippet
114 public function GetCursor( $sql, $bindings = array() );
117 * Toggles debug mode. In debug mode the driver will print all
118 * SQL to the screen together with some information about the
119 * results. All SQL code that passes through the driver will be
120 * passes on to the screen for inspection.
121 * This method has no return value.
123 * @param boolean $tf TRUE = debug mode ON
124 * @param Logger $customLogger
128 public function setDebugMode( $tf, $customLogger );
131 * Starts a transaction.
135 public function CommitTrans();
138 * Commits a transaction.
142 public function StartTrans();
145 * Rolls back a transaction.
149 public function FailTrans();
152 * Resets the internal Query Counter.
156 public function resetCounter();
159 * Returns the number of SQL queries processed.
163 public function getQueryCount();