24 require_once DOL_DOCUMENT_ROOT.
'/core/db/DoliDB.class.php';
48 protected $startMemory;
70 $this->
type = $this->db->type;
71 $this->queries = array();
82 public function ifsql($test, $resok, $resko)
84 return $this->db->ifsql($test, $resok, $resko);
97 return $this->db->fetch_row($resultset);
108 public function idate($param, $gm =
'tzserver')
110 return $this->db->idate($param, $gm);
120 return $this->db->lasterrno();
129 public function begin($textinlog =
'')
131 return $this->db->begin($textinlog);
145 public function DDLCreateDb($database, $charset =
'', $collation =
'', $owner =
'')
147 return $this->db->DDLCreateDb($database, $charset, $collation, $owner);
157 return $this->db->getVersionArray();
169 return $this->db->convertSQLFromMysql($line);
183 return $this->db->affected_rows($resultset);
193 return $this->db->error();
205 return $this->db->DDLListTables($database, $table);
217 return $this->db->DDLListTablesFull($database, $table);
227 return $this->db->lastquery();
237 public function order($sortfield =
null, $sortorder =
null)
239 return $this->db->order($sortfield, $sortorder);
250 return $this->db->decrypt($value);
263 return $this->db->fetch_array($resultset);
273 return $this->db->lasterror();
284 return $this->db->escape($stringtoencode);
295 return str_replace(array(
'_',
'\\',
'%'), array(
'\_',
'\\\\',
'\%'), (
string) $stringtoencode);
309 return $this->db->last_insert_id($tab, $fieldid);
319 return $this->db->getPathOfRestore();
330 return $this->db->rollback($log);
343 public function query($query, $usesavepoint = 0, $type =
'auto', $result_mode = 0)
347 $resql = $this->db->query($query, $usesavepoint, $type, $result_mode);
361 $this->startTime = microtime(
true);
362 $this->startMemory = memory_get_usage(
true);
374 $endTime = microtime(
true);
375 $duration = $endTime - $this->startTime;
376 $endMemory = memory_get_usage(
true);
377 $memoryDelta = $endMemory - $this->startMemory;
379 $this->queries[] = array(
381 'duration' => $duration,
382 'memory_usage' => $memoryDelta,
383 'is_success' => $resql ?
true :
false,
384 'error_code' => $resql ?
null : $this->db->lasterrno(),
385 'error_message' => $resql ?
null : $this->db->lasterror()
400 public function connect($host, $login, $passwd, $name, $port = 0)
402 return $this->db->connect($host, $login, $passwd, $name, $port);
412 public function plimit($limit = 0, $offset = 0)
414 return $this->db->plimit($limit, $offset);
425 return $this->db->getServerParametersValues($filter);
436 return $this->db->getServerStatusValues($filter);
446 return $this->db->getDefaultCollationDatabase();
460 return $this->db->num_rows($resultset);
470 return $this->db->getPathOfDump();
480 return $this->db->getDriverInfo();
490 return $this->db->errno();
505 public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys =
null, $fulltext_keys =
null, $keys =
null)
507 return $this->db->DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys, $fulltext_keys, $keys);
518 return $this->db->DDLDropTable($table);
528 return $this->db->getListOfCharacterSet();
540 public function DDLAddField($table, $field_name, $field_desc, $field_position =
"")
542 return $this->db->DDLAddField($table, $field_name, $field_desc, $field_position);
554 return $this->db->DDLDropField($table, $field_name);
567 return $this->db->DDLUpdateField($table, $field_name, $field_desc);
577 return $this->db->getListOfCollation();
589 return $this->db->DDLDescTable($table, $field);
599 return $this->db->getVersion();
609 return $this->db->getDefaultCharacterSetDatabase();
621 public function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
623 return $this->db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
636 public function jdate($string, $gm =
false)
639 return $this->db->jdate($string, $gm);
650 public function encrypt($fieldorvalue, $withQuotes = 1)
652 return $this->db->encrypt($fieldorvalue, $withQuotes);
663 return $this->db->commit($log);
674 return $this->db->DDLInfoTable($table);
683 public function free($resultset =
null)
685 $this->db->free($resultset);
696 return $this->db->close();
706 return $this->db->lastqueryerror();
716 return $this->db->DDLGetConnectId();
729 return $this->db->fetch_object($resultset);
742 return $this->db->select_db($database);