Method | Description | |
---|---|---|
__construct ( PMA\libraries\dbi\DBIExtension $ext ) | Constructor | |
affectedRows ( object $link = null, boolean $get_from_cache = true ) : integer | boolean | returns the number of rows affected by last query | |
cacheTableContent ( array $contentPath, mixed $value ) : void | Set an item in table cache using dot notation. | |
checkDbExtension ( string $extension = 'mysql' ) : boolean | Checks whether database extension is loaded | |
clearTableCache ( ) : void | Clear the table cache. | |
connect ( integer $mode, array $server = null ) : mixed | connects to the database server | |
dataSeek ( object $result, integer $offset ) : boolean | Adjusts the result pointer to an arbitrary row in the result | |
escapeString ( string $str, mixed $link = null ) : string | returns properly escaped string for use in MySQL queries | |
fetchArray ( object $result ) : array | returns array of rows with associative and numeric keys from $result | |
fetchAssoc ( object $result ) : array | returns array of rows with associative keys from $result | |
fetchResult ( string $query, string | integer | array $key = null, string | integer $value = null, object $link = null, integer $options ) : array | returns all rows in the resultset in one array | |
fetchRow ( object $result ) : array | returns array of rows with numeric keys from $result | |
fetchSingleRow ( string $query, string $type = 'ASSOC', object $link = null ) : array | boolean | returns only the first row from the result | |
fetchValue ( string $query, integer $row_number, integer | string $field, object $link = null ) : mixed | returns a single value from the given result or query, if the query or the result has more than one row or field the first field of the first row is returned | |
fieldFlags ( object $result, integer $i ) : string | returns concatenated string of human readable field flags | |
fieldLen ( object $result, integer $i ) : integer | returns the length of the given field $i in $result | |
fieldName ( object $result, integer $i ) : string | returns name of $i. field in $result | |
formatError ( integer $error_number, string $error_message ) : string | Formats database error message in a friendly way. | |
freeResult ( object $result ) : void | Frees memory associated with the result | |
getCachedTableContent ( array $contentPath, mixed $default = null ) : mixed | Get a cached value from table cache. | |
getClientInfo ( ) : string | returns a string that represents the client library version | |
getColumnMapFromSql ( string $sql_query, array $view_columns = [] ) : array | returns detailed array with all columns for sql | |
getColumnNames ( string $database, string $table, mixed $link = null ) : null | array | Returns all column names in given table | |
getColumns ( string $database, string $table, string $column = null, boolean $full = false, mixed $link = null ) : array | Returns descriptions of columns in given table (all or given by $column) | |
getColumnsFull ( string $database = null, string $table = null, string $column = null, mixed $link = null ) : array | returns detailed array with all columns for given table in database, or all tables/databases | |
getColumnsSql ( string $database, string $table, string $column = null, boolean $full = false ) : string | Returns SQL query for fetching columns for a table | |
getCompatibilities ( ) : array | Get supported SQL compatibility modes | |
getConnectionParams ( integer $mode, array $server = null ) : array | Return connection parameters for the database server | |
getCurrentUser ( ) : string | gets the current user with host | |
getCurrentUserAndHost ( ) : array | Get the current user and host | |
getDatabasesFull ( string $database = null, boolean $force_stats = false, object $link = null, string $sort_by = 'SCHEMA_NAME', string $sort_order = 'ASC', integer $limit_offset, boolean | integer $limit_count = false ) : array | returns array with databases containing extended infos about them | |
getDbCollation ( string $db ) : string | returns collation of given db | |
getDefinition ( string $db, string $which, string $name, object $link = null ) : string | returns the definition of a specific PROCEDURE, FUNCTION, EVENT or VIEW | |
getError ( object $link = null ) : string | boolean | returns last error message or false if no errors occurred | |
getEvents ( string $db, string $name = '' ) : array | returns details about the EVENTs for a specific database | |
getFieldsMeta ( object $result ) : array | returns metainfo for fields in $result | |
getHostInfo ( object $link = null ) : string | Returns a string representing the type of connection used | |
getKillQuery ( integer $process ) : string | Gets SQL for killing a process. | |
getLink ( $link = null ) | * Gets correct link object. | |
getProceduresOrFunctions ( string $db, string $which, object $link = null ) : array | returns an array of PROCEDURE or FUNCTION names for a db | |
getProtoInfo ( object $link = null ) : integer | Returns the version of the MySQL protocol used | |
getRoutines ( string $db, string $which = null, string $name = '' ) : array | returns details about the PROCEDUREs or FUNCTIONs for a specific database or details about a specific routine | |
getServerCollation ( ) : string | returns default server collation from show variables | |
getSystemDatabase ( ) : |
Get the phpmyadmin database manager | |
getSystemSchemas ( ) : array | Get the list of system schemas | |
getTable ( string $db_name, string $table_name ) : |
Get a table with database name and table name | |
getTableIndexes ( string $database, string $table, mixed $link = null ) : array | Returns indexes of a table | |
getTableIndexesSql ( string $database, string $table, string $where = null ) : string | Returns SQL for fetching information on table indexes (SHOW INDEXES) | |
getTables ( string $database, mixed $link = null ) : array | returns array with table names for given db | |
getTablesFull ( string $database, string | array $table = '', boolean $tbl_is_group = false, mixed $link = null, integer $limit_offset, boolean | integer $limit_count = false, string $sort_by = 'Name', string $sort_order = 'ASC', string $table_type = null ) : array | returns array of all tables in given db or dbs this function expects unquoted names: RIGHT: my_database WRONG: my_database WRONG: my\_database if $tbl_is_group is true, $table is used as filter for table names | |
getTriggers ( string $db, string $table = '', string $delimiter = '//' ) : array | returns details about the TRIGGERs for a specific table or database | |
getVariable ( string $var, integer $type = self::GETVAR_SESSION, mixed $link = null ) : mixed | returns value of given mysql server variable | |
getVirtualTables ( string $db ) : array | Get VIEWs in a particular database | |
getWarnings ( object $link = null ) : array | returns warnings for last query | |
insertId ( object $link = null ) : integer | boolean | returns last inserted auto_increment id for given $link or $GLOBALS['userlink'] | |
isAmazonRds ( ) : boolean | Checks if this database server is running on Amazon RDS. | |
isSuperuser ( ) : boolean | Checks if current user is superuser | |
isSystemSchema ( string $schema_name, boolean $testForMysqlSchema = false ) : boolean | Checks whether given schema is a system schema | |
isUserType ( string $type ) : boolean | Checks if current user has global create user/grant privilege or is a superuser (i.e. SELECT on mysql.users) while caching the result in session. | |
moreResults ( object $link = null ) : boolean | Check if there are any more query results from a multi query | |
nextResult ( object $link = null ) : boolean | Prepare next result from multi_query | |
numFields ( object $result ) : integer | return number of fields in given $result | |
numRows ( object $result ) : string | integer | returns the number of rows returned by last query | |
postConnect ( mixed $link ) : void | Function called just after a connection to the MySQL database server has been established. It sets the connection collation, and determines the version of MySQL which is running. | |
query ( string $query, mixed $link = null, integer $options, boolean $cache_affected_rows = true ) : mixed | runs a query | |
selectDb ( string $dbname, object $link = null ) : boolean | selects given database | |
setVariable ( string $var, string $value, mixed $link = null ) : boolean | Sets new value for a variable if it is different from the current value | |
storeResult ( object $link = null ) : mixed | Store the result returned from multi query | |
tryMultiQuery ( string $multi_query = '', mysqli $link = null ) : mysqli_result | Run multi query statement and return results | |
tryQuery ( string $query, object $link = null, integer $options, boolean $cache_affected_rows = true ) : mixed | runs a query and returns the result |
Method | Description | |
---|---|---|
_cacheTableData ( array $tables, string $table ) : void | Caches table data so Table does not require to issue SHOW TABLE STATUS again | |
_dbgQuery ( string $query, object $link, object | boolean $result, integer $time ) : void | Stores query data into session data for debugging purposes | |
_fetchValue ( array $row, string | null $value ) : mixed | Returns row or element of a row | |
_getSqlForTablesFull ( string[] $this_databases, string $sql_where_table ) : string | returns the beginning of the SQL statement to fetch the list of tables | |
_getTableCondition ( array | string $table, boolean $tbl_is_group, string $table_type ) : string | returns a segment of the SQL WHERE clause regarding table name and type | |
_usortComparisonCallback ( string $a, string $b ) : integer | usort comparison callback |
public __construct ( PMA\libraries\dbi\DBIExtension $ext ) | ||
$ext | PMA\libraries\dbi\DBIExtension | Object to be used for database queries |
public static checkDbExtension ( string $extension = 'mysql' ) : boolean | ||
$extension | string | mysql extension to check |
return | boolean |
public clearTableCache ( ) : void | ||
return | void |
public fetchArray ( object $result ) : array | ||
$result | object | result set identifier |
return | array |
public fetchAssoc ( object $result ) : array | ||
$result | object | result set identifier |
return | array |
$sql = 'SELECT * FROM user';
$users = $GLOBALS['dbi']->fetchResult($sql);
produces
$users[] = array('id' => 123, 'name' => 'John Doe')
$sql = 'SELECT id, name FROM user';
$users = $GLOBALS['dbi']->fetchResult($sql, 'id');
produces
$users['123'] = array('id' => 123, 'name' => 'John Doe')
$sql = 'SELECT id, name FROM user';
$users = $GLOBALS['dbi']->fetchResult($sql, 0);
produces
$users['123'] = array(0 => 123, 1 => 'John Doe')
$sql = 'SELECT id, name FROM user';
$users = $GLOBALS['dbi']->fetchResult($sql, 'id', 'name');
or
$users = $GLOBALS['dbi']->fetchResult($sql, 0, 1);
produces
$users['123'] = 'John Doe'
$sql = 'SELECT name FROM user';
$users = $GLOBALS['dbi']->fetchResult($sql);
produces
$users[] = 'John Doe'
$sql = 'SELECT group, name FROM user'
$users = $GLOBALS['dbi']->fetchResult($sql, array('group', null), 'name');
produces
$users['admin'][] = 'John Doe'
$sql = 'SELECT group, name FROM user'
$users = $GLOBALS['dbi']->fetchResult($sql, array('group', 'name'), 'id');
produces
$users['admin']['John Doe'] = '123'
public fetchResult ( string $query, string | integer | array $key = null, string | integer $value = null, object $link = null, integer $options ) : array | ||
$query | string | query to execute |
$key | string | integer | array | field-name or offset used as key for array or array of those |
$value | string | integer | value-name or offset used as value for array |
$link | object | mysql link |
$options | integer | query options |
return | array | resultrows or values indexed by $key |
$sql = 'SELECT * FROM user WHERE id = 123';
$user = $GLOBALS['dbi']->fetchSingleRow($sql);
produces
$user = array('id' => 123, 'name' => 'John Doe')
public fetchSingleRow ( string $query, string $type = 'ASSOC', object $link = null ) : array | boolean | ||
$query | string | The query to execute |
$type | string | NUM|ASSOC|BOTH returned array should either numeric associative or both |
$link | object | mysql link |
return | array | boolean | first row from result or false if result is empty |
$sql = 'SELECT name FROM user WHERE id = 123';
$user_name = $GLOBALS['dbi']->fetchValue($sql);
produces
$user_name = 'John Doe'
public fetchValue ( string $query, integer $row_number, integer | string $field, object $link = null ) : mixed | ||
$query | string | The query to execute |
$row_number | integer | row to fetch the value from, starting at 0, with 0 being default |
$field | integer | string | field to fetch the value from, starting at 0, with 0 being default |
$link | object | mysql link |
return | mixed | value of first field in first row from result or false if not found |
public freeResult ( object $result ) : void | ||
$result | object | database result |
return | void |
public getClientInfo ( ) : string | ||
return | string | MySQL client library version |
public getColumns ( string $database, string $table, string $column = null, boolean $full = false, mixed $link = null ) : array | ||
$database | string | name of database |
$table | string | name of table to retrieve columns from |
$column | string | name of column, null to show all columns |
$full | boolean | whether to return full info or only column names |
$link | mixed | mysql link resource |
return | array | array indexed by column names or, if $column is given, flat array description |
public getColumnsSql ( string $database, string $table, string $column = null, boolean $full = false ) : string | ||
$database | string | name of database |
$table | string | name of table to retrieve columns from |
$column | string | name of column, null to show all columns |
$full | boolean | whether to return full info or only column names |
return | string |
public getCompatibilities ( ) : array | ||
return | array | supported SQL compatibility modes |
public getCurrentUser ( ) : string | ||
return | string | the current user i.e. user@host |
public getCurrentUserAndHost ( ) : array | ||
return | array | array of username and hostname |
public getDatabasesFull ( string $database = null, boolean $force_stats = false, object $link = null, string $sort_by = 'SCHEMA_NAME', string $sort_order = 'ASC', integer $limit_offset, boolean | integer $limit_count = false ) : array | ||
$database | string | database |
$force_stats | boolean | retrieve stats also for MySQL < 5 |
$link | object | mysql link |
$sort_by | string | column to order by |
$sort_order | string | ASC or DESC |
$limit_offset | integer | starting offset for LIMIT |
$limit_count | boolean | integer | row count for LIMIT or true for $GLOBALS['cfg']['MaxDbList'] |
return | array | $databases |
public getDbCollation ( string $db ) : string | ||
$db | string | name of db |
return | string | collation of $db |
public getFieldsMeta ( object $result ) : array | ||
$result | object | result set identifier |
return | array | meta info for fields in $result |
public getHostInfo ( object $link = null ) : string | ||
$link | object | mysql link |
return | string | type of connection used |
public getKillQuery ( integer $process ) : string | ||
$process | integer | Process ID |
return | string |
public getLink ( $link = null ) | ||
$link | optional database link to use |
public getProtoInfo ( object $link = null ) : integer | ||
$link | object | mysql link |
return | integer | version of the MySQL protocol used |
public getServerCollation ( ) : string | ||
return | string | $server_collation |
public getSystemDatabase ( ) : |
||
return |
public getSystemSchemas ( ) : array | ||
return | array | list of system schemas |
$GLOBALS['dbi']->getTablesFull('my_database');
$GLOBALS['dbi']->getTablesFull('my_database', 'my_table'));
$GLOBALS['dbi']->getTablesFull('my_database', 'my_tables_', true));
public getTablesFull ( string $database, string | array $table = '', boolean $tbl_is_group = false, mixed $link = null, integer $limit_offset, boolean | integer $limit_count = false, string $sort_by = 'Name', string $sort_order = 'ASC', string $table_type = null ) : array | ||
$database | string | database |
$table | string | array | table name(s) |
$tbl_is_group | boolean | $table is a table group |
$link | mixed | mysql link |
$limit_offset | integer | zero-based offset for the count |
$limit_count | boolean | integer | number of tables to return |
$sort_by | string | table attribute to sort by |
$sort_order | string | direction to sort (ASC or DESC) |
$table_type | string | whether table or view |
return | array | list of tables in given db(s) |
public getVariable ( string $var, integer $type = self::GETVAR_SESSION, mixed $link = null ) : mixed | ||
$var | string | mysql server variable name |
$type | integer | DatabaseInterface::GETVAR_SESSION | DatabaseInterface::GETVAR_GLOBAL |
$link | mixed | mysql link resource|object |
return | mixed | value for mysql server variable |
public getVirtualTables ( string $db ) : array | ||
$db | string | Database name to look in |
return | array | $views Set of VIEWs inside the database |
public getWarnings ( object $link = null ) : array | ||
$link | object | mysql link resource |
return | array | warnings |
public isAmazonRds ( ) : boolean | ||
return | boolean |
public isSuperuser ( ) : boolean | ||
return | boolean | Whether user is a superuser |
public isUserType ( string $type ) : boolean | ||
$type | string | type of user to check for i.e. 'create', 'grant', 'super' |
return | boolean | Whether user is a given type of user |
public moreResults ( object $link = null ) : boolean | ||
$link | object | the connection object |
return | boolean | true or false |
public nextResult ( object $link = null ) : boolean | ||
$link | object | the connection object |
return | boolean | true or false |
public postConnect ( mixed $link ) : void | ||
$link | mixed | mysql link resource|object |
return | void |
public query ( string $query, mixed $link = null, integer $options, boolean $cache_affected_rows = true ) : mixed | ||
$query | string | SQL query to execute |
$link | mixed | optional database link to use |
$options | integer | optional query options |
$cache_affected_rows | boolean | whether to cache affected rows |
return | mixed |
public storeResult ( object $link = null ) : mixed | ||
$link | object | the connection object |
return | mixed | false when empty results / result set when not empty |
public tryMultiQuery ( string $multi_query = '', mysqli $link = null ) : mysqli_result | ||
$multi_query | string | multi query statement to execute |
$link | mysqli | mysqli object |
return | mysqli_result | collection | boolean(false) |