forked from SugiPHP/Database
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriverInterface.php
More file actions
93 lines (81 loc) · 1.64 KB
/
DriverInterface.php
File metadata and controls
93 lines (81 loc) · 1.64 KB
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
<?php
/**
* @package SugiPHP
* @subpackage Database
* @author Plamen Popov <tzappa@gmail.com>
* @license http://opensource.org/licenses/mit-license.php (MIT License)
*/
namespace SugiPHP\Database;
interface DriverInterface
{
/**
* Establishes a database connection.
*
* @return void
* @throws \SugiPHP\Database\Exception
*/
public function open();
/**
* Closes database connection.
*/
public function close();
/**
* Escapes a string for use as a query parameter.
*
* @param string $param
* @return string
*/
public function escape($param);
/**
* Executes a query.
*
* @param string $sql SQL statement
* @return mixed - FALSE on query failure
*/
public function query($sql);
/**
* Fetches a row.
*
* @param resource handle $res
* @return array
*/
public function fetch($res);
/**
* Returns the number of rows that were changed by the most recent SQL
* statement (INSERT, UPDATE, REPLACE, DELETE)
*
* @return integer
*/
public function affected($res);
/**
* Returns the auto generated id used in the last query.
*
* @return mixed
*/
public function lastId();
/**
* Frees the memory associated with a result.
*
* @param A result set identifier returned by query()
*/
public function free($res);
/**
* Returns last error.
*
* @return string
*/
public function error();
/**
* Return a database handle.
*
* @return object|null
*/
public function getHandle();
/**
* Sets a Database handle
*
* @param mixed $dbHandle
* @throws \SugiPHP\Database\Exception if the dbHandle is illegal
*/
public function setHandle($dbHandle);
}