28 require_once DOL_DOCUMENT_ROOT.
'/core/db/DoliDB.class.php';
40 const LABEL =
'MySQL or MariaDB';
62 if (!empty($conf->db->character_set)) $this->forcecharset = $conf->db->character_set;
63 if (!empty($conf->db->dolibarr_main_db_collation)) $this->forcecollate = $conf->db->dolibarr_main_db_collation;
65 $this->database_user = $user;
66 $this->database_host = $host;
67 $this->database_port = $port;
69 $this->transaction_opened = 0;
73 if (!class_exists(
'mysqli'))
75 $this->connected =
false;
77 $this->
error =
"Mysqli PHP functions for using Mysqli driver are not available in this version of PHP. Try to use another driver.";
78 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);
83 $this->connected =
false;
85 $this->
error = $langs->trans(
"ErrorWrongHostParameter");
86 dol_syslog(get_class($this).
"::DoliDBMysqli : Connect error, wrong host parameters", LOG_ERR);
91 $this->
db = $this->
connect($host, $user, $pass,
'', $port);
93 if ($this->
db->connect_errno) {
94 $this->connected =
false;
96 $this->
error = $this->
db->connect_error;
97 dol_syslog(get_class($this).
"::DoliDBMysqli Connect error: ".$this->
error, LOG_ERR);
99 $this->connected =
true;
104 if ($this->connected && $name)
108 $this->database_selected =
true;
109 $this->database_name = $name;
113 $clientmustbe = empty($conf->db->dolibarr_main_db_character_set) ?
'utf8' : $conf->db->dolibarr_main_db_character_set;
114 if (preg_match(
'/latin1/', $clientmustbe)) $clientmustbe =
'utf8';
116 if ($this->
db->character_set_name() != $clientmustbe) {
117 $this->
db->set_charset($clientmustbe);
119 $collation = $conf->db->dolibarr_main_db_collation;
120 if (preg_match(
'/latin1/', $collation)) $collation =
'utf8_unicode_ci';
122 if (!preg_match(
'/general/', $collation)) $this->
db->query(
"SET collation_connection = ".$collation);
125 $this->database_selected =
false;
126 $this->database_name =
'';
129 dol_syslog(get_class($this).
"::DoliDBMysqli : Select_db error ".$this->
error, LOG_ERR);
133 $this->database_selected =
false;
135 if ($this->connected)
138 $clientmustbe = empty($conf->db->dolibarr_main_db_character_set) ?
'utf8' : $conf->db->dolibarr_main_db_character_set;
139 if (preg_match(
'/latin1/', $clientmustbe)) $clientmustbe =
'utf8';
140 if (preg_match(
'/utf8mb4/', $clientmustbe)) $clientmustbe =
'utf8';
142 if ($this->
db->character_set_name() != $clientmustbe) {
143 $this->
db->set_charset($clientmustbe);
145 $collation = $conf->db->dolibarr_main_db_collation;
146 if (preg_match(
'/latin1/', $collation)) $collation =
'utf8_unicode_ci';
147 if (preg_match(
'/utf8mb4/', $collation)) $collation =
'utf8_unicode_ci';
149 if (!preg_match(
'/general/', $collation)) $this->
db->query(
"SET collation_connection = ".$collation);
178 dol_syslog(get_class($this).
"::select_db database=".$database, LOG_DEBUG);
179 return $this->
db->select_db($database);
194 public function connect($host, $login, $passwd, $name, $port = 0)
196 dol_syslog(get_class($this).
"::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name", LOG_DEBUG);
201 return new mysqli($host, $login, $passwd, $name, $port);
211 return $this->
db->server_info;
221 return $this->
db->client_info;
235 if ($this->transaction_opened > 0)
dol_syslog(get_class($this).
"::close Closing a connection with an opened transaction depth=".$this->transaction_opened, LOG_ERR);
236 $this->connected =
false;
237 return $this->
db->close();
251 public function query($query, $usesavepoint = 0,
$type =
'auto')
255 $query = trim($query);
257 if (!in_array($query, array(
'BEGIN',
'COMMIT',
'ROLLBACK')))
259 $SYSLOG_SQL_LIMIT = 10000;
260 dol_syslog(
'sql='.substr($query, 0, $SYSLOG_SQL_LIMIT), LOG_DEBUG);
262 if (empty($query))
return false;
264 if (!$this->database_name)
267 $ret = $this->
db->query($query);
269 $ret = $this->
db->query($query);
272 if (!preg_match(
"/^COMMIT/i", $query) && !preg_match(
"/^ROLLBACK/i", $query))
281 if ($conf->global->SYSLOG_LEVEL < LOG_DEBUG)
dol_syslog(get_class($this).
"::query SQL Error query: ".$query, LOG_ERR);
282 dol_syslog(get_class($this).
"::query SQL Error message: ".$this->
lasterrno.
" ".$this->lasterror, LOG_ERR);
286 $this->_results = $ret;
303 if (!is_object($resultset)) { $resultset = $this->_results; }
304 return $resultset->fetch_object();
319 if (!is_object($resultset)) { $resultset = $this->_results; }
320 return $resultset->fetch_array();
334 if (!is_bool($resultset))
336 if (!is_object($resultset)) { $resultset = $this->_results; }
337 return $resultset->fetch_row();
356 if (!is_object($resultset)) { $resultset = $this->_results; }
357 return $resultset->num_rows;
372 if (!is_object($resultset)) { $resultset = $this->_results; }
375 return $this->
db->affected_rows;
385 public function free($resultset = null)
388 if (!is_object($resultset)) { $resultset = $this->_results; }
390 if (is_object($resultset)) $resultset->free_result();
401 return $this->
db->real_escape_string($stringtoencode);
411 if (!$this->connected) {
413 return 'DB_ERROR_FAILED_TO_CONNECT';
416 $errorcode_map = array(
417 1004 =>
'DB_ERROR_CANNOT_CREATE',
418 1005 =>
'DB_ERROR_CANNOT_CREATE',
419 1006 =>
'DB_ERROR_CANNOT_CREATE',
420 1007 =>
'DB_ERROR_ALREADY_EXISTS',
421 1008 =>
'DB_ERROR_CANNOT_DROP',
422 1022 =>
'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
423 1025 =>
'DB_ERROR_NO_FOREIGN_KEY_TO_DROP',
424 1044 =>
'DB_ERROR_ACCESSDENIED',
425 1046 =>
'DB_ERROR_NODBSELECTED',
426 1048 =>
'DB_ERROR_CONSTRAINT',
427 1050 =>
'DB_ERROR_TABLE_ALREADY_EXISTS',
428 1051 =>
'DB_ERROR_NOSUCHTABLE',
429 1054 =>
'DB_ERROR_NOSUCHFIELD',
430 1060 =>
'DB_ERROR_COLUMN_ALREADY_EXISTS',
431 1061 =>
'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
432 1062 =>
'DB_ERROR_RECORD_ALREADY_EXISTS',
433 1064 =>
'DB_ERROR_SYNTAX',
434 1068 =>
'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS',
435 1075 =>
'DB_ERROR_CANT_DROP_PRIMARY_KEY',
436 1091 =>
'DB_ERROR_NOSUCHFIELD',
437 1100 =>
'DB_ERROR_NOT_LOCKED',
438 1136 =>
'DB_ERROR_VALUE_COUNT_ON_ROW',
439 1146 =>
'DB_ERROR_NOSUCHTABLE',
440 1215 =>
'DB_ERROR_CANNOT_ADD_FOREIGN_KEY_CONSTRAINT',
441 1216 =>
'DB_ERROR_NO_PARENT',
442 1217 =>
'DB_ERROR_CHILD_EXISTS',
443 1396 =>
'DB_ERROR_USER_ALREADY_EXISTS',
444 1451 =>
'DB_ERROR_CHILD_EXISTS',
445 1826 =>
'DB_ERROR_KEY_NAME_ALREADY_EXISTS'
448 if (isset($errorcode_map[$this->
db->errno])) {
449 return $errorcode_map[$this->
db->errno];
451 $errno = $this->
db->errno;
452 return ($errno ?
'DB_ERROR_'.$errno :
'0');
463 if (!$this->connected) {
465 return 'Not connected. Check setup parameters in conf/conf.php file and your mysql client and server versions';
467 return $this->
db->error;
482 return $this->
db->insert_id;
494 public function encrypt($fieldorvalue, $withQuotes = 0)
499 $cryptType = (!empty($conf->db->dolibarr_main_db_encryption) ? $conf->db->dolibarr_main_db_encryption : 0);
502 $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey) ? $conf->db->dolibarr_main_db_cryptkey :
'');
504 $return = ($withQuotes ?
"'" :
"").$this->
escape($fieldorvalue).($withQuotes ?
"'" :
"");
506 if ($cryptType && !empty($cryptKey))
510 $return =
'AES_ENCRYPT('.$return.
',\''.$cryptKey.
'\')
';
511 } elseif ($cryptType == 1)
513 $return = 'DES_ENCRYPT(
'.$return.',\
''.$cryptKey.
'\')
';
526 public function decrypt($value)
530 // Type of encryption (2: AES (recommended), 1: DES , 0: no encryption)
531 $cryptType = (!empty($conf->db->dolibarr_main_db_encryption) ? $conf->db->dolibarr_main_db_encryption : 0);
534 $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey) ? $conf->db->dolibarr_main_db_cryptkey : '');
538 if ($cryptType && !empty($cryptKey))
542 $return = 'AES_DECRYPT(
'.$value.',\
''.$cryptKey.
'\')
';
543 } elseif ($cryptType == 1)
545 $return = 'DES_DECRYPT(
'.$value.',\
''.$cryptKey.
'\')
';
553 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
559 public function DDLGetConnectId()
562 $resql = $this->query('SELECT CONNECTION_ID()
');
565 $row = $this->fetch_row($resql);
570 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
582 public function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
585 if (empty($charset)) $charset = $this->forcecharset;
586 if (empty($collation)) $collation = $this->forcecollate;
588 // ALTER DATABASE dolibarr_db DEFAULT CHARACTER SET latin DEFAULT COLLATE latin1_swedish_ci
589 $sql = "CREATE DATABASE `".$this->escape($database)."`";
590 $sql .= " DEFAULT CHARACTER SET `".$this->escape($charset)."` DEFAULT COLLATE `".$this->escape($collation)."`";
592 dol_syslog($sql, LOG_DEBUG);
593 $ret = $this->query($sql);
596 // We try again for compatibility with Mysql < 4.1.1
597 $sql = "CREATE DATABASE `".$this->escape($database)."`";
598 dol_syslog($sql, LOG_DEBUG);
599 $ret = $this->query($sql);
604 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
612 public function DDLListTables($database, $table = '')
615 $listtables = array();
618 if ($table) $like = "LIKE '".$table."'";
619 $sql = "SHOW TABLES FROM ".$database." ".$like.";";
621 $result = $this->query($sql);
624 while ($row = $this->fetch_row($result))
626 $listtables[] = $row[0];
632 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
639 public function DDLInfoTable($table)
642 $infotables = array();
644 $sql = "SHOW FULL COLUMNS FROM ".$table.";";
646 dol_syslog($sql, LOG_DEBUG);
647 $result = $this->query($sql);
650 while ($row = $this->fetch_row($result))
652 $infotables[] = $row;
658 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
671 public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
674 // FIXME: $fulltext_keys parameter is unused
676 // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra
677 // ex. : $fields['rowid'] = array('type'=>'int','value
'=>'11
','null
'=>'not null
','extra
'=> 'auto_increment
');
678 $sql = "CREATE TABLE ".$table."(";
680 $sqlfields = array();
681 foreach ($fields as $field_name => $field_desc)
683 $sqlfields[$i] = $field_name." ";
684 $sqlfields[$i] .= $field_desc['type'];
685 if (preg_match("/^[^\s]/i", $field_desc['value
'])) {
686 $sqlfields[$i] .= "(".$field_desc['value
'].")";
688 if (preg_match("/^[^\s]/i", $field_desc['attribute
'])) {
689 $sqlfields[$i] .= " ".$field_desc['attribute
'];
691 if (preg_match("/^[^\s]/i", $field_desc['default']))
693 if ((preg_match("/null/i", $field_desc['default'])) || (preg_match("/CURRENT_TIMESTAMP/i", $field_desc['default']))) {
694 $sqlfields[$i] .= " default ".$field_desc['default'];
696 $sqlfields[$i] .= " default '".$this->escape($field_desc['default'])."'";
699 if (preg_match("/^[^\s]/i", $field_desc['null
'])) {
700 $sqlfields[$i] .= " ".$field_desc['null
'];
702 if (preg_match("/^[^\s]/i", $field_desc['extra
'])) {
703 $sqlfields[$i] .= " ".$field_desc['extra
'];
707 if ($primary_key != "")
708 $pk = "primary key(".$primary_key.")";
710 if (is_array($unique_keys)) {
712 foreach ($unique_keys as $key => $value)
714 $sqluq[$i] = "UNIQUE KEY '".$key."' ('".$this->escape($value)."')";
721 foreach ($keys as $key => $value)
723 $sqlk[$i] = "KEY ".$key." (".$value.")";
727 $sql .= implode(',
', $sqlfields);
728 if ($primary_key != "")
730 if ($unique_keys != "")
731 $sql .= ",".implode(',
', $sqluq);
733 $sql .= ",".implode(',
', $sqlk);
734 $sql .= ") engine=".$type;
736 if (!$this->query($sql))
741 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
748 public function DDLDropTable($table)
751 $sql = "DROP TABLE ".$table;
753 if (!$this->query($sql))
758 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
766 public function DDLDescTable($table, $field = "")
769 $sql = "DESC ".$table." ".$field;
771 dol_syslog(get_class($this)."::DDLDescTable ".$sql, LOG_DEBUG);
772 $this->_results = $this->query($sql);
773 return $this->_results;
776 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
786 public function DDLAddField($table, $field_name, $field_desc, $field_position = "")
789 // cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra
790 // ex. : $field_desc = array('type'=>'int','value
'=>'11
','null
'=>'not null
','extra
'=> 'auto_increment
');
791 $sql = "ALTER TABLE ".$table." ADD ".$field_name." ";
792 $sql .= $field_desc['type'];
793 if (preg_match("/^[^\s]/i", $field_desc['value
']))
795 if (!in_array($field_desc['type'], array('date
', 'datetime
')) && $field_desc['value
'])
797 $sql .= "(".$field_desc['value
'].")";
800 if (isset($field_desc['attribute
']) && preg_match("/^[^\s]/i", $field_desc['attribute
']))
802 $sql .= " ".$field_desc['attribute
'];
804 if (isset($field_desc['null
']) && preg_match("/^[^\s]/i", $field_desc['null
']))
806 $sql .= " ".$field_desc['null
'];
808 if (isset($field_desc['default']) && preg_match("/^[^\s]/i", $field_desc['default']))
810 if (preg_match("/null/i", $field_desc['default']))
811 $sql .= " default ".$field_desc['default'];
812 else $sql .= " default '".$this->escape($field_desc['default'])."'";
814 if (isset($field_desc['extra
']) && preg_match("/^[^\s]/i", $field_desc['extra
']))
816 $sql .= " ".$field_desc['extra
'];
818 $sql .= " ".$field_position;
820 dol_syslog(get_class($this)."::DDLAddField ".$sql, LOG_DEBUG);
821 if ($this->query($sql)) {
827 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
836 public function DDLUpdateField($table, $field_name, $field_desc)
839 $sql = "ALTER TABLE ".$table;
840 $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
841 if (in_array($field_desc['type'], array('double', 'tinyint
', 'int', 'varchar
')) && $field_desc['value
']) {
842 $sql .= "(".$field_desc['value
'].")";
844 if ($field_desc['null
'] == 'not null
' || $field_desc['null
'] == 'NOT NULL
')
846 // 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
847 if ($field_desc['type'] == 'varchar
' || $field_desc['type'] == 'text
')
849 $sqlbis = "UPDATE ".$table." SET ".$field_name." = '".$this->escape($field_desc['default'] ? $field_desc['default'] : '')."' WHERE ".$field_name." IS NULL";
850 $this->query($sqlbis);
851 } elseif ($field_desc['type'] == 'tinyint
' || $field_desc['type'] == 'int')
853 $sqlbis = "UPDATE ".$table." SET ".$field_name." = ".((int) $this->escape($field_desc['default'] ? $field_desc['default'] : 0))." WHERE ".$field_name." IS NULL";
854 $this->query($sqlbis);
860 if ($field_desc['default'] != '')
862 if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint
' || $field_desc['type'] == 'int') $sql .= " DEFAULT ".$this->escape($field_desc['default']);
863 elseif ($field_desc['type'] != 'text
') $sql .= " DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields
866 dol_syslog(get_class($this)."::DDLUpdateField ".$sql, LOG_DEBUG);
867 if (!$this->query($sql))
872 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
880 public function DDLDropField($table, $field_name)
883 $sql = "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`";
884 dol_syslog(get_class($this)."::DDLDropField ".$sql, LOG_DEBUG);
885 if ($this->query($sql)) {
888 $this->error = $this->lasterror();
893 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
903 public function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
906 $sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."'";
907 dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
908 $resql = $this->query($sql);
911 if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS
')
915 // If user already exists, we continue to set permissions
916 dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
920 // Redo with localhost forced (sometimes user is created on %)
921 $sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."'@'localhost
'";
922 $resql = $this->query($sql);
924 $sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
925 dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
926 $resql = $this->query($sql);
929 $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)."' IDENTIFIED BY '*****
'";
933 $sql = "FLUSH Privileges";
935 dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG);
936 $resql = $this->query($sql);
952 public function getDefaultCharacterSetDatabase()
954 $resql = $this->query('SHOW VARIABLES LIKE \
'character_set_database\'');
958 return $this->forcecharset;
961 $tmpval = $liste[
'Value'];
980 $liste[$i][
'charset'] = $obj->Charset;
981 $liste[$i][
'description'] = $obj->Description;
1000 $resql = $this->
query(
'SHOW VARIABLES LIKE \'collation_database\'');
1004 return $this->forcecollate;
1007 $tmpval = $liste[
'Value'];
1026 $liste[$i][
'collation'] = $obj->Collation;
1044 $fullpathofdump =
'/pathtomysqldump/mysqldump';
1046 $resql = $this->
query(
'SHOW VARIABLES LIKE \'basedir\'');
1050 $basedir = $liste[
'Value'];
1051 $fullpathofdump = $basedir.(preg_match(
'/\/$/', $basedir) ?
'' :
'/').
'bin/mysqldump';
1053 return $fullpathofdump;
1063 $fullpathofimport =
'/pathtomysql/mysql';
1065 $resql = $this->
query(
'SHOW VARIABLES LIKE \'basedir\'');
1069 $basedir = $liste[
'Value'];
1070 $fullpathofimport = $basedir.(preg_match(
'/\/$/', $basedir) ?
'' :
'/').
'bin/mysql';
1072 return $fullpathofimport;
1085 $sql =
'SHOW VARIABLES';
1086 if ($filter) $sql .=
" LIKE '".$this->escape($filter).
"'";
1090 while ($obj = $this->
fetch_object(
$resql)) $result[$obj->Variable_name] = $obj->Value;
1106 $sql =
'SHOW STATUS';
1107 if ($filter) $sql .=
" LIKE '".$this->escape($filter).
"'";
1111 while ($obj = $this->
fetch_object(
$resql)) $result[$obj->Variable_name] = $obj->Value;
getPathOfRestore()
Return full path of restore program.
lastqueryerror()
Return last query in error.
getListOfCharacterSet()
Return list of available charset that can be used to store data in database.
escape($stringtoencode)
Escape a string to insert data.
lastquery()
Return last request executed with query()
fetch_row($resultset)
Return datas as an array.
getPathOfDump()
Return full path of dump program.
select_db($database)
Select a database.
</td >< tdcolspan="3">< spanclass="opacitymedium"></span ></td ></tr >< trclass="liste_total"> CREANCES DETTES< tdcolspan="3"class="right"></td >< tdcolspan="3"class="right"></td ></tr > CREANCES DETTES RECETTES DEPENSES trips CREANCES DETTES Y m expensereport p date_valid Y m expensereport pe datep $db idate($date_start)."' AND $column < p rowid
Class to manage Dolibarr database access.
const LABEL
Database label.
lasterror()
Return last error label.
$conf db
API class for accounts.
errno()
Return generic error code of last operation.
const VERSIONMIN
Version min database.
getServerParametersValues($filter= '')
Return value of server parameters.
error()
Return description of last error.
fetch_object($resultset)
Renvoie la ligne courante (comme un objet) pour le curseur resultset.
connect($host, $login, $passwd, $name, $port=0)
Connect to server.
__construct($type, $host, $user, $pass, $name= '', $port=0)
Constructor.
encrypt($fieldorvalue, $withQuotes=0)
Encrypt sensitive data in database Warning: This function includes the escape, so it must use direct ...
getDriverInfo()
Return version of database client driver.
query($query, $usesavepoint=0, $type= 'auto')
Execute a SQL request and return the resultset.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
close()
Close database connexion.
num_rows($resultset)
Return number of lines for result of a SELECT.
getServerStatusValues($filter= '')
Return value of server status (current indicators on memory, cache...)
fetch_array($resultset)
Return datas as an array.
getDefaultCollationDatabase()
Return collation used in current database.
last_insert_id($tab, $fieldid= 'rowid')
Get last ID after an insert INSERT.
Class to manage Dolibarr database access for a MySQL database using the MySQLi extension.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
lasterrno()
Return last error code.
affected_rows($resultset)
Return the number of lines in the result of a request INSERT, DELETE or UPDATE.
static convertSQLFromMysql($line, $type= 'ddl')
Convert a SQL request in Mysql syntax to native syntax.
getVersion()
Return version of database server.
free($resultset=null)
Libere le dernier resultset utilise sur cette connexion.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
getListOfCollation()
Return list of available collation that can be used for database.