31 public function __construct($dbType, $dbServer, $dbPort, $dbName, $dbUser, $dbPass) {
32 $this->_dbType = $dbType;
33 $this->_dbServer = $dbServer;
34 $this->_dbPort = $dbPort;
35 $this->_dbName = $dbName;
36 $this->_dbUser = $dbUser;
37 $this->_dbPass = $dbPass;
38 $this->_setConnection();
46 return $this->_connection;
53 $this->_connection = mysqli_connect($this->_dbServer, $this->_dbUser, $this->_dbPass, $this->_dbName);
54 if ($this->_connection) {
55 $this->_selectDatabase();
57 $this->_connection =
false;
65 mysqli_select_db($this->_connection, $this->_dbName);
73 if ($this->_connection) {
74 mysqli_close($this->_connection);
75 $this->_connection = null;
84 if ($this->_connection) {
85 return mysqli_ping($this->_connection);
96 if ($this->_connection && $query) {
97 return mysqli_query($this->_connection, $query);
107 if ($this->_connection) {
108 return mysqli_insert_id($this->_connection);
118 return intval(mysqli_affected_rows($this->_connection));
129 private function _Fetch($result, $result_type) {
131 return mysqli_fetch_array($result, $result_type);
144 return $this->_Fetch($result, MYSQLI_ASSOC);
155 return $this->_Fetch($result, MYSQLI_NUM);
164 return mysqli_real_escape_string($this->_connection, $text);
173 if (!$text || $text ==
'') {
176 if (strpos($text,
":") ===
false) {
177 return "'" . date(
"Y-m-d", Utils::GetTimestamp($text)) .
"'";
179 return "'" . date(
"Y-m-d H:i:s", Utils::GetTimestamp($text)) .
"'";
188 if ($this->_connection && $query) {
189 $res = $this->Query($query);
190 $row = $this->FetchAssoc($res);
203 if ($this->_connection) {
204 return mysqli_begin_transaction($this->_connection);
214 if ($this->_connection) {
215 return mysqli_commit($this->_connection);
225 if ($this->_connection) {
226 return mysqli_rollback($this->_connection);
236 return mysqli_error($this->_connection);
244 return mysqli_errno($this->_connection);
__construct($dbType, $dbServer, $dbPort, $dbName, $dbUser, $dbPass)