28 require_once DOL_DOCUMENT_ROOT.
'/core/db/DoliDB.class.php';
41 const LABEL =
'MySQL or MariaDB';
64 if (!empty($conf->db->character_set)) {
65 $this->forcecharset = $conf->db->character_set;
67 if (!empty($conf->db->dolibarr_main_db_collation)) {
68 $this->forcecollate = $conf->db->dolibarr_main_db_collation;
71 $this->database_user = $user;
72 $this->database_host = $host;
73 $this->database_port = $port;
75 $this->transaction_opened = 0;
79 if (!class_exists(
'mysqli')) {
80 $this->connected =
false;
82 $this->
error =
"Mysqli PHP functions for using Mysqli driver are not available in this version of PHP. Try to use another driver.";
83 dol_syslog(get_class($this).
"::DoliDBMysqli : Mysqli PHP functions for using Mysqli driver are not available in this version of PHP. Try to use another driver.", LOG_ERR);
87 $this->connected =
false;
89 $this->
error = $langs->trans(
"ErrorWrongHostParameter");
90 dol_syslog(get_class($this).
"::DoliDBMysqli : Connect error, wrong host parameters", LOG_ERR);
95 $this->db = $this->
connect($host, $user, $pass,
'', $port);
97 if ($this->db && empty($this->db->connect_errno)) {
98 $this->connected =
true;
101 $this->connected =
false;
103 $this->
error = empty($this->db) ?
'Failed to connect' : $this->db->connect_error;
104 dol_syslog(get_class($this).
"::DoliDBMysqli Connect error: ".$this->
error, LOG_ERR);
108 if ($this->connected && $name) {
110 $this->database_selected =
true;
111 $this->database_name = $name;
115 $clientmustbe = empty($conf->db->character_set) ?
'utf8' : $conf->db->character_set;
116 if (preg_match(
'/latin1/', $clientmustbe)) {
117 $clientmustbe =
'utf8';
120 if ($this->db->character_set_name() != $clientmustbe) {
121 $this->db->set_charset($clientmustbe);
123 $collation = $conf->db->dolibarr_main_db_collation;
124 if (preg_match(
'/latin1/', $collation)) {
125 $collation =
'utf8_unicode_ci';
128 if (!preg_match(
'/general/', $collation)) {
129 $this->db->query(
"SET collation_connection = ".$collation);
133 $this->database_selected =
false;
134 $this->database_name =
'';
137 dol_syslog(get_class($this).
"::DoliDBMysqli : Select_db error ".$this->
error, LOG_ERR);
141 $this->database_selected =
false;
143 if ($this->connected) {
145 $clientmustbe = empty($conf->db->character_set) ?
'utf8' : $conf->db->character_set;
146 if (preg_match(
'/latin1/', $clientmustbe)) {
147 $clientmustbe =
'utf8';
149 if (preg_match(
'/utf8mb4/', $clientmustbe)) {
150 $clientmustbe =
'utf8';
153 if ($this->db->character_set_name() != $clientmustbe) {
154 $this->db->set_charset($clientmustbe);
156 $collation = $conf->db->dolibarr_main_db_collation;
157 if (preg_match(
'/latin1/', $collation)) {
158 $collation =
'utf8_unicode_ci';
160 if (preg_match(
'/utf8mb4/', $collation)) {
161 $collation =
'utf8_unicode_ci';
164 if (!preg_match(
'/general/', $collation)) {
165 $this->db->query(
"SET collation_connection = ".$collation);
181 return " FORCE INDEX(".preg_replace(
'/[^a-z0-9_]/',
'', $nameofindex).
")";
208 dol_syslog(get_class($this).
"::select_db database=".$database, LOG_DEBUG);
211 $result = $this->db->select_db($database);
230 public function connect($host, $login, $passwd, $name, $port = 0)
232 dol_syslog(get_class($this).
"::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name", LOG_DEBUG);
241 if (!class_exists(
'mysqli')) {
244 $tmp =
new mysqli($host, $login, $passwd, $name, $port);
246 dol_syslog(get_class($this).
"::connect failed", LOG_DEBUG);
258 return $this->db->server_info;
268 return $this->db->client_info;
281 if ($this->transaction_opened > 0) {
282 dol_syslog(get_class($this).
"::close Closing a connection with an opened transaction depth=".$this->transaction_opened, LOG_ERR);
284 $this->connected =
false;
285 return $this->db->close();
302 public function query($query, $usesavepoint = 0,
$type =
'auto', $result_mode = 0)
304 global $conf, $dolibarr_main_db_readonly;
306 $query = trim($query);
308 if (!in_array($query, array(
'BEGIN',
'COMMIT',
'ROLLBACK'))) {
309 $SYSLOG_SQL_LIMIT = 10000;
310 dol_syslog(
'sql='.substr($query, 0, $SYSLOG_SQL_LIMIT), LOG_DEBUG);
316 if (!empty($dolibarr_main_db_readonly)) {
317 if (preg_match(
'/^(INSERT|UPDATE|REPLACE|DELETE|CREATE|ALTER|TRUNCATE|DROP)/i', $query)) {
318 $this->
lasterror =
'Application in read-only mode';
326 if (!$this->database_name) {
328 $ret = $this->db->query($query, $result_mode);
330 $ret = $this->db->query($query, $result_mode);
333 dol_syslog(get_class($this).
"::query Exception in query instead of returning an error: ".$e->getMessage(), LOG_ERR);
337 if (!preg_match(
"/^COMMIT/i", $query) && !preg_match(
"/^ROLLBACK/i", $query)) {
345 dol_syslog(get_class($this).
"::query SQL Error query: ".$query, LOG_ERR);
347 dol_syslog(get_class($this).
"::query SQL Error message: ".$this->
lasterrno.
" ".$this->lasterror, LOG_ERR);
351 $this->_results = $ret;
368 if (!is_object($resultset)) {
369 $resultset = $this->_results;
371 return $resultset->fetch_object();
386 if (!is_object($resultset)) {
387 $resultset = $this->_results;
389 return $resultset->fetch_array();
403 if (!is_bool($resultset)) {
404 if (!is_object($resultset)) {
405 $resultset = $this->_results;
407 return $resultset->fetch_row();
426 if (!is_object($resultset)) {
427 $resultset = $this->_results;
429 return isset($resultset->num_rows) ? $resultset->num_rows : 0;
444 if (!is_object($resultset)) {
445 $resultset = $this->_results;
449 return $this->db->affected_rows;
459 public function free($resultset =
null)
462 if (!is_object($resultset)) {
463 $resultset = $this->_results;
466 if (is_object($resultset)) {
467 $resultset->free_result();
479 return $this->db->real_escape_string((
string) $stringtoencode);
490 return str_replace(array(
'\\',
'_',
'%'), array(
'\\\\',
'\_',
'\%'), (
string) $stringtoencode);
500 if (!$this->connected) {
502 return 'DB_ERROR_FAILED_TO_CONNECT';
505 $errorcode_map = array(
506 1004 =>
'DB_ERROR_CANNOT_CREATE',
507 1005 =>
'DB_ERROR_CANNOT_CREATE',
508 1006 =>
'DB_ERROR_CANNOT_CREATE',
509 1007 =>
'DB_ERROR_ALREADY_EXISTS',
510 1008 =>
'DB_ERROR_CANNOT_DROP',
511 1022 =>
'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
512 1025 =>
'DB_ERROR_NO_FOREIGN_KEY_TO_DROP',
513 1044 =>
'DB_ERROR_ACCESSDENIED',
514 1046 =>
'DB_ERROR_NODBSELECTED',
515 1048 =>
'DB_ERROR_CONSTRAINT',
516 1050 =>
'DB_ERROR_TABLE_ALREADY_EXISTS',
517 1051 =>
'DB_ERROR_NOSUCHTABLE',
518 1054 =>
'DB_ERROR_NOSUCHFIELD',
519 1060 =>
'DB_ERROR_COLUMN_ALREADY_EXISTS',
520 1061 =>
'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
521 1062 =>
'DB_ERROR_RECORD_ALREADY_EXISTS',
522 1064 =>
'DB_ERROR_SYNTAX',
523 1068 =>
'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS',
524 1075 =>
'DB_ERROR_CANT_DROP_PRIMARY_KEY',
525 1091 =>
'DB_ERROR_NOSUCHFIELD',
526 1100 =>
'DB_ERROR_NOT_LOCKED',
527 1136 =>
'DB_ERROR_VALUE_COUNT_ON_ROW',
528 1146 =>
'DB_ERROR_NOSUCHTABLE',
529 1215 =>
'DB_ERROR_CANNOT_ADD_FOREIGN_KEY_CONSTRAINT',
530 1216 =>
'DB_ERROR_NO_PARENT',
531 1217 =>
'DB_ERROR_CHILD_EXISTS',
532 1396 =>
'DB_ERROR_USER_ALREADY_EXISTS',
533 1451 =>
'DB_ERROR_CHILD_EXISTS',
534 1826 =>
'DB_ERROR_KEY_NAME_ALREADY_EXISTS'
537 if (isset($errorcode_map[$this->db->errno])) {
538 return $errorcode_map[$this->db->errno];
540 $errno = $this->db->errno;
541 return ($errno ?
'DB_ERROR_'.$errno :
'0');
552 if (!$this->connected) {
554 return 'Not connected. Check setup parameters in conf/conf.php file and your mysql client and server versions';
556 return $this->db->error;
571 return $this->db->insert_id;
582 public function encrypt($fieldorvalue, $withQuotes = 1)
587 $cryptType = (!empty($conf->db->dolibarr_main_db_encryption) ? $conf->db->dolibarr_main_db_encryption : 0);
590 $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey) ? $conf->db->dolibarr_main_db_cryptkey :
'');
592 $escapedstringwithquotes = ($withQuotes ?
"'" :
"").$this->
escape($fieldorvalue).($withQuotes ?
"'" :
"");
594 if ($cryptType && !empty($cryptKey)) {
595 if ($cryptType == 2) {
596 $escapedstringwithquotes =
"AES_ENCRYPT(".$escapedstringwithquotes.
", '".$this->
escape($cryptKey).
"')";
597 } elseif ($cryptType == 1) {
598 $escapedstringwithquotes =
"DES_ENCRYPT(".$escapedstringwithquotes.
", '".$this->
escape($cryptKey).
"')";
602 return $escapedstringwithquotes;
616 $cryptType = (!empty($conf->db->dolibarr_main_db_encryption) ? $conf->db->dolibarr_main_db_encryption : 0);
619 $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey) ? $conf->db->dolibarr_main_db_cryptkey :
'');
623 if ($cryptType && !empty($cryptKey)) {
624 if ($cryptType == 2) {
625 $return =
'AES_DECRYPT('.$value.
',\''.$cryptKey.
'\')
';
626 } elseif ($cryptType == 1) {
627 $return = 'DES_DECRYPT(
'.$value.',\
''.$cryptKey.
'\')
';
635 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
641 public function DDLGetConnectId()
644 $resql = $this->query('SELECT CONNECTION_ID()
');
646 $row = $this->fetch_row($resql);
653 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
665 public function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
668 if (empty($charset)) {
669 $charset = $this->forcecharset;
671 if (empty($collation)) {
672 $collation = $this->forcecollate;
675 // ALTER DATABASE dolibarr_db DEFAULT CHARACTER SET latin DEFAULT COLLATE latin1_swedish_ci
676 $sql = "CREATE DATABASE `".$this->escape($database)."`";
677 $sql .= " DEFAULT CHARACTER SET `".$this->escape($charset)."` DEFAULT COLLATE `".$this->escape($collation)."`";
679 dol_syslog($sql, LOG_DEBUG);
680 $ret = $this->query($sql);
682 // We try again for compatibility with Mysql < 4.1.1
683 $sql = "CREATE DATABASE `".$this->escape($database)."`";
684 dol_syslog($sql, LOG_DEBUG);
685 $ret = $this->query($sql);
690 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
698 public function DDLListTables($database, $table = '')
701 $listtables = array();
705 $tmptable = preg_replace('/[^a-z0-9\.\-\_%]/i
', '', $table);
707 $like = "LIKE '".$this->escape($tmptable)."'";
709 $tmpdatabase = preg_replace('/[^a-z0-9\.\-\_]/i
', '', $database);
711 $sql = "SHOW TABLES FROM `".$tmpdatabase."` ".$like.";";
713 $result = $this->query($sql);
715 while ($row = $this->fetch_row($result)) {
716 $listtables[] = $row[0];
722 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
730 public function DDLListTablesFull($database, $table = '')
733 $listtables = array();
737 $tmptable = preg_replace('/[^a-z0-9\.\-\_%]/i
', '', $table);
739 $like = "LIKE '".$this->escape($tmptable)."'";
741 $tmpdatabase = preg_replace('/[^a-z0-9\.\-\_]/i
', '', $database);
743 $sql = "SHOW FULL TABLES FROM `".$tmpdatabase."` ".$like.";";
745 $result = $this->query($sql);
747 while ($row = $this->fetch_row($result)) {
748 $listtables[] = $row;
754 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
761 public function DDLInfoTable($table)
764 $infotables = array();
766 $tmptable = preg_replace('/[^a-z0-9\.\-\_]/i
', '', $table);
768 $sql = "SHOW FULL COLUMNS FROM ".$tmptable.";";
770 dol_syslog($sql, LOG_DEBUG);
771 $result = $this->query($sql);
773 while ($row = $this->fetch_row($result)) {
774 $infotables[] = $row;
780 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
793 public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
796 // FIXME: $fulltext_keys parameter is unused
799 $sqluq = $sqlk = array();
801 // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra
802 // ex. : $fields['rowid'] = array('type'=>'int','value
'=>'11
','null'=>'not
null','extra
'=> 'auto_increment
');
803 $sql = "CREATE TABLE ".$table."(";
805 $sqlfields = array();
806 foreach ($fields as $field_name => $field_desc) {
807 $sqlfields[$i] = $field_name." ";
808 $sqlfields[$i] .= $field_desc['type'];
809 if (preg_match("/^[^\s]/i", $field_desc['value
'])) {
810 $sqlfields[$i] .= "(".$field_desc['value
'].")";
812 if (preg_match("/^[^\s]/i", $field_desc['attribute
'])) {
813 $sqlfields[$i] .= " ".$field_desc['attribute
'];
815 if (preg_match("/^[^\s]/i", $field_desc['default'])) {
816 if ((preg_match("/null/i", $field_desc['default'])) || (preg_match("/CURRENT_TIMESTAMP/i", $field_desc['default']))) {
817 $sqlfields[$i] .= " default ".$field_desc['default'];
819 $sqlfields[$i] .= " default '".$this->escape($field_desc['default'])."'";
822 if (preg_match("/^[^\s]/i", $field_desc['null'])) {
823 $sqlfields[$i] .= " ".$field_desc['null'];
825 if (preg_match("/^[^\s]/i", $field_desc['extra
'])) {
826 $sqlfields[$i] .= " ".$field_desc['extra
'];
830 if ($primary_key != "") {
831 $pk = "primary key(".$primary_key.")";
834 if (is_array($unique_keys)) {
836 foreach ($unique_keys as $key => $value) {
837 $sqluq[$i] = "UNIQUE KEY '".$key."' ('".$this->escape($value)."')";
841 if (is_array($keys)) {
843 foreach ($keys as $key => $value) {
844 $sqlk[$i] = "KEY ".$key." (".$value.")";
848 $sql .= implode(',
', $sqlfields);
849 if ($primary_key != "") {
852 if ($unique_keys != "") {
853 $sql .= ",".implode(',
', $sqluq);
855 if (is_array($keys)) {
856 $sql .= ",".implode(',
', $sqlk);
858 $sql .= ") engine=".$type;
860 if (!$this->query($sql)) {
867 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
874 public function DDLDropTable($table)
877 $tmptable = preg_replace('/[^a-z0-9\.\-\_]/i
', '', $table);
879 $sql = "DROP TABLE ".$tmptable;
881 if (!$this->query($sql)) {
888 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
896 public function DDLDescTable($table, $field = "")
899 $sql = "DESC ".$table." ".$field;
901 dol_syslog(get_class($this)."::DDLDescTable ".$sql, LOG_DEBUG);
902 $this->_results = $this->query($sql);
903 return $this->_results;
906 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
916 public function DDLAddField($table, $field_name, $field_desc, $field_position = "")
919 // cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra
920 // ex. : $field_desc = array('type'=>'int','value
'=>'11
','null'=>'not
null','extra
'=> 'auto_increment
');
921 $sql = "ALTER TABLE ".$table." ADD ".$field_name." ";
922 $sql .= $field_desc['type'];
923 if (preg_match("/^[^\s]/i", $field_desc['value
'])) {
924 if (!in_array($field_desc['type'], array('date
', 'datetime
')) && $field_desc['value
']) {
925 $sql .= "(".$field_desc['value
'].")";
928 if (isset($field_desc['attribute
']) && preg_match("/^[^\s]/i", $field_desc['attribute
'])) {
929 $sql .= " ".$field_desc['attribute
'];
931 if (isset($field_desc['null']) && preg_match("/^[^\s]/i", $field_desc['null'])) {
932 $sql .= " ".$field_desc['null'];
934 if (isset($field_desc['default']) && preg_match("/^[^\s]/i", $field_desc['default'])) {
935 if (preg_match("/null/i", $field_desc['default'])) {
936 $sql .= " default ".$field_desc['default'];
938 $sql .= " default '".$this->escape($field_desc['default'])."'";
941 if (isset($field_desc['extra
']) && preg_match("/^[^\s]/i", $field_desc['extra
'])) {
942 $sql .= " ".$field_desc['extra
'];
944 $sql .= " ".$field_position;
946 dol_syslog(get_class($this)."::DDLAddField ".$sql, LOG_DEBUG);
947 if ($this->query($sql)) {
953 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
962 public function DDLUpdateField($table, $field_name, $field_desc)
965 $sql = "ALTER TABLE ".$table;
966 $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
967 if (in_array($field_desc['type'], array('double', 'tinyint
', 'int', 'varchar
')) && $field_desc['value
']) {
968 $sql .= "(".$field_desc['value
'].")";
970 if ($field_desc['null'] == 'not
null' || $field_desc['null'] == 'NOT NULL
') {
971 // We will try to change format of column to NOT NULL. To be sure the ALTER works, we try to update fields that are NULL
972 if ($field_desc['type'] == 'varchar
' || $field_desc['type'] == 'text
') {
973 $sqlbis = "UPDATE ".$table." SET ".$field_name." = '".$this->escape(isset($field_desc['default']) ? $field_desc['default'] : '')."' WHERE ".$field_name." IS NULL";
974 $this->query($sqlbis);
975 } elseif ($field_desc['type'] == 'tinyint
' || $field_desc['type'] == 'int') {
976 $sqlbis = "UPDATE ".$table." SET ".$field_name." = ".((int) $this->escape(isset($field_desc['default']) ? $field_desc['default'] : 0))." WHERE ".$field_name." IS NULL";
977 $this->query($sqlbis);
983 if (isset($field_desc['default']) && $field_desc['default'] != '') {
984 if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint
' || $field_desc['type'] == 'int') {
985 $sql .= " DEFAULT ".$this->escape($field_desc['default']);
986 } elseif ($field_desc['type'] != 'text
') {
987 $sql .= " DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields
991 dol_syslog(get_class($this)."::DDLUpdateField ".$sql, LOG_DEBUG);
992 if (!$this->query($sql)) {
999 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
1007 public function DDLDropField($table, $field_name)
1010 $tmp_field_name = preg_replace('/[^a-z0-9\.\-\_]/i
', '', $field_name);
1012 $sql = "ALTER TABLE ".$table." DROP COLUMN `".$tmp_field_name."`";
1013 if ($this->query($sql)) {
1016 $this->error = $this->lasterror();
1021 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
1031 public function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
1034 $sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
1035 dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
1036 $resql = $this->query($sql);
1038 if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS
') {
1041 // If user already exists, we continue to set permissions
1042 dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
1046 // Redo with localhost forced (sometimes user is created on %)
1047 $sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."'@'localhost
' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
1048 $resql = $this->query($sql);
1050 $sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."'";
1051 dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
1052 $resql = $this->query($sql);
1054 $this->error = "Connected user not allowed to GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."'";
1058 $sql = "FLUSH Privileges";
1060 dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG);
1061 $resql = $this->query($sql);
1076 public function getDefaultCharacterSetDatabase()
1078 $resql = $this->query('SHOW VARIABLES LIKE \
'character_set_database\'');
1081 return $this->forcecharset;
1084 $tmpval = $liste[
'Value'];
1096 $resql = $this->
query(
'SHOW CHARSET');
1101 $liste[$i][
'charset'] = $obj->Charset;
1102 $liste[$i][
'description'] = $obj->Description;
1105 $this->
free($resql);
1121 $resql = $this->
query(
'SHOW VARIABLES LIKE \'collation_database\'');
1124 return $this->forcecollate;
1127 $tmpval = $liste[
'Value'];
1139 $resql = $this->
query(
'SHOW COLLATION');
1144 $liste[$i][
'collation'] = $obj->Collation;
1147 $this->
free($resql);
1162 $fullpathofdump =
'/pathtomysqldump/mysqldump';
1164 $resql = $this->
query(
'SHOW VARIABLES LIKE \'basedir\'');
1167 $basedir = $liste[
'Value'];
1168 $fullpathofdump = $basedir.(preg_match(
'/\/$/', $basedir) ?
'' :
'/').
'bin/mysqldump';
1170 return $fullpathofdump;
1180 $fullpathofimport =
'/pathtomysql/mysql';
1182 $resql = $this->
query(
'SHOW VARIABLES LIKE \'basedir\'');
1185 $basedir = $liste[
'Value'];
1186 $fullpathofimport = $basedir.(preg_match(
'/\/$/', $basedir) ?
'' :
'/').
'bin/mysql';
1188 return $fullpathofimport;
1201 $sql =
'SHOW VARIABLES';
1203 $sql .=
" LIKE '".$this->escape($filter).
"'";
1208 $result[$obj->Variable_name] = $obj->Value;
1225 $sql =
'SHOW STATUS';
1227 $sql .=
" LIKE '".$this->escape($filter).
"'";
1232 $result[$obj->Variable_name] = $obj->Value;