本文整理汇总了PHP中PMA_DBI_fetch_assoc函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_DBI_fetch_assoc函数的具体用法?PHP PMA_DBI_fetch_assoc怎么用?PHP PMA_DBI_fetch_assoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_DBI_fetch_assoc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_getNewTransformationDataSql
/**
* Get SQL query for store new transformation details of a VIEW
*
* @param mysqli_result $pma_tranformation_data Result set of SQL execution
* @param array $column_map Details of VIEW columns
* @param string $view_name Name of the VIEW
* @param string $db Database name of the VIEW
*
* @return string $new_transformations_sql SQL query for new tranformations
*/
function PMA_getNewTransformationDataSql($pma_tranformation_data, $column_map, $view_name, $db)
{
$cfgRelation = PMA_getRelationsParam();
// Need to store new transformation details for VIEW
$new_transformations_sql = 'INSERT INTO ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['column_info']) . ' (`db_name`, `table_name`, `column_name`, `comment`, ' . '`mimetype`, `transformation`, `transformation_options`)' . ' VALUES ';
$column_count = 0;
$add_comma = false;
while ($data_row = PMA_DBI_fetch_assoc($pma_tranformation_data)) {
foreach ($column_map as $column) {
if ($data_row['table_name'] == $column['table_name'] && $data_row['column_name'] == $column['refering_column']) {
$new_transformations_sql .= $add_comma ? ', ' : '';
$new_transformations_sql .= '(' . '\'' . $db . '\', ' . '\'' . $view_name . '\', ' . '\'';
$new_transformations_sql .= isset($column['real_column']) ? $column['real_column'] : $column['refering_column'];
$new_transformations_sql .= '\', ' . '\'' . $data_row['comment'] . '\', ' . '\'' . $data_row['mimetype'] . '\', ' . '\'' . $data_row['transformation'] . '\', ' . '\'' . PMA_Util::sqlAddSlashes($data_row['transformation_options']) . '\')';
$add_comma = true;
$column_count++;
break;
}
}
if ($column_count == count($column_map)) {
break;
}
}
return $column_count > 0 ? $new_transformations_sql : '';
}
示例2: PMA_getSearchSqls
/**
* Builds the SQL search query
*
* @param string the table name
* @param string the string to search
* @param integer type of search (1 -> 1 word at least, 2 -> all words,
* 3 -> exact string, 4 -> regexp)
*
* @return array 3 SQL querys (for count, display and delete results)
*
* @global string the url to return to in case of errors
*/
function PMA_getSearchSqls($table, $search_str, $search_option)
{
global $err_url, $charset_connection;
// Statement types
$sqlstr_select = 'SELECT';
$sqlstr_delete = 'DELETE';
// Fields to select
$res = PMA_DBI_query('SHOW ' . (PMA_MYSQL_INT_VERSION >= 40100 ? 'FULL ' : '') . 'FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($GLOBALS['db']) . ';');
while ($current = PMA_DBI_fetch_assoc($res)) {
if (PMA_MYSQL_INT_VERSION >= 40100) {
list($current['Charset']) = explode('_', $current['Collation']);
}
$current['Field'] = PMA_backquote($current['Field']);
$tblfields[] = $current;
}
// while
PMA_DBI_free_result($res);
unset($current, $res);
$tblfields_cnt = count($tblfields);
// Table to use
$sqlstr_from = ' FROM ' . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($table);
// Beginning of WHERE clause
$sqlstr_where = ' WHERE';
$search_words = $search_option > 2 ? array($search_str) : explode(' ', $search_str);
$search_wds_cnt = count($search_words);
$like_or_regex = $search_option == 4 ? 'REGEXP' : 'LIKE';
$automatic_wildcard = $search_option < 3 ? '%' : '';
for ($i = 0; $i < $search_wds_cnt; $i++) {
// Eliminates empty values
// In MySQL 4.1, if a field has no collation we get NULL in Charset
// but in MySQL 5.0.x we get ''
if (!empty($search_words[$i])) {
for ($j = 0; $j < $tblfields_cnt; $j++) {
if (PMA_MYSQL_INT_VERSION >= 40100 && $tblfields[$j]['Charset'] != $charset_connection && $tblfields[$j]['Charset'] != 'NULL' && $tblfields[$j]['Charset'] != '') {
$prefix = 'CONVERT(_utf8 ';
$suffix = ' USING ' . $tblfields[$j]['Charset'] . ') COLLATE ' . $tblfields[$j]['Collation'];
} else {
$prefix = $suffix = '';
}
$thefieldlikevalue[] = $tblfields[$j]['Field'] . ' ' . $like_or_regex . ' ' . $prefix . '\'' . $automatic_wildcard . $search_words[$i] . $automatic_wildcard . '\'' . $suffix;
}
// end for
$fieldslikevalues[] = $search_wds_cnt > 1 ? '(' . implode(' OR ', $thefieldlikevalue) . ')' : implode(' OR ', $thefieldlikevalue);
unset($thefieldlikevalue);
}
// end if
}
// end for
$implode_str = $search_option == 1 ? ' OR ' : ' AND ';
$sqlstr_where .= ' ' . implode($implode_str, $fieldslikevalues);
unset($fieldslikevalues);
// Builds complete queries
$sql['select_fields'] = $sqlstr_select . ' * ' . $sqlstr_from . $sqlstr_where;
// here, I think we need to still use the COUNT clause, even for
// VIEWs, anyway we have a WHERE clause that should limit results
$sql['select_count'] = $sqlstr_select . ' COUNT(*) AS count' . $sqlstr_from . $sqlstr_where;
$sql['delete'] = $sqlstr_delete . $sqlstr_from . $sqlstr_where;
return $sql;
}
示例3: PMA_get_indexes
/**
* Function to get all index information from a certain table
*
* @param string Table name
* @param string Error URL
*
* @access public
* @return array Index keys
*/
function PMA_get_indexes($tbl_name, $err_url_0 = '')
{
$tbl_local_query = 'SHOW KEYS FROM ' . PMA_backquote($tbl_name);
$tbl_result = PMA_DBI_query($tbl_local_query) or PMA_mysqlDie('', $tbl_local_query, '', $err_url_0);
$tbl_ret_keys = array();
while ($tbl_row = PMA_DBI_fetch_assoc($tbl_result)) {
$tbl_ret_keys[] = $tbl_row;
}
PMA_DBI_free_result($tbl_result);
return $tbl_ret_keys;
}
示例4: PMA_DBI_get_fields
function PMA_DBI_get_fields($database, $table, $link = NULL)
{
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
} else {
return FALSE;
}
}
$result = PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($database) . '.' . PMA_backquote($table), $link);
$fields = array();
while ($row = PMA_DBI_fetch_assoc($result)) {
$fields[] = $row;
}
return $fields;
}
示例5: get_tab_info
/**
* retrieves table column info
*
* @uses $GLOBALS['db']
* @uses PMA_DBI_QUERY_STORE
* @uses PMA_DBI_select_db()
* @uses PMA_DBI_query()
* @uses PMA_DBI_num_rows()
* @uses PMA_backquote()
* @uses count()
* @return array table column nfo
*/
function get_tab_info()
{
PMA_DBI_select_db($GLOBALS['db']);
$tab_column = array();
for ($i = 0, $cnt = count($GLOBALS['PMD']["TABLE_NAME"]); $i < $cnt; $i++) {
$fields_rs = PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]), NULL, PMA_DBI_QUERY_STORE);
$j = 0;
while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
$tab_column[$GLOBALS['PMD']['TABLE_NAME'][$i]]['COLUMN_ID'][$j] = $j;
$tab_column[$GLOBALS['PMD']['TABLE_NAME'][$i]]['COLUMN_NAME'][$j] = $row['Field'];
$tab_column[$GLOBALS['PMD']['TABLE_NAME'][$i]]['TYPE'][$j] = $row['Type'];
$tab_column[$GLOBALS['PMD']['TABLE_NAME'][$i]]['NULLABLE'][$j] = $row['Null'];
$j++;
}
}
return $tab_column;
}
示例6: get_columns_info
/**
* retrieves table column info
*
* @return array table column nfo
*/
function get_columns_info()
{
PMA_DBI_select_db($GLOBALS['db']);
$tab_column = array();
for ($i = 0, $cnt = count($GLOBALS['PMD']["TABLE_NAME"]); $i < $cnt; $i++) {
$fields_rs = PMA_DBI_query(PMA_DBI_get_columns_sql($GLOBALS['db'], $GLOBALS['PMD']["TABLE_NAME_SMALL"][$i], null, true), null, PMA_DBI_QUERY_STORE);
$j = 0;
while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
$tab_column[$GLOBALS['PMD']['TABLE_NAME'][$i]]['COLUMN_ID'][$j] = $j;
$tab_column[$GLOBALS['PMD']['TABLE_NAME'][$i]]['COLUMN_NAME'][$j] = $row['Field'];
$tab_column[$GLOBALS['PMD']['TABLE_NAME'][$i]]['TYPE'][$j] = $row['Type'];
$tab_column[$GLOBALS['PMD']['TABLE_NAME'][$i]]['NULLABLE'][$j] = $row['Null'];
$j++;
}
}
return $tab_column;
}
示例7: PMA_analyzeWhereClauses
/**
* Analysing where clauses array
*
* @param array $where_clause_array array of where clauses
* @param string $table name of the table
* @param string $db name of the database
*
* @return array $where_clauses, $result, $rows
*/
function PMA_analyzeWhereClauses($where_clause_array, $table, $db)
{
$rows = array();
$result = array();
$where_clauses = array();
$found_unique_key = false;
foreach ($where_clause_array as $key_id => $where_clause) {
$local_query = 'SELECT * FROM ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table) . ' WHERE ' . $where_clause . ';';
$result[$key_id] = PMA_DBI_query($local_query, null, PMA_DBI_QUERY_STORE);
$rows[$key_id] = PMA_DBI_fetch_assoc($result[$key_id]);
$where_clauses[$key_id] = str_replace('\\', '\\\\', $where_clause);
$has_unique_condition = PMA_showEmptyResultMessageOrSetUniqueCondition($rows, $key_id, $where_clause_array, $local_query, $result);
if ($has_unique_condition) {
$found_unique_key = true;
}
}
return array($where_clauses, $result, $rows, $found_unique_key);
}
示例8: PMA_getDisplayField
$dataLabel = PMA_getDisplayField($db, $table);
}
// Displays the zoom search form
$response->addHTML($table_search->getSelectionForm($goto, $dataLabel));
/*
* Handle the input criteria and generate the query result
* Form for displaying query results
*/
if (isset($zoom_submit) && $_POST['criteriaColumnNames'][0] != 'pma_null' && $_POST['criteriaColumnNames'][1] != 'pma_null' && $_POST['criteriaColumnNames'][0] != $_POST['criteriaColumnNames'][1]) {
//Query generation part
$sql_query = $table_search->buildSqlQuery();
$sql_query .= ' LIMIT ' . $maxPlotLimit;
//Query execution part
$result = PMA_DBI_query($sql_query . ";", null, PMA_DBI_QUERY_STORE);
$fields_meta = PMA_DBI_get_fields_meta($result);
while ($row = PMA_DBI_fetch_assoc($result)) {
//Need a row with indexes as 0,1,2 for the getUniqueCondition
// hence using a temporary array
$tmpRow = array();
foreach ($row as $val) {
$tmpRow[] = $val;
}
//Get unique conditon on each row (will be needed for row update)
$uniqueCondition = PMA_Util::getUniqueCondition($result, count($table_search->getColumnNames()), $fields_meta, $tmpRow, true);
//Append it to row array as where_clause
$row['where_clause'] = $uniqueCondition[0];
$tmpData = array($_POST['criteriaColumnNames'][0] => $row[$_POST['criteriaColumnNames'][0]], $_POST['criteriaColumnNames'][1] => $row[$_POST['criteriaColumnNames'][1]], 'where_clause' => $uniqueCondition[0]);
$tmpData[$dataLabel] = $dataLabel ? $row[$dataLabel] : '';
$data[] = $tmpData;
}
unset($tmpData);
示例9: PMA_DBI_query
?>
" align="right">
<input type="submit" name="submitcomment" value="<?php
echo $strGo;
?>
" style="vertical-align: middle" />
</td>
</tr>
</form>
<tr><td colspan="2" height="5"></td></tr>
<!-- Table type -->
<?php
// modify robbat2 code - staybyte - 11. June 2001
$result = PMA_DBI_query('SHOW VARIABLES LIKE \'have_%\';');
if ($result) {
while ($tmp = PMA_DBI_fetch_assoc($result)) {
if (isset($tmp['Variable_name'])) {
switch ($tmp['Variable_name']) {
case 'have_bdb':
if ($tmp['Value'] == 'YES') {
$tbl_bdb = TRUE;
}
break;
case 'have_gemini':
if ($tmp['Value'] == 'YES') {
$tbl_gemini = TRUE;
}
break;
case 'have_innodb':
if ($tmp['Value'] == 'YES') {
$tbl_innodb = TRUE;
示例10: PMA_RTN_handleExecute
/**
* Handles requests for executing a routine
*
* @return Does not return
*/
function PMA_RTN_handleExecute()
{
global $_GET, $_POST, $_REQUEST, $GLOBALS, $db;
/**
* Handle all user requests other than the default of listing routines
*/
if (!empty($_REQUEST['execute_routine']) && !empty($_REQUEST['item_name'])) {
// Build the queries
$routine = PMA_RTN_getDataFromName($_REQUEST['item_name'], $_REQUEST['item_type'], false);
if ($routine !== false) {
$queries = array();
$end_query = array();
$args = array();
$all_functions = $GLOBALS['PMA_Types']->getAllFunctions();
for ($i = 0; $i < $routine['item_num_params']; $i++) {
if (isset($_REQUEST['params'][$routine['item_param_name'][$i]])) {
$value = $_REQUEST['params'][$routine['item_param_name'][$i]];
if (is_array($value)) {
// is SET type
$value = implode(',', $value);
}
$value = PMA_Util::sqlAddSlashes($value);
if (!empty($_REQUEST['funcs'][$routine['item_param_name'][$i]]) && in_array($_REQUEST['funcs'][$routine['item_param_name'][$i]], $all_functions)) {
$queries[] = "SET @p{$i}={$_REQUEST['funcs'][$routine['item_param_name'][$i]]}('{$value}');\n";
} else {
$queries[] = "SET @p{$i}='{$value}';\n";
}
$args[] = "@p{$i}";
} else {
$args[] = "@p{$i}";
}
if ($routine['item_type'] == 'PROCEDURE') {
if ($routine['item_param_dir'][$i] == 'OUT' || $routine['item_param_dir'][$i] == 'INOUT') {
$end_query[] = "@p{$i} AS " . PMA_Util::backquote($routine['item_param_name'][$i]);
}
}
}
if ($routine['item_type'] == 'PROCEDURE') {
$queries[] = "CALL " . PMA_Util::backquote($routine['item_name']) . "(" . implode(', ', $args) . ");\n";
if (count($end_query)) {
$queries[] = "SELECT " . implode(', ', $end_query) . ";\n";
}
} else {
$queries[] = "SELECT " . PMA_Util::backquote($routine['item_name']) . "(" . implode(', ', $args) . ") " . "AS " . PMA_Util::backquote($routine['item_name']) . ";\n";
}
// Get all the queries as one SQL statement
$multiple_query = implode("", $queries);
$outcome = true;
$affected = 0;
// Execute query
if (!PMA_DBI_try_multi_query($multiple_query)) {
$outcome = false;
}
// Generate output
if ($outcome) {
// Pass the SQL queries through the "pretty printer"
$output = '<code class="sql" style="margin-bottom: 1em;">';
$output .= PMA_SQP_formatHtml(PMA_SQP_parse(implode($queries)));
$output .= '</code>';
// Display results
$output .= "<fieldset><legend>";
$output .= sprintf(__('Execution results of routine %s'), PMA_Util::backquote(htmlspecialchars($routine['item_name'])));
$output .= "</legend>";
$num_of_rusults_set_to_display = 0;
do {
$result = PMA_DBI_store_result();
$num_rows = PMA_DBI_num_rows($result);
if ($result !== false && $num_rows > 0) {
$output .= "<table><tr>";
foreach (PMA_DBI_get_fields_meta($result) as $key => $field) {
$output .= "<th>";
$output .= htmlspecialchars($field->name);
$output .= "</th>";
}
$output .= "</tr>";
$color_class = 'odd';
while ($row = PMA_DBI_fetch_assoc($result)) {
$output .= "<tr>";
foreach ($row as $key => $value) {
if ($value === null) {
$value = '<i>NULL</i>';
} else {
$value = htmlspecialchars($value);
}
$output .= "<td class='" . $color_class . "'>" . $value . "</td>";
}
$output .= "</tr>";
$color_class = $color_class == 'odd' ? 'even' : 'odd';
}
$output .= "</table>";
$num_of_rusults_set_to_display++;
$affected = $num_rows;
}
if (!PMA_DBI_more_results()) {
break;
//.........这里部分代码省略.........
示例11: while
// Blending out tables in use
if ($db_info_result && PMA_DBI_num_rows($db_info_result) > 0) {
while ($tmp = PMA_DBI_fetch_row($db_info_result)) {
// if in use memorize tablename
if (preg_match('@in_use=[1-9]+@i', $tmp[1])) {
$sot_cache[$tmp[0]] = true;
}
}
PMA_DBI_free_result($db_info_result);
if (isset($sot_cache)) {
$db_info_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . $tbl_group_sql . ';', null, PMA_DBI_QUERY_STORE);
if ($db_info_result && PMA_DBI_num_rows($db_info_result) > 0) {
while ($tmp = PMA_DBI_fetch_row($db_info_result)) {
if (!isset($sot_cache[$tmp[0]])) {
$sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\';');
$sts_tmp = PMA_DBI_fetch_assoc($sts_result);
PMA_DBI_free_result($sts_result);
unset($sts_result);
if (!isset($sts_tmp['Type']) && isset($sts_tmp['Engine'])) {
$sts_tmp['Type'] =& $sts_tmp['Engine'];
}
if (!empty($tbl_group) && $cfg['ShowTooltipAliasTB'] && !preg_match('@' . preg_quote($tbl_group, '@') . '@i', $sts_tmp['Comment'])) {
continue;
}
if ($cfg['ShowTooltip']) {
PMA_fillTooltip($tooltip_truename, $tooltip_aliasname, $sts_tmp);
}
$tables[$sts_tmp['Name']] = $sts_tmp;
} else {
// table in use
$tables[$tmp[0]] = array('Name' => $tmp[0]);
示例12: while
</td>
</tr>
<tr bgcolor="<?php
echo $cfg['BgcolorTwo'];
?>
">
<td width="20"> </td>
<td colspan="2">
<label for="pdf_page_number_opt"><?php
echo $strPageNumber;
?>
</label>
<select name="pdf_page_number" id="pdf_page_number_opt">
<?php
while ($pages = @PMA_DBI_fetch_assoc($test_rs)) {
echo ' <option value="' . $pages['page_nr'] . '">' . $pages['page_nr'] . ': ' . $pages['page_descr'] . '</option>' . "\n";
}
// end while
PMA_DBI_free_result($test_rs);
unset($test_rs);
?>
</select><br />
<input type="checkbox" name="show_grid" id="show_grid_opt" /><label for="show_grid_opt"><?php
echo $strShowGrid;
?>
</label><br />
<input type="checkbox" name="show_color" id="show_color_opt" checked="checked" /><label for="show_color_opt"><?php
echo $strShowColor;
?>
示例13: __
?>
</th>
<th><?php
echo __('Original position');
?>
</th>
<th><?php
echo __('Information');
?>
</th>
</tr>
</thead>
<tbody>
<?php
$odd_row = true;
while ($value = PMA_DBI_fetch_assoc($result)) {
if (!$dontlimitchars && PMA_strlen($value['Info']) > $GLOBALS['cfg']['LimitChars']) {
$value['Info'] = PMA_substr($value['Info'], 0, $GLOBALS['cfg']['LimitChars']) . '...';
}
?>
<tr class="noclick <?php
echo $odd_row ? 'odd' : 'even';
?>
">
<td> <?php
echo $value['Log_name'];
?>
</td>
<td align="right"> <?php
echo $value['Pos'];
?>
示例14: PMA_getDbSpecificPrivsQueriesForChangeOrCopyUser
/**
* Get queries for database specific privileges for change or copy user
*
* @param array $queries queries array with string
* @param string $username username
* @param string $hostname host name
*
* @return array $queries
*/
function PMA_getDbSpecificPrivsQueriesForChangeOrCopyUser($queries, $username, $hostname)
{
$user_host_condition = ' WHERE `User`' . ' = \'' . PMA_Util::sqlAddSlashes($_REQUEST['old_username']) . "'" . ' AND `Host`' . ' = \'' . PMA_Util::sqlAddSlashes($_REQUEST['old_username']) . '\';';
$res = PMA_DBI_query('SELECT * FROM `mysql`.`db`' . $user_host_condition);
while ($row = PMA_DBI_fetch_assoc($res)) {
$queries[] = 'GRANT ' . join(', ', PMA_extractPrivInfo($row)) . ' ON ' . PMA_Util::backquote($row['Db']) . '.*' . ' TO \'' . PMA_Util::sqlAddSlashes($username) . '\'@\'' . PMA_Util::sqlAddSlashes($hostname) . '\'' . ($row['Grant_priv'] == 'Y' ? ' WITH GRANT OPTION;' : ';');
}
PMA_DBI_free_result($res);
$queries = PMA_getTablePrivsQueriesForChangeOrCopyUser($user_host_condition, $queries, $username, $hostname);
return $queries;
}
示例15: getVariablesStatus
/**
* returns array with detailed info about engine specific server variables
*
* @return array with detailed info about specific engine server variables
*/
function getVariablesStatus()
{
$variables = $this->getVariables();
$like = $this->getVariablesLikePattern();
if ($like) {
$like = " LIKE '" . $like . "' ";
} else {
$like = '';
}
$mysql_vars = array();
$sql_query = 'SHOW GLOBAL VARIABLES ' . $like . ';';
$res = PMA_DBI_query($sql_query);
while ($row = PMA_DBI_fetch_assoc($res)) {
if (isset($variables[$row['Variable_name']])) {
$mysql_vars[$row['Variable_name']] = $variables[$row['Variable_name']];
} elseif (!$like && strpos(strtolower($row['Variable_name']), strtolower($this->engine)) !== 0) {
continue;
}
$mysql_vars[$row['Variable_name']]['value'] = $row['Value'];
if (empty($mysql_vars[$row['Variable_name']]['title'])) {
$mysql_vars[$row['Variable_name']]['title'] = $row['Variable_name'];
}
if (!isset($mysql_vars[$row['Variable_name']]['type'])) {
$mysql_vars[$row['Variable_name']]['type'] = PMA_ENGINE_DETAILS_TYPE_PLAINTEXT;
}
}
PMA_DBI_free_result($res);
return $mysql_vars;
}