forked from gabordemooij/redbean
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Driver.php
executable file
·150 lines (138 loc) · 4.2 KB
/
Driver.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
/**
* Interface for database drivers
*
* @file RedBean/Driver.php
* @description Describes the API for database classes
* The Driver API conforms to the ADODB pseudo standard
* for database drivers.
* @author Gabor de Mooij
* @license BSD
*
*
* copyright (c) G.J.G.T. (Gabor) de Mooij
* This source file is subject to the BSD/GPLv2 License that is bundled
* with this source code in the file license.txt.
*/
interface RedBean_Driver {
/**
* Runs a query and fetches results as a multi dimensional array.
*
* @param string $sql SQL to be executed
*
* @return array $results result
*/
public function GetAll( $sql, $aValues=array() );
/**
* Runs a query and fetches results as a column.
*
* @param string $sql SQL Code to execute
*
* @return array $results Resultset
*/
public function GetCol( $sql, $aValues=array() );
/**
* Runs a query an returns results as a single cell.
*
* @param string $sql SQL to execute
*
* @return mixed $cellvalue result cell
*/
public function GetCell( $sql, $aValues=array() );
/**
* Runs a query and returns a flat array containing the values of
* one row.
*
* @param string $sql SQL to execute
*
* @return array $row result row
*/
public function GetRow( $sql, $aValues=array() );
/**
* Executes SQL code and allows key-value binding.
* This function allows you to provide an array with values to bind
* to query parameters. For instance you can bind values to question
* marks in the query. Each value in the array corresponds to the
* question mark in the query that matches the position of the value in the
* array. You can also bind values using explicit keys, for instance
* array(":key"=>123) will bind the integer 123 to the key :key in the
* SQL. This method has no return value.
*
* @param string $sql SQL Code to execute
* @param array $aValues Values to bind to SQL query
*
* @return void
*/
public function Execute( $sql, $aValues=array() );
/**
* Escapes a string for use in SQL using the currently selected
* driver driver.
*
* @param string $string string to be escaped
*
* @return string $string escaped string
*/
public function Escape( $str );
/**
* Returns the latest insert ID if driver does support this
* feature.
*
* @return integer $id primary key ID
*/
public function GetInsertID();
/**
* Returns the number of rows affected by the most recent query
* if the currently selected driver driver supports this feature.
*
* @return integer $numOfRows number of rows affected
*/
public function Affected_Rows();
/**
* Toggles debug mode. In debug mode the driver will print all
* SQL to the screen together with some information about the
* results. All SQL code that passes through the driver will be
* passes on to the screen for inspection.
* This method has no return value.
*
* @param boolean $trueFalse turn on/off
*
* @return void
*/
public function setDebugMode( $tf );
/**
* Starts a transaction.
* This method is part of the transaction mechanism of
* RedBeanPHP. All queries in a transaction are executed together.
* In case of an error all commands will be rolled back so none of the
* SQL in the transaction will affect the DB. Using transactions is
* considered best practice.
* This method has no return value.
*
* @return void
*/
public function CommitTrans();
/**
* Commits a transaction.
* This method is part of the transaction mechanism of
* RedBeanPHP. All queries in a transaction are executed together.
* In case of an error all commands will be rolled back so none of the
* SQL in the transaction will affect the DB. Using transactions is
* considered best practice.
* This method has no return value.
*
* @return void
*/
public function StartTrans();
/**
* Rolls back a transaction.
* This method is part of the transaction mechanism of
* RedBeanPHP. All queries in a transaction are executed together.
* In case of an error all commands will be rolled back so none of the
* SQL in the transaction will affect the DB. Using transactions is
* considered best practice.
* This method has no return value.
*
* @return void
*/
public function FailTrans();
}