当前位置: 首页>>代码示例>>PHP>>正文


PHP PMA_DBI_free_result函数代码示例

本文整理汇总了PHP中PMA_DBI_free_result函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_DBI_free_result函数的具体用法?PHP PMA_DBI_free_result怎么用?PHP PMA_DBI_free_result使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PMA_DBI_free_result函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPage

 function getPage($id)
 {
     global $cfg;
     switch ($id) {
         case 'bufferpool':
             if (PMA_MYSQL_INT_VERSION < 50002) {
                 return FALSE;
             }
             // rabus: The following query is only possible because we know
             // that we are on MySQL 5 here (checked above)!
             // side note: I love MySQL 5 for this. :-)
             $res = PMA_DBI_query('SHOW STATUS WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\' OR Variable_name = \'Innodb_page_size\';');
             $status = array();
             while ($row = PMA_DBI_fetch_row($res)) {
                 $status[$row[0]] = $row[1];
             }
             PMA_DBI_free_result($res);
             unset($res, $row);
             $output = '<table>' . "\n" . '    <thead>' . "\n" . '        <tr>' . "\n" . '            <th colspan="4">' . "\n" . '                ' . $GLOBALS['strBufferPoolUsage'] . "\n" . '            </th>' . "\n" . '        </tr>' . "\n" . '    </thead>' . "\n" . '    <tfoot>' . "\n" . '        <tr>' . "\n" . '            <th>' . "\n" . '                ' . $GLOBALS['strTotalUC'] . "\n" . '            </th>' . "\n" . '            <th colspan="3">' . "\n" . '                ' . htmlspecialchars($status['Innodb_buffer_pool_pages_total']) . '&nbsp;' . $GLOBALS['strInnoDBPages'] . '&nbsp;/ ' . join('&nbsp;', PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n" . '            </th>' . "\n" . '        </tr>' . "\n" . '    </tfoot>' . "\n" . '    <tbody>' . "\n" . '        <tr>' . "\n" . '            <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . '                &nbsp;' . $GLOBALS['strFreePages'] . '&nbsp;' . "\n" . '            </td>' . "\n" . '            <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . '                ' . htmlspecialchars($status['Innodb_buffer_pool_pages_free']) . "\n" . '            </td>' . "\n" . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . '                &nbsp;' . $GLOBALS['strDirtyPages'] . '&nbsp;' . "\n" . '            </td>' . "\n" . '            <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . '                ' . htmlspecialchars($status['Innodb_buffer_pool_pages_dirty']) . "\n" . '            </td>' . "\n" . '        </tr>' . "\n" . '        <tr>' . "\n" . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . '                &nbsp;' . $GLOBALS['strDataPages'] . '&nbsp;' . "\n" . '            </td>' . "\n" . '            <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . '                ' . htmlspecialchars($status['Innodb_buffer_pool_pages_data']) . "\n" . '            </td>' . "\n" . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . '                &nbsp;' . $GLOBALS['strPagesToBeFlushed'] . '&nbsp;' . "\n" . '            </td>' . "\n" . '            <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . '                ' . htmlspecialchars($status['Innodb_buffer_pool_pages_flushed']) . "\n" . '            </td>' . "\n" . '        </tr>' . "\n" . '        <tr>' . "\n" . '            <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . '                &nbsp;' . $GLOBALS['strBusyPages'] . '&nbsp;' . "\n" . '            </td>' . "\n" . '            <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . '                ' . htmlspecialchars($status['Innodb_buffer_pool_pages_misc']) . "\n" . '            </td>' . "\n" . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . '                &nbsp;' . $GLOBALS['strLatchedPages'] . '&nbsp;' . "\n" . '            </td>' . "\n" . '            <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . '                ' . htmlspecialchars($status['Innodb_buffer_pool_pages_latched']) . "\n" . '            </td>' . "\n" . '        </tr>' . "\n" . '    </tbody>' . "\n" . '</table>' . "\n\n" . '<br />' . "\n\n" . '<table>' . "\n" . '    <thead>' . "\n" . '        <tr>' . "\n" . '            <th colspan="4">' . "\n" . '                ' . $GLOBALS['strBufferPoolActivity'] . "\n" . '            </th>' . "\n" . '        </tr>' . "\n" . '    </thead>' . "\n" . '    <tbody>' . "\n" . '        <tr>' . "\n" . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . '                &nbsp;' . $GLOBALS['strReadRequests'] . '&nbsp;' . "\n" . '            </td>' . "\n" . '            <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . '                ' . htmlspecialchars($status['Innodb_buffer_pool_read_requests']) . "\n" . '            </td>' . "\n" . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . '                &nbsp;' . $GLOBALS['strWriteRequests'] . '&nbsp;' . "\n" . '            </td>' . "\n" . '            <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . '                ' . htmlspecialchars($status['Innodb_buffer_pool_write_requests']) . "\n" . '            </td>' . "\n" . '        </tr>' . "\n" . '        <tr>' . "\n" . '            <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . '                &nbsp;' . $GLOBALS['strBufferReadMisses'] . '&nbsp;' . "\n" . '            </td>' . "\n" . '            <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . '                ' . htmlspecialchars($status['Innodb_buffer_pool_reads']) . "\n" . '            </td>' . "\n" . '            <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . '                &nbsp;' . $GLOBALS['strBufferWriteWaits'] . '&nbsp;' . "\n" . '            </td>' . "\n" . '            <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . '                ' . htmlspecialchars($status['Innodb_buffer_pool_wait_free']) . "\n" . '            </td>' . "\n" . '        </tr>' . "\n" . '        <tr>' . "\n" . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . '                &nbsp;' . $GLOBALS['strBufferReadMissesInPercent'] . '&nbsp;' . "\n" . '            </td>' . "\n" . '            <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . '                ' . ($status['Innodb_buffer_pool_read_requests'] == 0 ? '---' : htmlspecialchars(number_format($status['Innodb_buffer_pool_reads'] * 100 / $status['Innodb_buffer_pool_read_requests'], 2, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator'])) . '&nbsp;%') . "\n" . '            </td>' . "\n" . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . '                &nbsp;' . $GLOBALS['strBufferWriteWaitsInPercent'] . '&nbsp;' . "\n" . '            </td>' . "\n" . '            <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . '                ' . ($status['Innodb_buffer_pool_write_requests'] == 0 ? '---' : htmlspecialchars(number_format($status['Innodb_buffer_pool_wait_free'] * 100 / $status['Innodb_buffer_pool_write_requests'], 2, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator'])) . '&nbsp;%') . "\n" . '            </td>' . "\n" . '        </tr>' . "\n" . '    </tbody>' . "\n" . '</table>' . "\n";
             return $output;
         case 'status':
             $res = PMA_DBI_query('SHOW INNODB STATUS;');
             $row = PMA_DBI_fetch_row($res);
             PMA_DBI_free_result($res);
             return '<pre>' . "\n" . htmlspecialchars($row[0]) . "\n" . '</pre>' . "\n";
         default:
             return FALSE;
     }
 }
开发者ID:mike503,项目名称:phpmyadmin,代码行数:29,代码来源:innodb.lib.php

示例2: setProperties

 /**
  * Sets the import plugin properties.
  * Called in the constructor.
  *
  * @return void
  */
 protected function setProperties()
 {
     if ($GLOBALS['cfg']['Import']['ldi_local_option'] == 'auto') {
         $GLOBALS['cfg']['Import']['ldi_local_option'] = false;
         $result = PMA_DBI_try_query('SHOW VARIABLES LIKE \'local\\_infile\';');
         if ($result != false && PMA_DBI_num_rows($result) > 0) {
             $tmp = PMA_DBI_fetch_row($result);
             if ($tmp[1] == 'ON') {
                 $GLOBALS['cfg']['Import']['ldi_local_option'] = true;
             }
         }
         PMA_DBI_free_result($result);
         unset($result);
     }
     $generalOptions = parent::setProperties();
     $this->properties->setText('CSV using LOAD DATA');
     $this->properties->setExtension('ldi');
     $leaf = new TextPropertyItem();
     $leaf->setName("columns");
     $leaf->setText(__('Column names: '));
     $generalOptions->addProperty($leaf);
     $leaf = new BoolPropertyItem();
     $leaf->setName("ignore");
     $leaf->setText(__('Do not abort on INSERT error'));
     $generalOptions->addProperty($leaf);
     $leaf = new BoolPropertyItem();
     $leaf->setName("local_option");
     $leaf->setText(__('Use LOCAL keyword'));
     $generalOptions->addProperty($leaf);
 }
开发者ID:AmberWish,项目名称:laba_web,代码行数:36,代码来源:ImportLdi.class.php

示例3: PMA_generateEngineDetails

function PMA_generateEngineDetails($variables, $like = NULL, $indent = 0)
{
    global $cfg;
    $spaces = '';
    for ($i = 0; $i < $indent; $i++) {
        $spaces .= '    ';
    }
    /**
     * Get the variables!
     */
    if (!empty($variables)) {
        $sql_query = 'SHOW ' . (PMA_MYSQL_INT_VERSION >= 40102 ? 'GLOBAL ' : '') . 'VARIABLES' . (empty($like) ? '' : ' LIKE \'' . $like . '\'') . ';';
        $res = PMA_DBI_query($sql_query);
        $mysql_vars = array();
        while ($row = PMA_DBI_fetch_row($res)) {
            if (isset($variables[$row[0]])) {
                $mysql_vars[$row[0]] = $row[1];
            }
        }
        PMA_DBI_free_result($res);
        unset($res, $row, $sql_query);
    }
    if (empty($mysql_vars)) {
        return $spaces . '<p>' . "\n" . $spaces . '    ' . $GLOBALS['strNoDetailsForEngine'] . "\n" . $spaces . '</p>' . "\n";
    }
    $dt_table = $spaces . '<table>' . "\n";
    $useBgcolorOne = TRUE;
    $has_content = FALSE;
    foreach ($variables as $var => $details) {
        if (!isset($mysql_vars[$var])) {
            continue;
        }
        if (!isset($details['type'])) {
            $details['type'] = PMA_ENGINE_DETAILS_TYPE_PLAINTEXT;
        }
        $is_num = $details['type'] == PMA_ENGINE_DETAILS_TYPE_SIZE || $details['type'] == PMA_ENGINE_DETAILS_TYPE_NUMERIC;
        $bgcolor = $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
        $dt_table .= $spaces . '    <tr>' . "\n" . $spaces . '        <td bgcolor="' . $bgcolor . '">' . "\n";
        if (!empty($variables[$var]['desc'])) {
            $dt_table .= $spaces . '            ' . PMA_showHint($details['desc']) . "\n";
        }
        $dt_table .= $spaces . '        </td>' . "\n" . $spaces . '        <td bgcolor="' . $bgcolor . '">' . "\n" . $spaces . '            &nbsp;' . $details['title'] . '&nbsp;' . "\n" . $spaces . '        </td>' . "\n" . $spaces . '        <td bgcolor="' . $bgcolor . '"' . ($is_num ? ' align="right"' : '') . '>' . "\n" . $spaces . '            &nbsp;';
        switch ($details['type']) {
            case PMA_ENGINE_DETAILS_TYPE_SIZE:
                $parsed_size = PMA_formatByteDown($mysql_vars[$var]);
                $dt_table .= $parsed_size[0] . '&nbsp;' . $parsed_size[1];
                unset($parsed_size);
                break;
            default:
                $dt_table .= htmlspecialchars($mysql_vars[$var]);
        }
        $dt_table .= '&nbsp;' . "\n" . $spaces . '        </td>' . "\n" . $spaces . '    </tr>' . "\n";
        $useBgcolorOne = !$useBgcolorOne;
        $has_content = TRUE;
    }
    if (!$has_content) {
        return '';
    }
    return $dt_table;
}
开发者ID:mike503,项目名称:phpmyadmin,代码行数:60,代码来源:server_engines.php

示例4: 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;
 }
开发者ID:robmat,项目名称:samplebator,代码行数:71,代码来源:db_search.php

示例5: PMA_generateEngineDetails

/**
 * Function for displaying the table of an engine's parameters
 *
 * @param   array   List of MySQL variables and corresponding localized descriptions.
 *                  The array elements should have the following format:
 *                      $variable => array('title' => $title, 'desc' => $description);
 * @param   string  Prefix for the SHOW VARIABLES query.
 * @return  string  The table that was generated based on the given information.
 */
function PMA_generateEngineDetails($variables, $like = null)
{
    /**
     * Get the variables!
     */
    if (!empty($variables)) {
        $sql_query = 'SHOW ' . (PMA_MYSQL_INT_VERSION >= 40102 ? 'GLOBAL ' : '') . 'VARIABLES' . (empty($like) ? '' : ' LIKE \'' . $like . '\'') . ';';
        $res = PMA_DBI_query($sql_query);
        $mysql_vars = array();
        while ($row = PMA_DBI_fetch_row($res)) {
            if (isset($variables[$row[0]])) {
                $mysql_vars[$row[0]] = $row[1];
            }
        }
        PMA_DBI_free_result($res);
        unset($res, $row, $sql_query);
    }
    if (empty($mysql_vars)) {
        return '<p>' . "\n" . '    ' . $GLOBALS['strNoDetailsForEngine'] . "\n" . '</p>' . "\n";
    }
    $dt_table = '<table class="data" cellspacing="1">' . "\n";
    $odd_row = false;
    $has_content = false;
    foreach ($variables as $var => $details) {
        if (!isset($mysql_vars[$var])) {
            continue;
        }
        if (!isset($details['type'])) {
            $details['type'] = PMA_ENGINE_DETAILS_TYPE_PLAINTEXT;
        }
        $is_num = $details['type'] == PMA_ENGINE_DETAILS_TYPE_SIZE || $details['type'] == PMA_ENGINE_DETAILS_TYPE_NUMERIC;
        $dt_table .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n" . '    <td>' . "\n";
        if (!empty($variables[$var]['desc'])) {
            $dt_table .= '        ' . PMA_showHint($details['desc']) . "\n";
        }
        $dt_table .= '    </td>' . "\n" . '    <th>' . htmlspecialchars(empty($details['title']) ? $var : $details['title']) . "\n" . '    </th>' . "\n" . '    <td class="value">';
        switch ($details['type']) {
            case PMA_ENGINE_DETAILS_TYPE_SIZE:
                $parsed_size = PMA_formatByteDown($mysql_vars[$var]);
                $dt_table .= $parsed_size[0] . '&nbsp;' . $parsed_size[1];
                unset($parsed_size);
                break;
            case PMA_ENGINE_DETAILS_TYPE_NUMERIC:
                $dt_table .= PMA_formatNumber($mysql_vars[$var]) . ' ';
                break;
            default:
                $dt_table .= htmlspecialchars($mysql_vars[$var]) . '   ';
        }
        $dt_table .= '</td>' . "\n" . '</tr>' . "\n";
        $odd_row = !$odd_row;
        $has_content = true;
    }
    if (!$has_content) {
        return '';
    }
    $dt_table .= '</table>' . "\n";
    return $dt_table;
}
开发者ID:JakubMarden,项目名称:eshop,代码行数:67,代码来源:server_engines.php

示例6: 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;
}
开发者ID:BackupTheBerlios,项目名称:smileinstaller,代码行数:20,代码来源:tbl_indexes.lib.php

示例7: setProperties

 /**
  * Sets the import plugin properties.
  * Called in the constructor.
  *
  * @return void
  */
 protected function setProperties()
 {
     if ($GLOBALS['cfg']['Import']['ldi_local_option'] == 'auto') {
         $GLOBALS['cfg']['Import']['ldi_local_option'] = false;
         $result = PMA_DBI_try_query('SHOW VARIABLES LIKE \'local\\_infile\';');
         if ($result != false && PMA_DBI_num_rows($result) > 0) {
             $tmp = PMA_DBI_fetch_row($result);
             if ($tmp[1] == 'ON') {
                 $GLOBALS['cfg']['Import']['ldi_local_option'] = true;
             }
         }
         PMA_DBI_free_result($result);
         unset($result);
     }
     $props = 'libraries/properties/';
     include_once "{$props}/plugins/ImportPluginProperties.class.php";
     include_once "{$props}/options/groups/OptionsPropertyRootGroup.class.php";
     include_once "{$props}/options/groups/OptionsPropertyMainGroup.class.php";
     include_once "{$props}/options/items/BoolPropertyItem.class.php";
     include_once "{$props}/options/items/TextPropertyItem.class.php";
     $importPluginProperties = new ImportPluginProperties();
     $importPluginProperties->setText('CSV using LOAD DATA');
     $importPluginProperties->setExtension('ldi');
     $importPluginProperties->setOptionsText(__('Options'));
     // create the root group that will be the options field for
     // $importPluginProperties
     // this will be shown as "Format specific options"
     $importSpecificOptions = new OptionsPropertyRootGroup();
     $importSpecificOptions->setName("Format Specific Options");
     // general options main group
     $generalOptions = new OptionsPropertyMainGroup();
     $generalOptions->setName("general_opts");
     // create primary items and add them to the group
     $leaf = new BoolPropertyItem();
     $leaf->setName("replace");
     $leaf->setText(__('Replace table data with file'));
     $generalOptions->addProperty($leaf);
     // add the main group to the root group
     $importSpecificOptions->addProperty($generalOptions);
     // set the options for the import plugin property item
     $importPluginProperties->setOptions($importSpecificOptions);
     $this->properties = $importPluginProperties;
 }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:49,代码来源:ImportLdi.class.php

示例8: PMA_DBI_try_query

 *
 */
if ($plugin_param !== 'table') {
    return;
}
if (isset($plugin_list)) {
    if ($GLOBALS['cfg']['Import']['ldi_local_option'] == 'auto') {
        $GLOBALS['cfg']['Import']['ldi_local_option'] = FALSE;
        $result = PMA_DBI_try_query('SHOW VARIABLES LIKE \'local\\_infile\';');
        if ($result != FALSE && PMA_DBI_num_rows($result) > 0) {
            $tmp = PMA_DBI_fetch_row($result);
            if ($tmp[1] == 'ON') {
                $GLOBALS['cfg']['Import']['ldi_local_option'] = TRUE;
            }
        }
        PMA_DBI_free_result($result);
        unset($result);
    }
    $plugin_list['ldi'] = array('text' => __('CSV using LOAD DATA'), 'extension' => 'ldi', 'options' => array(array('type' => 'begin_group', 'name' => 'general_opts'), array('type' => 'bool', 'name' => 'replace', 'text' => __('Replace table data with file')), array('type' => 'bool', 'name' => 'ignore', 'text' => __('Do not abort on INSERT error')), array('type' => 'text', 'name' => 'terminated', 'text' => __('Columns terminated by'), 'size' => 2, 'len' => 2), array('type' => 'text', 'name' => 'enclosed', 'text' => __('Columns enclosed by'), 'size' => 2, 'len' => 2), array('type' => 'text', 'name' => 'escaped', 'text' => __('Columns escaped by'), 'size' => 2, 'len' => 2), array('type' => 'text', 'name' => 'new_line', 'text' => __('Lines terminated by'), 'size' => 2), array('type' => 'text', 'name' => 'columns', 'text' => __('Column names')), array('type' => 'bool', 'name' => 'local_option', 'text' => __('Use LOCAL keyword')), array('type' => 'end_group')), 'options_text' => __('Options'));
    /* We do not define function when plugin is just queried for information above */
    return;
}
if ($import_file == 'none' || $compression != 'none' || $charset_conversion) {
    // We handle only some kind of data!
    $message = PMA_Message::error(__('This plugin does not support compressed imports!'));
    $error = TRUE;
    return;
}
$sql = 'LOAD DATA';
if (isset($ldi_local_option)) {
    $sql .= ' LOCAL';
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:31,代码来源:ldi.php

示例9: getElement

                $reset_draginit .= '    getElement("table_' . $i . '").style.left = "2px";' . "\n";
                $reset_draginit .= '    getElement("table_' . $i . '").style.top  = "' . 15 * $i . 'px";' . "\n";
                $reset_draginit .= '    document.edcoord.elements["c_table_' . $i . '[x]"].value = "2"' . "\n";
                $reset_draginit .= '    document.edcoord.elements["c_table_' . $i . '[y]"].value = "' . 15 * $i . '"' . "\n";
                $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($temp_sh_page['table_name']) . ' FROM ' . PMA_backquote($db);
                $fields_rs = PMA_DBI_query($local_query);
                unset($local_query);
                $fields_cnt = PMA_DBI_num_rows($fields_rs);
                echo '<div id="table_' . $i . '" class="pdflayout_table"><u>' . $temp_sh_page['table_name'] . '</u>';
                if (isset($with_field_names)) {
                    while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
                        echo '<br />' . htmlspecialchars($row['Field']) . "\n";
                    }
                }
                echo '</div>' . "\n";
                PMA_DBI_free_result($fields_rs);
                unset($fields_rs);
                $i++;
            }
            ?>
</div>
<script type="text/javascript" language="javascript">
//<![CDATA[
function init() {
    refreshLayout();
    myid = getElement('pdflayout');
    <?php 
            echo $draginit;
            ?>
}
开发者ID:BGCX261,项目名称:zhss-svn-to-git,代码行数:30,代码来源:pdf_pages.php

示例10: PMA_displayPrivTable

/**
 * Displays the privileges form table
 *
 * @param string  $db     the database
 * @param string  $table  the table
 * @param boolean $submit wheather to display the submit button or not
 *
 * @global  array      $cfg         the phpMyAdmin configuration
 * @global  ressource  $user_link   the database connection
 *
 * @return void
 */
function PMA_displayPrivTable($db = '*', $table = '*', $submit = true)
{
    global $random_n;

    if ($db == '*') {
        $table = '*';
    }

    if (isset($GLOBALS['username'])) {
        $username = $GLOBALS['username'];
        $hostname = $GLOBALS['hostname'];
        if ($db == '*') {
            $sql_query = "SELECT * FROM `mysql`.`user`"
                ." WHERE `User` = '" . PMA_sqlAddSlashes($username) . "'"
                ." AND `Host` = '" . PMA_sqlAddSlashes($hostname) . "';";
        } elseif ($table == '*') {
            $sql_query = "SELECT * FROM `mysql`.`db`"
                ." WHERE `User` = '" . PMA_sqlAddSlashes($username) . "'"
                ." AND `Host` = '" . PMA_sqlAddSlashes($hostname) . "'"
                ." AND '" . PMA_unescape_mysql_wildcards($db) . "'"
                ." LIKE `Db`;";
        } else {
            $sql_query = "SELECT `Table_priv`"
                ." FROM `mysql`.`tables_priv`"
                ." WHERE `User` = '" . PMA_sqlAddSlashes($username) . "'"
                ." AND `Host` = '" . PMA_sqlAddSlashes($hostname) . "'"
                ." AND `Db` = '" . PMA_unescape_mysql_wildcards($db) . "'"
                ." AND `Table_name` = '" . PMA_sqlAddSlashes($table) . "';";
        }
        $row = PMA_DBI_fetch_single_row($sql_query);
    }
    if (empty($row)) {
        if ($table == '*') {
            if ($db == '*') {
                $sql_query = 'SHOW COLUMNS FROM `mysql`.`user`;';
            } elseif ($table == '*') {
                $sql_query = 'SHOW COLUMNS FROM `mysql`.`db`;';
            }
            $res = PMA_DBI_query($sql_query);
            while ($row1 = PMA_DBI_fetch_row($res)) {
                if (substr($row1[0], 0, 4) == 'max_') {
                    $row[$row1[0]] = 0;
                } else {
                    $row[$row1[0]] = 'N';
                }
            }
            PMA_DBI_free_result($res);
        } else {
            $row = array('Table_priv' => '');
        }
    }
    if (isset($row['Table_priv'])) {
        $row1 = PMA_DBI_fetch_single_row(
            'SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';',
            'ASSOC', $GLOBALS['userlink']
        );
        // note: in MySQL 5.0.3 we get "Create View', 'Show view';
        // the View for Create is spelled with uppercase V
        // the view for Show is spelled with lowercase v
        // and there is a space between the words

        $av_grants = explode(
            '\',\'',
            substr(
                $row1['Type'],
                strpos($row1['Type'], '(') + 2,
                strpos($row1['Type'], ')') - strpos($row1['Type'], '(') - 3
            )
        );
        unset($row1);
        $users_grants = explode(',', $row['Table_priv']);

        foreach ($av_grants as $current_grant) {
            $row[$current_grant . '_priv']
                = in_array($current_grant, $users_grants) ? 'Y' : 'N';
        }
        unset($row['Table_priv'], $current_grant, $av_grants, $users_grants);

        // get collumns
        $res = PMA_DBI_try_query(
            'SHOW COLUMNS FROM '
            . PMA_backquote(PMA_unescape_mysql_wildcards($db))
            . '.' . PMA_backquote($table) . ';'
        );
        $columns = array();
        if ($res) {
            while ($row1 = PMA_DBI_fetch_row($res)) {
                $columns[$row1[0]] = array(
//.........这里部分代码省略.........
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:101,代码来源:server_privileges.php

示例11: PMA_setMIME

/**
* Set a single mimetype to a certain value.
*
* @param   string   the name of the db
* @param   string   the name of the table
* @param   string   the name of the column
* @param   string   the mimetype of the column
* @param   string   the transformation of the column
* @param   string   the transformation options of the column
* @param   string   (optional) force delete, will erase any existing comments for this column
*
* @return  boolean  true, if comment-query was made.
*
* @global  array    the list of relations settings
*
* @access  public
*/
function PMA_setMIME($db, $table, $key, $mimetype, $transformation, $transformation_options, $forcedelete = false)
{
    global $cfgRelation;
    $test_qry = 'SELECT mimetype, ' . PMA_backquote('comment') . ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
    $test_rs = PMA_query_as_cu($test_qry, TRUE, PMA_DBI_QUERY_STORE);
    if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
        $row = @PMA_DBI_fetch_assoc($test_rs);
        PMA_DBI_free_result($test_rs);
        unset($test_rs);
        if (!$forcedelete && (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0 || strlen($row['comment']) > 0)) {
            $upd_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . ' SET mimetype = \'' . PMA_sqlAddslashes($mimetype) . '\',' . '     transformation = \'' . PMA_sqlAddslashes($transformation) . '\',' . '     transformation_options = \'' . PMA_sqlAddslashes($transformation_options) . '\'' . ' WHERE db_name  = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
        } else {
            $upd_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . ' WHERE db_name  = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
        }
    } elseif (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0) {
        $upd_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . ' (db_name, table_name, column_name, mimetype, transformation, transformation_options) ' . ' VALUES(' . '\'' . PMA_sqlAddslashes($db) . '\',' . '\'' . PMA_sqlAddslashes($table) . '\',' . '\'' . PMA_sqlAddslashes($key) . '\',' . '\'' . PMA_sqlAddslashes($mimetype) . '\',' . '\'' . PMA_sqlAddslashes($transformation) . '\',' . '\'' . PMA_sqlAddslashes($transformation_options) . '\')';
    }
    if (isset($upd_query)) {
        $upd_rs = PMA_query_as_cu($upd_query);
        PMA_DBI_free_result($upd_rs);
        unset($upd_rs);
        return true;
    } else {
        return false;
    }
}
开发者ID:johangas,项目名称:moped,代码行数:43,代码来源:transformations.lib.php

示例12: PMA_showMessage

    /**
     * Displays a message at the top of the "main" (right) frame
     *
     * @param   string  the message to display
     *
     * @global  array   the configuration array
     *
     * @access  public
     */
    function PMA_showMessage($message)
    {
        global $cfg;
        // Sanitizes $message
        $message = PMA_sanitize($message);
        // Corrects the tooltip text via JS if required
        if (!empty($GLOBALS['table']) && $cfg['ShowTooltip']) {
            $result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\'');
            if ($result) {
                $tbl_status = PMA_DBI_fetch_assoc($result);
                $tooltip = empty($tbl_status['Comment']) ? '' : $tbl_status['Comment'] . ' ';
                $tooltip .= '(' . $tbl_status['Rows'] . ' ' . $GLOBALS['strRows'] . ')';
                PMA_DBI_free_result($result);
                $md5_tbl = md5($GLOBALS['table']);
                echo "\n";
                ?>
<script type="text/javascript" language="javascript1.2">
<!--
if (typeof(document.getElementById) != 'undefined'
    && typeof(window.parent.frames['nav']) != 'undefined'
    && typeof(window.parent.frames['nav'].document) != 'undefined' && typeof(window.parent.frames['nav'].document) != 'unknown'
    && (window.parent.frames['nav'].document.getElementById('<?php 
                echo 'tbl_' . $md5_tbl;
                ?>
'))
    && typeof(window.parent.frames['nav'].document.getElementById('<?php 
                echo 'tbl_' . $md5_tbl;
                ?>
')) != 'undefined'
    && typeof(window.parent.frames['nav'].document.getElementById('<?php 
                echo 'tbl_' . $md5_tbl;
                ?>
').title) == 'string') {
    window.parent.frames['nav'].document.getElementById('<?php 
                echo 'tbl_' . $md5_tbl;
                ?>
').title = '<?php 
                echo PMA_jsFormat($tooltip, FALSE);
                ?>
';
}
//-->
</script>
                <?php 
            }
            // end if
        }
        // end if... else if
        // Checks if the table needs to be repaired after a TRUNCATE query.
        if (isset($GLOBALS['table']) && isset($GLOBALS['sql_query']) && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) {
            if (!isset($tbl_status)) {
                $result = @PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\'');
                if ($result) {
                    $tbl_status = PMA_DBI_fetch_assoc($result);
                    PMA_DBI_free_result($result);
                }
            }
            if (isset($tbl_status) && (int) $tbl_status['Index_length'] > 1024) {
                PMA_DBI_try_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table']));
            }
        }
        unset($tbl_status);
        echo "\n";
        ?>
<br />
<div align="<?php 
        echo $GLOBALS['cell_align_left'];
        ?>
">
    <table border="<?php 
        echo $cfg['Border'];
        ?>
" cellpadding="5" cellspacing="1">
    <tr>
        <th<?php 
        echo $GLOBALS['theme'] != 'original' ? ' class="tblHeaders"' : ' bgcolor="' . $cfg['ThBgcolor'] . '"';
        ?>
>
            <b><?php 
        echo $message;
        ?>
</b>
        </th>
    </tr>
        <?php 
        if ($cfg['ShowSQL'] == TRUE && (!empty($GLOBALS['sql_query']) || !empty($GLOBALS['display_query']))) {
            $local_query = !empty($GLOBALS['display_query']) ? $GLOBALS['display_query'] : ($cfg['SQP']['fmtType'] == 'none' && isset($GLOBALS['unparsed_sql']) && $GLOBALS['unparsed_sql'] != '' ? $GLOBALS['unparsed_sql'] : $GLOBALS['sql_query']);
            // Basic url query part
            $url_qpart = '?' . PMA_generate_common_url(isset($GLOBALS['db']) ? $GLOBALS['db'] : '', isset($GLOBALS['table']) ? $GLOBALS['table'] : '');
            echo "\n";
            ?>
//.........这里部分代码省略.........
开发者ID:Apxe,项目名称:Rubin_final,代码行数:101,代码来源:common.lib.php

示例13: _checkAgainstPrivTables

    /**
     * this is just a backup, if all is fine this can be deleted later
     *
     * @deprecated
     */
    protected function _checkAgainstPrivTables()
    {
        // 1. get allowed dbs from the "mysql.db" table
        // lem9: User can be blank (anonymous user)
        $local_query = "
            SELECT DISTINCT `Db` FROM `mysql`.`db`
            WHERE `Select_priv` = 'Y'
            AND `User`
            IN ('" . PMA_sqlAddslashes($GLOBALS['cfg']['Server']['user']) . "', '')";
        $tmp_mydbs = PMA_DBI_fetch_result($local_query, null, null,
            $GLOBALS['controllink']);
        if ($tmp_mydbs) {
            // Will use as associative array of the following 2 code
            // lines:
            //   the 1st is the only line intact from before
            //     correction,
            //   the 2nd replaces $dblist[] = $row['Db'];

            // Code following those 2 lines in correction continues
            // populating $dblist[], as previous code did. But it is
            // now populated with actual database names instead of
            // with regular expressions.
            $tmp_alldbs = PMA_DBI_query('SHOW DATABASES;', $GLOBALS['controllink']);
            // loic1: all databases cases - part 2
            if (isset($tmp_mydbs['%'])) {
                while ($tmp_row = PMA_DBI_fetch_row($tmp_alldbs)) {
                    $dblist[] = $tmp_row[0];
                } // end while
            } else {
                while ($tmp_row = PMA_DBI_fetch_row($tmp_alldbs)) {
                    $tmp_db = $tmp_row[0];
                    if (isset($tmp_mydbs[$tmp_db]) && $tmp_mydbs[$tmp_db] == 1) {
                        $dblist[]           = $tmp_db;
                        $tmp_mydbs[$tmp_db] = 0;
                    } elseif (!isset($dblist[$tmp_db])) {
                        foreach ($tmp_mydbs as $tmp_matchpattern => $tmp_value) {
                            // loic1: fixed bad regexp
                            // TODO: db names may contain characters
                            //       that are regexp instructions
                            $re        = '(^|(\\\\\\\\)+|[^\])';
                            $tmp_regex = preg_replace('/' . addcslashes($re,'/') . '%/', '\\1.*', preg_replace('/' . addcslashes($re,'/') . '_/', '\\1.{1}', $tmp_matchpattern));
                            // Fixed db name matching
                            // 2000-08-28 -- Benjamin Gandon
                            if (preg_match('/^' . addcslashes($tmp_regex,'/') . '$/', $tmp_db)) {
                                $dblist[] = $tmp_db;
                                break;
                            }
                        } // end while
                    } // end if ... elseif ...
                } // end while
            } // end else
            PMA_DBI_free_result($tmp_alldbs);
            unset($tmp_mydbs);
        } // end if

        // 2. get allowed dbs from the "mysql.tables_priv" table
        $local_query = 'SELECT DISTINCT Db FROM mysql.tables_priv WHERE Table_priv LIKE \'%Select%\' AND User = \'' . PMA_sqlAddslashes($GLOBALS['cfg']['Server']['user']) . '\'';
        $rs          = PMA_DBI_try_query($local_query, $GLOBALS['controllink']);
        if ($rs && @PMA_DBI_num_rows($rs)) {
            while ($row = PMA_DBI_fetch_assoc($rs)) {
                if (!in_array($row['Db'], $dblist)) {
                    $dblist[] = $row['Db'];
                }
            } // end while
            PMA_DBI_free_result($rs);
        } // end if
    }
开发者ID:blumenbach,项目名称:blumenbach-online.de,代码行数:72,代码来源:List_Database.class.php

示例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;
}
开发者ID:SashiAsakura,项目名称:AWS_QuikID_website,代码行数:20,代码来源:server_privileges.lib.php

示例15: PMA_getTableCount

/**
 * returns count of tables in given db
 *
 * @param string $db database to count tables for
 *
 * @return integer count of tables in $db
 */
function PMA_getTableCount($db)
{
    $tables = PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_Util::backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
    if ($tables) {
        $num_tables = PMA_DBI_num_rows($tables);
        PMA_DBI_free_result($tables);
    } else {
        $num_tables = 0;
    }
    return $num_tables;
}
开发者ID:mindfeederllc,项目名称:openemr,代码行数:18,代码来源:core.lib.php


注:本文中的PMA_DBI_free_result函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。