Property | Type | Description | |
---|---|---|---|
$connected | Is connected to the DB ? | ||
$dbdefault | ! Default Database | ||
$dbh | ! Database Handler | ||
$dbhost | ! Database Host - string or Array of string (round robin) | ||
$dbpassword | ! Database Password | ||
$dbuser | ! Database User | ||
$error | ! Database Error | ||
$first_connection | Is it a first connection ? Indicates if the first connection attempt is successful or not if first attempt fail -> display a warning which indicates that glpi is in readonly | ||
$slave | Slave management |
Method | Description | |
---|---|---|
__construct ( $choice = NULL ) : nothing | Constructor / Connect to the MySQL Database | |
affected_rows ( ) : number | Get number of affected rows in previous MySQL operation | |
checkForCrashedTables ( ) : an | Check for crashed MySQL Tables | |
close ( ) : TRUE | Close MySQL connection | |
connect ( $choice = NULL ) : nothing | Connect using current database settings | |
data_seek ( $result, $num ) : boolean | Move current pointer of a Mysql result to the specific row | |
errno ( ) : error | Returns the numerical value of the error message from previous MySQL operation | |
error ( ) : error | Returns the text of the error message from previous MySQL operation | |
escape ( $string ) : String | Escapes special characters in a string for use in an SQL statement, taking into account the current charset of the connection | |
fetch_array ( $result ) : result | Fetch array of the next row of a Mysql query Please prefer fetch_row or fetch_assoc | |
fetch_assoc ( $result ) : result | Fetch assoc of the next row of a Mysql query | |
fetch_row ( $result ) : result | Fetch row of the next row of a Mysql query | |
field_flags ( $result, $field ) : flags | Get flags of a field of a mysql result | |
field_name ( $result, $nb ) : name | Give name of a field of a Mysql result | |
free_result ( $result ) : Returns | Free result memory | |
getInfo ( ) : Array | Get information about DB connection for showSystemInformations | |
getLock ( $name ) : boolean | Get a global DB lock | |
insert_id ( ) : item | Give ID of the last insert item by Mysql | |
isMySQLStrictMode ( &$msg ) | ||
isSlave ( ) : boolean | is a slave database ? | |
list_fields ( $table, $usecache = true ) : list | List fields of a table | |
list_tables ( $table = "glpi_%" ) : list | List tables in database | |
num_fields ( $result ) : number | Give number of fields of a Mysql result | |
numrows ( $result ) : number | Give number of rows of a Mysql result | |
optimize_tables ( $migration = NULL, $cron = false ) : number | Optimize sql table | |
prepare ( $query ) : a | Prepare a MySQL query | |
query ( $query ) : Query | Execute a MySQL query | |
queryOrDie ( $query, $message = '' ) : Query | Execute a MySQL query | |
releaseLock ( $name ) : boolean | Release a global DB lock | |
request ( $tableorsql, $crit = "", $debug = false ) : DBIterator | Instanciate a Simple DBIterator | |
result ( $result, $i, $field ) : Value | Give result from a mysql result | |
runFile ( $path ) : boolean | Execute all the request in a file |
public __construct ( $choice = NULL ) : nothing | ||
$choice | integer, host number (default NULL) | |
return | nothing |
public affected_rows ( ) : number | ||
return | number | of affected rows on success, and -1 if the last query failed. |
public static checkForCrashedTables ( ) : an | ||
return | an | array with supposed crashed table and check message |
public close ( ) : TRUE | ||
return | TRUE | on success or FALSE on failure. |
public connect ( $choice = NULL ) : nothing | ||
$choice | integer, host number (default NULL) | |
return | nothing |
public errno ( ) : error | ||
return | error | number from the last MySQL function, or 0 (zero) if no error occurred. |
public error ( ) : error | ||
return | error | text from the last MySQL function, or '' (empty string) if no error occurred. |
public escape ( $string ) : String | ||
$string | String to escape | |
return | String | escaped |
public fetch_array ( $result ) : result | ||
$result | MySQL result handler | |
return | result | array |
public fetch_assoc ( $result ) : result | ||
$result | MySQL result handler | |
return | result | associative array |
public fetch_row ( $result ) : result | ||
$result | MySQL result handler | |
return | result | row |
public field_flags ( $result, $field ) : flags | ||
$result | MySQL result handler | |
$field | field name | |
return | flags | of the field |
public field_name ( $result, $nb ) : name | ||
$result | MySQL result handler | |
$nb | number of columns of the field | |
return | name | of the field |
public free_result ( $result ) : Returns | ||
$result | MySQL result handler | |
return | Returns | TRUE on success or FALSE on failure. |
public getInfo ( ) : Array | ||
return | Array | of label / value |
public insert_id ( ) : item | ||
return | item | ID |
public list_fields ( $table, $usecache = true ) : list | ||
$table | String table name condition | |
$usecache | Boolean if use field list cache (default true) | |
return | list | of fields |
public list_tables ( $table = "glpi_%" ) : list | ||
$table | table name condition (glpi_% as default to retrieve only glpi tables) | |
return | list | of tables |
public num_fields ( $result ) : number | ||
$result | MySQL result handler | |
return | number | of fields |
static public optimize_tables ( $migration = NULL, $cron = false ) : number | ||
$migration | migration class (default NULL) | |
$cron | to know if optimize must be done (false by default) | |
return | number | of tables |
public prepare ( $query ) : a | ||
$query | Query to prepare | |
return | a | statement object or FALSE if an error occurred. |
public query ( $query ) : Query | ||
$query | Query to execute | |
return | Query | result handler |
public queryOrDie ( $query, $message = '' ) : Query | ||
$query | Query to execute | |
$message | explaination of query (default '') | |
return | Query | result handler |
public releaseLock ( $name ) : boolean | ||
$name | String : name of the lock | |
return | boolean |
public request ( $tableorsql, $crit = "", $debug = false ) : DBIterator | ||
$tableorsql | table name, array of names or SQL query | |
$crit | string or array of filed/values, ex array("id"=>1), if empty => all rows (default '') | |
$debug | for log the request (default false) Examples = array("id"=>NULL) array("OR"=>array("id"=>1, "NOT"=>array("state"=>3))); array("AND"=>array("id"=>1, array("NOT"=>array("state"=>array(3,4,5),"toto"=>2)))) FIELDS name or array of field names ORDER name or array of field names LIMIT max of row to retrieve START first row to retrieve | |
return | DBIterator |
public result ( $result, $i, $field ) : Value | ||
$result | MySQL result handler | |
$i | Row to give | |
$field | Field to give | |
return | Value | of the Row $i and the Field $field of the Mysql $result |
public $first_connection |