-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dataface.php
102 lines (85 loc) · 1.77 KB
/
Dataface.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
<?php
/**
* Created by PhpStorm.
* User: samir
* Date: 11/29/16
* Time: 6:48 PM
*/
/**
* Class Dataface
* @package Dataface
*/
abstract class Dataface
{
//NOTE Private Variables
/**
* @var string
*/
protected $host;
/**
* @var string
*/
protected $port;
/**
* @var string
*/
protected $username;
/**
* @var string
*/
protected $password;
/**
* @var string
*/
protected $dbName;
//NOTE Public Functions: Properties Getter/Setter
public function __get($name)
{
switch ($name) {
case "host":
return $this->host;
break;
case "port":
return $this->port;
break;
case "username":
return $this->username;
break;
case "password":
return $this->password;
break;
case "dbName":
return $this->dbName;
break;
}
}
public function __set($name, $value)
{
switch ($name) {
case "host":
$this->host = $value;
break;
case "port":
$this->port = $value;
break;
case "username":
$this->username = $value;
break;
case "password":
$this->password = $value;
break;
case "dbName":
$this->dbName = $value;
break;
}
$this->recconnect();
}
//NOTE Public Functions: Actions
public abstract function insert($table, array $fields = [], $returnRow = false);
public abstract function select($table, array $conditions = [], array $sort = [], $offset = 0, $limit = -1);
public abstract function selectDistinct($table, array $conditions = [], array $fields = [], array $sort = [], $offset = 0, $limit = -1);
public abstract function delete($table, array $conditions = []);
public abstract function update($table, array $conditions = [], array $fields = []);
public abstract function count($table, array $query = []);
protected abstract function reconnect();
}