-
Notifications
You must be signed in to change notification settings - Fork 0
/
kokoroDB.php
112 lines (101 loc) · 2.06 KB
/
kokoroDB.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
<?php
/**
*
*
* @author Israel Barragan C.
* @version 150112
* @since 11-Apr-2014
* @name kokorodb.php
* @url https://github.com/Reedyseth/kokoroDB
*/
include 'kokoroForMysql.php';
include 'kokoroForOracle.php';
abstract class kokoroDB {
private $connection = null;
private $db_user = "root";
private $db_pwd = "1234";
private $db_host = "localhost";
private $db_name = "tutorials";
private $db_port = "";
private $safeTransactions = false;
static function createConnection($dbConnection) {
if ($dbConnection == "mysql") {
// create mysql object.
return new kokoroForMysql();
}
else if ($dbConnection == "oracle") {
// create mysql object.
return new kokoroForOracle();
} else {
if (empty($dbConnection)) {
throw new Exception("Unsupport Connection. You need to provide a connection type", 1001);
} else {
throw new Exception("Unsupport Connection type", 1002);
}
}
}
/**
* Gets the value of connection.
*
* @return mixed
*/
public function getConnection()
{
return $this->connection;
}
/**
* Gets the value of db_user.
*
* @return mixed
*/
public function getDB_user()
{
return $this->db_user;
}
/**
* Gets the value of db_pwd.
*
* @return mixed
*/
public function getDB_pwd()
{
return $this->db_pwd;
}
/**
* Gets the value of db_host.
*
* @return mixed
*/
public function getDB_host()
{
return $this->db_host;
}
/**
* Gets the value of db_name.
*
* @return mixed
*/
public function getDB_name()
{
return $this->db_name;
}
/**
* Gets the value of db_port.
*
* @return mixed
*/
public function getDB_port()
{
return $this->db_port;
}
/**
* Gets the value of safeTransactions.
*
* @return mixed
*/
public function getSafeTransactions()
{
return $this->safeTransactions;
}
}
?>