-
Notifications
You must be signed in to change notification settings - Fork 280
Expand file tree
/
Copy pathDatabaseInterface.php
More file actions
123 lines (111 loc) · 2.85 KB
/
DatabaseInterface.php
File metadata and controls
123 lines (111 loc) · 2.85 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
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
<?php
namespace ezsql;
interface DatabaseInterface
{
/**
* Database configuration methods:
*
* - getDriver();
* - getDsn();
* - getUser();
* - getPassword()
* - getName();
* - getHost();
* - getPort();
* - getCharset();
* - getOptions();
* - getIsFile();
* - getToMssql();
* - getToMysql();
* - getPath();
*---
* - setDriver($args);
* - setDsn($args);
* - setUser($args);
* - setPassword($args);
* - setName($args);
* - setHost($args);
* - setPort($args);
* - setCharset($args);
* - setOptions($args);
* - setIsFile($args);
* - setToMssql($args);
* - setToMysql($args);
* - setPath($args);
*
* @return string|array|bool|object
*/
public function settings();
/**
* Format a mySQL string correctly for safe mySQL insert
* (no matter if magic quotes are on or not)
*
* @param string $str
* @return string
*/
public function escape(string $str);
/**
* Return specific system date syntax
* i.e. Oracle: SYSDATE Mysql: NOW()
*
* @return string
*/
public function sysDate();
/**
* Creates a prepared query, binds the given parameters and returns the result of the executed.
*
* Supplying the the whole query string, and placing '?' within,
* then the same number of arguments in an array.
*
* Example:
* `query_prepared('INSERT INTO unit_test(id, test_key) VALUES(1, ?)', ['test 1']);`
*
* - It will determine arguments type, execute, and return results.
*
* @param string $query
* @param array $param
* @return bool|mixed
*/
public function query_prepared(string $query, ?array $param = null);
/**
* Perform SQL query and try to determine result value.
*
* It should be noted that you can send any type of query to the
* database using this command.
*
* If there are any results generated they will be stored and can be
* accessed by any ezsql function as long as you use a null query.
*
* If there are results returned the function will return `true`.
* if no results the return will be `false`.
*
* @param string $query
* @param bool $use_prepare
* @return bool|mixed
*/
public function query(string $query, bool $use_prepare = false);
/**
* Close the database connection
*/
public function disconnect();
/**
* Get connection handle
*/
public function handle();
/**
* Reset connection handle
*/
public function reset();
/**
* Begin Transaction
*/
public function beginTransaction();
/**
* Commit Transaction
*/
public function commit();
/**
* Rollback Transaction
*/
public function rollback();
}