本文整理汇总了PHP中PMA_DBI_fetch_array函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_DBI_fetch_array函数的具体用法?PHP PMA_DBI_fetch_array怎么用?PHP PMA_DBI_fetch_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_DBI_fetch_array函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFromDb
/**
* Returns recently used tables from phpMyAdmin database.
*
* @return array
*/
public function getFromDb()
{
// Read from phpMyAdmin database, if recent tables is not in session
$sql_query = " SELECT `tables` FROM " . $this->pma_table . " WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'";
$row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
if (isset($row[0])) {
return json_decode($row[0], true);
} else {
return array();
}
}
示例2: getFromDb
/**
* Returns recently used tables from phpMyAdmin database.
*
* @return array
*/
public function getFromDb()
{
// Read from phpMyAdmin database, if recent tables is not in session
$sql_query = " SELECT `tables` FROM " . $this->_pmaTable . " WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'";
$return = array();
$result = PMA_queryAsControlUser($sql_query, false);
if ($result) {
$row = PMA_DBI_fetch_array($result);
if (isset($row[0])) {
$return = json_decode($row[0], true);
}
}
return $return;
}
示例3: PMA_DBI_data_seek
</th>
<th><?php
echo $strStatus;
?>
</th>
<th><?php
echo $strShow;
?>
</th>
</tr>
</thead>
<tbody>
<?php
$style = 'odd';
PMA_DBI_data_seek($sql_result, 0);
while ($version = PMA_DBI_fetch_array($sql_result)) {
if ($version['tracking_active'] == 1) {
$version_status = $strTrackingStatusActive;
} else {
$version_status = $strTrackingStatusNotActive;
}
if ($version['version'] == $last_version && $version_status == $strTrackingStatusNotActive) {
$tracking_active = false;
}
if ($version['version'] == $last_version && $version_status == $strTrackingStatusActive) {
$tracking_active = true;
}
?>
<tr class="<?php
echo $style;
?>
示例4: getData
/**
* Returns the names of children of type $type present inside this container
* This method is overridden by the Node_Database and Node_Table classes
*
* @param string $type The type of item we are looking for
* ('tables', 'views', etc)
* @param int $pos The offset of the list within the results
* @param string $searchClause A string used to filter the results of the query
*
* @return array
*/
public function getData($type, $pos, $searchClause = '')
{
$maxItems = $GLOBALS['cfg']['MaxNavigationItems'];
$retval = array();
$db = $this->realParent()->real_name;
$table = $this->real_name;
switch ($type) {
case 'columns':
if (!$GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
$db = PMA_Util::sqlAddSlashes($db);
$table = PMA_Util::sqlAddSlashes($table);
$query = "SELECT `COLUMN_NAME` AS `name` ";
$query .= "FROM `INFORMATION_SCHEMA`.`COLUMNS` ";
$query .= "WHERE `TABLE_NAME`='{$table}' ";
$query .= "AND `TABLE_SCHEMA`='{$db}' ";
$query .= "ORDER BY `COLUMN_NAME` ASC ";
$query .= "LIMIT " . intval($pos) . ", {$maxItems}";
$retval = PMA_DBI_fetch_result($query);
} else {
$db = PMA_Util::backquote($db);
$table = PMA_Util::backquote($table);
$query = "SHOW COLUMNS FROM {$table} FROM {$db}";
$handle = PMA_DBI_try_query($query);
if ($handle !== false) {
$count = 0;
while ($arr = PMA_DBI_fetch_array($handle)) {
if ($pos <= 0 && $count < $maxItems) {
$retval[] = $arr['Field'];
$count++;
}
$pos--;
}
}
}
break;
case 'indexes':
$db = PMA_Util::backquote($db);
$table = PMA_Util::backquote($table);
$query = "SHOW INDEXES FROM {$table} FROM {$db}";
$handle = PMA_DBI_try_query($query);
if ($handle !== false) {
$count = 0;
while ($arr = PMA_DBI_fetch_array($handle)) {
if (!in_array($arr['Key_name'], $retval)) {
if ($pos <= 0 && $count < $maxItems) {
$retval[] = $arr['Key_name'];
$count++;
}
$pos--;
}
}
}
break;
case 'triggers':
if (!$GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
$db = PMA_Util::sqlAddSlashes($db);
$table = PMA_Util::sqlAddSlashes($table);
$query = "SELECT `TRIGGER_NAME` AS `name` ";
$query .= "FROM `INFORMATION_SCHEMA`.`TRIGGERS` ";
$query .= "WHERE `EVENT_OBJECT_SCHEMA`='{$db}' ";
$query .= "AND `EVENT_OBJECT_TABLE`='{$table}' ";
$query .= "ORDER BY `TRIGGER_NAME` ASC ";
$query .= "LIMIT " . intval($pos) . ", {$maxItems}";
$retval = PMA_DBI_fetch_result($query);
} else {
$db = PMA_Util::backquote($db);
$table = PMA_Util::sqlAddSlashes($table);
$query = "SHOW TRIGGERS FROM {$db} WHERE `Table` = '{$table}'";
$handle = PMA_DBI_try_query($query);
if ($handle !== false) {
$count = 0;
while ($arr = PMA_DBI_fetch_array($handle)) {
if ($pos <= 0 && $count < $maxItems) {
$retval[] = $arr['Trigger'];
$count++;
}
$pos--;
}
}
}
break;
default:
break;
}
return $retval;
}
示例5: PMA_generate_common_url
*/
$url_query = PMA_generate_common_url(isset($db) ? $db : '');
/**
* Defines the urls to return to in case of error in a sql statement
*/
$err_url = 'main.php' . $url_query;
/**
* Displays the headers
*/
require_once './libraries/header.inc.php';
/**
* Checks for superuser privileges
*/
$is_superuser = PMA_isSuperuser();
// now, select the mysql db
if ($is_superuser) {
PMA_DBI_select_db('mysql', $userlink);
}
$has_binlogs = FALSE;
$binlogs = PMA_DBI_try_query('SHOW MASTER LOGS', null, PMA_DBI_QUERY_STORE);
if ($binlogs) {
if (PMA_DBI_num_rows($binlogs) > 0) {
$binary_logs = array();
while ($row = PMA_DBI_fetch_array($binlogs)) {
$binary_logs[] = $row[0];
}
$has_binlogs = TRUE;
}
PMA_DBI_free_result($binlogs);
}
unset($binlogs);
示例6: getData
/**
* Returns the names of children of type $type present inside this container
* This method is overridden by the Node_Database and Node_Table classes
*
* @param string $type The type of item we are looking for
* ('tables', 'views', etc)
* @param int $pos The offset of the list within the results
* @param string $searchClause A string used to filter the results of the query
*
* @return array
*/
public function getData($type, $pos, $searchClause = '')
{
$maxItems = $GLOBALS['cfg']['MaxNavigationItems'];
$retval = array();
$db = $this->real_name;
switch ($type) {
case 'tables':
if (!$GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
$db = PMA_Util::sqlAddSlashes($db);
$query = "SELECT `TABLE_NAME` AS `name` ";
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
$query .= "WHERE `TABLE_SCHEMA`='{$db}' ";
$query .= "AND `TABLE_TYPE`='BASE TABLE' ";
if (!empty($searchClause)) {
$query .= "AND `TABLE_NAME` LIKE '%";
$query .= PMA_Util::sqlAddSlashes($searchClause, true);
$query .= "%'";
}
$query .= "ORDER BY `TABLE_NAME` ASC ";
$query .= "LIMIT " . intval($pos) . ", {$maxItems}";
$retval = PMA_DBI_fetch_result($query);
} else {
$query = " SHOW FULL TABLES FROM ";
$query .= PMA_Util::backquote($db);
$query .= " WHERE `Table_type`='BASE TABLE' ";
if (!empty($searchClause)) {
$query .= "AND " . PMA_Util::backquote("Tables_in_" . $db);
$query .= " LIKE '%" . PMA_Util::sqlAddSlashes($searchClause, true);
$query .= "%'";
}
$handle = PMA_DBI_try_query($query);
if ($handle !== false) {
$count = 0;
while ($arr = PMA_DBI_fetch_array($handle)) {
if ($pos <= 0 && $count < $maxItems) {
$retval[] = $arr[0];
$count++;
}
$pos--;
}
}
}
break;
case 'views':
if (!$GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
$db = PMA_Util::sqlAddSlashes($db);
$query = "SELECT `TABLE_NAME` AS `name` ";
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
$query .= "WHERE `TABLE_SCHEMA`='{$db}' ";
$query .= "AND `TABLE_TYPE`!='BASE TABLE' ";
if (!empty($searchClause)) {
$query .= "AND `TABLE_NAME` LIKE '%";
$query .= PMA_Util::sqlAddSlashes($searchClause, true);
$query .= "%'";
}
$query .= "ORDER BY `TABLE_NAME` ASC ";
$query .= "LIMIT " . intval($pos) . ", {$maxItems}";
$retval = PMA_DBI_fetch_result($query);
} else {
$query = "SHOW FULL TABLES FROM ";
$query .= PMA_Util::backquote($db);
$query .= " WHERE `Table_type`!='BASE TABLE' ";
if (!empty($searchClause)) {
$query .= "AND " . PMA_Util::backquote("Tables_in_" . $db);
$query .= " LIKE '%" . PMA_Util::sqlAddSlashes($searchClause, true);
$query .= "%'";
}
$handle = PMA_DBI_try_query($query);
if ($handle !== false) {
$count = 0;
while ($arr = PMA_DBI_fetch_array($handle)) {
if ($pos <= 0 && $count < $maxItems) {
$retval[] = $arr[0];
$count++;
}
$pos--;
}
}
}
break;
case 'procedures':
if (!$GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
$db = PMA_Util::sqlAddSlashes($db);
$query = "SELECT `ROUTINE_NAME` AS `name` ";
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
$query .= "WHERE `ROUTINE_SCHEMA`='{$db}'";
$query .= "AND `ROUTINE_TYPE`='PROCEDURE' ";
if (!empty($searchClause)) {
$query .= "AND `ROUTINE_NAME` LIKE '%";
//.........这里部分代码省略.........
示例7: __
<tbody>
<?php
// Print out information about versions
$drop_image_or_text = '';
if (true == $GLOBALS['cfg']['PropertiesIconic']) {
$drop_image_or_text .= '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_drop.png" alt="' . __('Delete tracking data for this table') . '" title="' . __('Delete tracking data for this table') . '" />';
}
if ('both' === $GLOBALS['cfg']['PropertiesIconic'] || false === $GLOBALS['cfg']['PropertiesIconic']) {
$drop_image_or_text .= __('Drop');
}
$style = 'odd';
while ($one_result = PMA_DBI_fetch_array($all_tables_result)) {
list($table_name, $version_number) = $one_result;
$table_query = ' SELECT * FROM ' . PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' . PMA_backquote($GLOBALS['cfg']['Server']['tracking']) . ' WHERE `db_name` = \'' . PMA_sqlAddslashes($_REQUEST['db']) . '\' AND `table_name` = \'' . PMA_sqlAddslashes($table_name) . '\' AND `version` = \'' . $version_number . '\'';
$table_result = PMA_query_as_controluser($table_query);
$version_data = PMA_DBI_fetch_array($table_result);
if ($version_data['tracking_active'] == 1) {
$version_status = __('active');
} else {
$version_status = __('not active');
}
$tmp_link = 'tbl_tracking.php?' . $url_query . '&table=' . htmlspecialchars($version_data['table_name']);
$delete_link = 'db_tracking.php?' . $url_query . '&table=' . htmlspecialchars($version_data['table_name']) . '&delete_tracking=true&';
?>
<tr class="noclick <?php
echo $style;
?>
">
<td><?php
echo htmlspecialchars($version_data['db_name']);
?>
示例8: get_tab_pos
function get_tab_pos()
{
$stmt = PMA_query_as_cu("SELECT * FROM " . PMA_backquote($GLOBALS['cfgRelation']['designer_coords']), FALSE, PMA_DBI_QUERY_STORE);
if ($stmt) {
while ($t_p = PMA_DBI_fetch_array($stmt, MYSQL_ASSOC)) {
$t_name = $t_p['db_name'] . '.' . $t_p['table_name'];
$tab_pos[$t_name]['X'] = $t_p['x'];
$tab_pos[$t_name]['Y'] = $t_p['y'];
$tab_pos[$t_name]['V'] = $t_p['v'];
$tab_pos[$t_name]['H'] = $t_p['h'];
}
}
return isset($tab_pos) ? $tab_pos : NULL;
}
示例9: testFetch
/**
* Simple test for fetching results of query
*
* This relies on dummy driver internals
*
* @return void
*/
function testFetch()
{
$this->assertEquals(array('1'), PMA_DBI_fetch_array(0));
}
示例10: getTrackedData
/**
* Gets the record of a tracking job.
*
* @static
*
* @param string $dbname name of database
* @param string $tablename name of table
* @param string $version version number
*
* @return mixed record DDM log, DDL log, structure snapshot, tracked statements.
*/
public static function getTrackedData($dbname, $tablename, $version)
{
if (!isset(self::$pma_table)) {
self::init();
}
$sql_query = " SELECT * FROM " . self::$pma_table . " WHERE `db_name` = '" . PMA_sqlAddslashes($dbname) . "' ";
if (!empty($tablename)) {
$sql_query .= " AND `table_name` = '" . PMA_sqlAddslashes($tablename) . "' ";
}
$sql_query .= " AND `version` = '" . PMA_sqlAddslashes($version) . "' " . " ORDER BY `version` DESC ";
$mixed = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
// Parse log
$log_schema_entries = explode('# log ', $mixed['schema_sql']);
$log_data_entries = explode('# log ', $mixed['data_sql']);
$ddl_date_from = $date = date('Y-m-d H:i:s');
$ddlog = array();
$i = 0;
// Iterate tracked data definition statements
// For each log entry we want to get date, username and statement
foreach ($log_schema_entries as $log_entry) {
if (trim($log_entry) != '') {
$date = substr($log_entry, 0, 19);
$username = substr($log_entry, 20, strpos($log_entry, "\n") - 20);
if ($i == 0) {
$ddl_date_from = $date;
}
$statement = rtrim(strstr($log_entry, "\n"));
$ddlog[] = array('date' => $date, 'username' => $username, 'statement' => $statement);
$i++;
}
}
$date_from = $ddl_date_from;
$date_to = $ddl_date_to = $date;
$dml_date_from = $date_from;
$dmlog = array();
$i = 0;
// Iterate tracked data manipulation statements
// For each log entry we want to get date, username and statement
foreach ($log_data_entries as $log_entry) {
if (trim($log_entry) != '') {
$date = substr($log_entry, 0, 19);
$username = substr($log_entry, 20, strpos($log_entry, "\n") - 20);
if ($i == 0) {
$dml_date_from = $date;
}
$statement = rtrim(strstr($log_entry, "\n"));
$dmlog[] = array('date' => $date, 'username' => $username, 'statement' => $statement);
$i++;
}
}
$dml_date_to = $date;
// Define begin and end of date range for both logs
if (strtotime($ddl_date_from) <= strtotime($dml_date_from)) {
$data['date_from'] = $ddl_date_from;
} else {
$data['date_from'] = $dml_date_from;
}
if (strtotime($ddl_date_to) >= strtotime($dml_date_to)) {
$data['date_to'] = $ddl_date_to;
} else {
$data['date_to'] = $dml_date_to;
}
$data['ddlog'] = $ddlog;
$data['dmlog'] = $dmlog;
$data['tracking'] = $mixed['tracking'];
$data['schema_snapshot'] = $mixed['schema_snapshot'];
return $data;
}