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


PHP PMA_DBI_fetch_row函数代码示例

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


在下文中一共展示了PMA_DBI_fetch_row函数的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_analyseShowGrant

function PMA_analyseShowGrant($rs_usr, &$is_create_priv, &$db_to_create, &$is_reload_priv)
{
    $re0 = '(^|(\\\\\\\\)+|[^\\])';
    // non-escaped wildcards
    $re1 = '(^|[^\\])(\\\\)+';
    // escaped wildcards
    while ($row = PMA_DBI_fetch_row($rs_usr)) {
        $show_grants_dbname = substr($row[0], strpos($row[0], ' ON ') + 4, strpos($row[0], '.', strpos($row[0], ' ON ')) - strpos($row[0], ' ON ') - 4);
        $show_grants_dbname = ereg_replace('^`(.*)`', '\\1', $show_grants_dbname);
        $show_grants_str = substr($row[0], 6, strpos($row[0], ' ON ') - 6);
        if ($show_grants_str == 'ALL' || $show_grants_str == 'ALL PRIVILEGES' || $show_grants_str == 'CREATE' || strpos($show_grants_str, 'CREATE')) {
            if ($show_grants_dbname == '*') {
                $is_create_priv = TRUE;
                $is_reload_priv = TRUE;
                $db_to_create = '';
                break;
            } else {
                if (ereg($re0 . '%|_', $show_grants_dbname) && !ereg('\\\\%|\\\\_', $show_grants_dbname) || !PMA_DBI_try_query('USE ' . ereg_replace($re1 . '(%|_)', '\\1\\3', $show_grants_dbname)) && substr(PMA_DBI_getError(), 1, 4) != 1044) {
                    $db_to_create = ereg_replace($re0 . '%', '\\1...', ereg_replace($re0 . '_', '\\1?', $show_grants_dbname));
                    $db_to_create = ereg_replace($re1 . '(%|_)', '\\1\\3', $db_to_create);
                    $is_create_priv = TRUE;
                    break;
                }
            }
            // end elseif
        }
        // end if
    }
    // end while
}
开发者ID:mike503,项目名称:phpmyadmin,代码行数:30,代码来源:check_user_privileges.lib.php

示例4: 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

示例5: get_script_contr

/**
 * returns JavaScript code for intializing vars
 *
 * @return string   JavaScript code
 */
function get_script_contr()
{
    PMA_DBI_select_db($GLOBALS['db']);
    $con["C_NAME"] = array();
    $i = 0;
    $alltab_rs = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($GLOBALS['db']), null, PMA_DBI_QUERY_STORE);
    while ($val = @PMA_DBI_fetch_row($alltab_rs)) {
        $row = PMA_getForeigners($GLOBALS['db'], $val[0], '', 'internal');
        //echo "<br> internal ".$GLOBALS['db']." - ".$val[0]." - ";
        //print_r($row);
        if ($row !== false) {
            foreach ($row as $field => $value) {
                $con['C_NAME'][$i] = '';
                $con['DTN'][$i] = urlencode($GLOBALS['db'] . "." . $val[0]);
                $con['DCN'][$i] = urlencode($field);
                $con['STN'][$i] = urlencode($value['foreign_db'] . "." . $value['foreign_table']);
                $con['SCN'][$i] = urlencode($value['foreign_field']);
                $i++;
            }
        }
        $row = PMA_getForeigners($GLOBALS['db'], $val[0], '', 'foreign');
        //echo "<br> INNO ";
        //print_r($row);
        if ($row !== false) {
            foreach ($row as $field => $value) {
                $con['C_NAME'][$i] = '';
                $con['DTN'][$i] = urlencode($GLOBALS['db'] . "." . $val[0]);
                $con['DCN'][$i] = urlencode($field);
                $con['STN'][$i] = urlencode($value['foreign_db'] . "." . $value['foreign_table']);
                $con['SCN'][$i] = urlencode($value['foreign_field']);
                $i++;
            }
        }
    }
    $ti = 0;
    $script_contr = '<script type="text/javascript">' . "\n" . '// <![CDATA[' . "\n" . 'var contr = new Array();' . "\n";
    for ($i = 0, $cnt = count($con["C_NAME"]); $i < $cnt; $i++) {
        $js_var = ' contr[' . $ti . ']';
        $script_contr .= $js_var . " = new Array();\n";
        $js_var .= "['" . $con['C_NAME'][$i] . "']";
        $script_contr .= $js_var . " = new Array();\n";
        if (in_array($con['DTN'][$i], $GLOBALS['PMD_URL']["TABLE_NAME"]) && in_array($con['STN'][$i], $GLOBALS['PMD_URL']["TABLE_NAME"])) {
            $js_var .= "['" . $con['DTN'][$i] . "']";
            $script_contr .= $js_var . " = new Array();\n";
            $m_col = array();
            //}
            $js_var .= "['" . $con['DCN'][$i] . "']";
            $script_contr .= $js_var . " = new Array();\n";
            //}
            $script_contr .= $js_var . "[0] = '" . $con['STN'][$i] . "';\n";
            //
            $script_contr .= $js_var . "[1] = '" . $con['SCN'][$i] . "';\n";
            //
        }
        $ti++;
    }
    $script_contr .= '// ]]>' . "\n" . '</script>' . "\n";
    return $script_contr;
}
开发者ID:AmberWish,项目名称:laba_web,代码行数:64,代码来源:pmd_common.php

示例6: 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

示例7: PMA_analyseShowGrant

function PMA_analyseShowGrant($rs_usr, &$is_create_db_priv, &$db_to_create, &$is_reload_priv, &$dbs_where_create_table_allowed)
{
    $re0 = '(^|(\\\\\\\\)+|[^\\])';
    // non-escaped wildcards
    $re1 = '(^|[^\\])(\\\\)+';
    // escaped wildcards
    while ($row = PMA_DBI_fetch_row($rs_usr)) {
        $show_grants_dbname = substr($row[0], strpos($row[0], ' ON ') + 4, strpos($row[0], '.', strpos($row[0], ' ON ')) - strpos($row[0], ' ON ') - 4);
        $show_grants_dbname = ereg_replace('^`(.*)`', '\\1', $show_grants_dbname);
        $show_grants_str = substr($row[0], 6, strpos($row[0], ' ON ') - 6);
        if ($show_grants_str == 'RELOAD') {
            $is_reload_priv = true;
        }
        /**
         * @todo if we find CREATE VIEW but not CREATE, do not offer  
         * the create database dialog box
         */
        if ($show_grants_str == 'ALL' || $show_grants_str == 'ALL PRIVILEGES' || $show_grants_str == 'CREATE' || strpos($show_grants_str, 'CREATE,') !== false) {
            if ($show_grants_dbname == '*') {
                // a global CREATE privilege
                $is_create_db_priv = true;
                $is_reload_priv = true;
                $db_to_create = '';
                $dbs_where_create_table_allowed[] = '*';
                break;
            } else {
                // this array may contain wildcards
                $dbs_where_create_table_allowed[] = $show_grants_dbname;
                // before MySQL 4.1.0, we cannot use backquotes around a dbname
                // for the USE command, so the USE will fail if the dbname contains
                // a "-" and we cannot detect if such a db already exists;
                // since 4.1.0, we need to use backquotes if the dbname contains a "-"
                // in a USE command
                if (PMA_MYSQL_INT_VERSION > 40100) {
                    $dbname_to_test = PMA_backquote($show_grants_dbname);
                } else {
                    $dbname_to_test = $show_grants_dbname;
                }
                if (ereg($re0 . '%|_', $show_grants_dbname) && !ereg('\\\\%|\\\\_', $show_grants_dbname) || !PMA_DBI_try_query('USE ' . ereg_replace($re1 . '(%|_)', '\\1\\3', $dbname_to_test), null, PMA_DBI_QUERY_STORE) && substr(PMA_DBI_getError(), 1, 4) != 1044) {
                    $db_to_create = ereg_replace($re0 . '%', '\\1...', ereg_replace($re0 . '_', '\\1?', $show_grants_dbname));
                    $db_to_create = ereg_replace($re1 . '(%|_)', '\\1\\3', $db_to_create);
                    $is_create_db_priv = true;
                    /**
                     * @todo collect $db_to_create into an array, to display a
                     * drop-down in the "Create new database" dialog
                     */
                    // we don't break, we want all possible databases
                    //break;
                }
                // end if
            }
            // end elseif
        }
        // end if
    }
    // end while
}
开发者ID:Kishaaa,项目名称:cs160-website,代码行数:57,代码来源:check_user_privileges.lib.php

示例8: get_script_contr

function get_script_contr()
{
    global $db;
    PMA_DBI_select_db($db);
    $con["C_NAME"] = array();
    $i = 0;
    $alltab_rs = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db), NULL, PMA_DBI_QUERY_STORE);
    while ($val = @PMA_DBI_fetch_row($alltab_rs)) {
        $row = PMA_getForeigners($db, $val[0], '', 'internal');
        //echo "<br> internal ".$db." - ".$val[0]." - ";
        //print_r($row );
        if ($row !== false) {
            foreach ($row as $field => $value) {
                $con['C_NAME'][$i] = '';
                $con['DTN'][$i] = urlencode($db . "." . $val[0]);
                $con['DCN'][$i] = urlencode($field);
                $con['STN'][$i] = urlencode($value['foreign_db'] . "." . $value['foreign_table']);
                $con['SCN'][$i] = urlencode($value['foreign_field']);
                $i++;
            }
        }
        $row = PMA_getForeigners($db, $val[0], '', 'innodb');
        //echo "<br> INNO ";
        //print_r($row );
        if ($row !== false) {
            foreach ($row as $field => $value) {
                $con['C_NAME'][$i] = '';
                $con['DTN'][$i] = urlencode($db . "." . $val[0]);
                $con['DCN'][$i] = urlencode($field);
                $con['STN'][$i] = urlencode($value['foreign_db'] . "." . $value['foreign_table']);
                $con['SCN'][$i] = urlencode($value['foreign_field']);
                $i++;
            }
        }
    }
    $ti = 0;
    $script_contr = "<script>\n var contr = new Array();\n";
    for ($i = 0; $i < sizeof($con["C_NAME"]); $i++) {
        $script_contr .= " contr[{$ti}] = new Array();\n";
        $script_contr .= "  contr[{$ti}]['" . $con['C_NAME'][$i] . "'] = new Array();\n";
        if (in_array($con['DTN'][$i], $GLOBALS['PMD_URL']["TABLE_NAME"]) && in_array($con['STN'][$i], $GLOBALS['PMD_URL']["TABLE_NAME"])) {
            $script_contr .= "  contr[{$ti}]['" . $con['C_NAME'][$i] . "']['" . $con['DTN'][$i] . "'] = new Array();\n";
            $m_col = array();
            //}
            $script_contr .= "  contr[{$ti}]['" . $con['C_NAME'][$i] . "']['" . $con['DTN'][$i] . "']['" . $con['DCN'][$i] . "'] = new Array();\n";
            //}
            $script_contr .= "    contr[{$ti}]['" . $con['C_NAME'][$i] . "']['" . $con['DTN'][$i] . "']['" . $con['DCN'][$i] . "'][0] = '" . $con['STN'][$i] . "';\n";
            //
            $script_contr .= "    contr[{$ti}]['" . $con['C_NAME'][$i] . "']['" . $con['DTN'][$i] . "']['" . $con['DCN'][$i] . "'][1] = '" . $con['SCN'][$i] . "';\n";
            //
        }
        $ti++;
    }
    $script_contr .= "</script>\n";
    return $script_contr;
}
开发者ID:BGCX261,项目名称:zhe-project-agri-hg-to-git,代码行数:56,代码来源:pmd_common.php

示例9: get_script_contr

/**
 * returns JavaScript code for intializing vars
 *
 * @return string   JavaScript code
 */
function get_script_contr()
{
    PMA_DBI_select_db($GLOBALS['db']);
    $con["C_NAME"] = array();
    $i = 0;
    $alltab_rs = PMA_DBI_query('SHOW TABLES FROM ' . PMA_Util::backquote($GLOBALS['db']), null, PMA_DBI_QUERY_STORE);
    while ($val = @PMA_DBI_fetch_row($alltab_rs)) {
        $row = PMA_getForeigners($GLOBALS['db'], $val[0], '', 'internal');
        //echo "<br> internal ".$GLOBALS['db']." - ".$val[0]." - ";
        //print_r($row);
        if ($row !== false) {
            foreach ($row as $field => $value) {
                $con['C_NAME'][$i] = '';
                $con['DTN'][$i] = urlencode($GLOBALS['db'] . "." . $val[0]);
                $con['DCN'][$i] = urlencode($field);
                $con['STN'][$i] = urlencode($value['foreign_db'] . "." . $value['foreign_table']);
                $con['SCN'][$i] = urlencode($value['foreign_field']);
                $i++;
            }
        }
        $row = PMA_getForeigners($GLOBALS['db'], $val[0], '', 'foreign');
        //echo "<br> INNO ";
        //print_r($row);
        if ($row !== false) {
            foreach ($row as $field => $value) {
                $con['C_NAME'][$i] = '';
                $con['DTN'][$i] = urlencode($GLOBALS['db'] . "." . $val[0]);
                $con['DCN'][$i] = urlencode($field);
                $con['STN'][$i] = urlencode($value['foreign_db'] . "." . $value['foreign_table']);
                $con['SCN'][$i] = urlencode($value['foreign_field']);
                $i++;
            }
        }
    }
    $ti = 0;
    $retval = array();
    for ($i = 0, $cnt = count($con["C_NAME"]); $i < $cnt; $i++) {
        $c_name_i = $con['C_NAME'][$i];
        $dtn_i = $con['DTN'][$i];
        $retval[$ti] = array();
        $retval[$ti][$c_name_i] = array();
        if (in_array($dtn_i, $GLOBALS['PMD_URL']["TABLE_NAME"]) && in_array($con['STN'][$i], $GLOBALS['PMD_URL']["TABLE_NAME"])) {
            $retval[$ti][$c_name_i][$dtn_i] = array();
            $retval[$ti][$c_name_i][$dtn_i][$con['DCN'][$i]] = array(0 => $con['STN'][$i], 1 => $con['SCN'][$i]);
        }
        $ti++;
    }
    return $retval;
}
开发者ID:mindfeederllc,项目名称:openemr,代码行数:54,代码来源:pmd_common.php

示例10: 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

示例11: PMA_asWKT

/**
 * Converts GIS data to Well Known Text format
 *
 * @param binary $data        GIS data
 * @param bool   $includeSRID Add SRID to the WKT
 *
 * @return GIS data in Well Know Text format
 */
function PMA_asWKT($data, $includeSRID = false)
{
    // Convert to WKT format
    $hex = bin2hex($data);
    $wktsql = "SELECT ASTEXT(x'" . $hex . "')";
    if ($includeSRID) {
        $wktsql .= ", SRID(x'" . $hex . "')";
    }
    $wktresult = PMA_DBI_try_query($wktsql, null, PMA_DBI_QUERY_STORE);
    $wktarr = PMA_DBI_fetch_row($wktresult, 0);
    $wktval = $wktarr[0];
    if ($includeSRID) {
        $srid = $wktarr[1];
        $wktval = "'" . $wktval . "'," . $srid;
    }
    @PMA_DBI_free_result($wktresult);
    return $wktval;
}
开发者ID:AmberWish,项目名称:laba_web,代码行数:26,代码来源:common.lib.php

示例12: PMA_prepare_row_data

/**
 * Prepares the displayable content of a data cell in Browse mode,
 * taking into account foreign key description field and transformations
 *
 * @uses    is_array()
 * @uses    PMA_backquote()
 * @uses    PMA_DBI_try_query()
 * @uses    PMA_DBI_num_rows()
 * @uses    PMA_DBI_fetch_row()
 * @uses    $GLOBALS['strLinkNotFound']
 * @uses    PMA_DBI_free_result()
 * @uses    $GLOBALS['printview']
 * @uses    htmlspecialchars()
 * @uses    PMA_generate_common_url()
 * @param   string  $mouse_events
 * @param   string  $class
 * @param   string  $condition_field
 * @param   string  $analyzed_sql
 * @param   object  $meta   the meta-information about this field
 * @param   string  $map
 * @param   string  $data
 * @param   string  $transform_function
 * @param   string  $default_function
 * @param   string  $nowrap
 * @param   string  $where_comparison
 * @return  string  formatted data
 */
function PMA_prepare_row_data($mouse_events, $class, $condition_field, $analyzed_sql, $meta, $map, $data, $transform_function, $default_function, $nowrap, $where_comparison, $transform_options)
{
    // continue the <td> tag started before calling this function:
    $result = $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . $nowrap . '">';
    if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
        foreach ($analyzed_sql[0]['select_expr'] as $select_expr_position => $select_expr) {
            $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
            if (isset($alias) && strlen($alias)) {
                $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
                if ($alias == $meta->name) {
                    // this change in the parameter does not matter
                    // outside of the function
                    $meta->name = $true_column;
                }
                // end if
            }
            // end if
        }
        // end foreach
    }
    // end if
    if (isset($map[$meta->name])) {
        // Field to display from the foreign table?
        if (isset($map[$meta->name][2]) && strlen($map[$meta->name][2])) {
            $dispsql = 'SELECT ' . PMA_backquote($map[$meta->name][2]) . ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . $where_comparison;
            $dispresult = PMA_DBI_try_query($dispsql, null, PMA_DBI_QUERY_STORE);
            if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
                list($dispval) = PMA_DBI_fetch_row($dispresult, 0);
            } else {
                $dispval = $GLOBALS['strLinkNotFound'];
            }
            @PMA_DBI_free_result($dispresult);
        } else {
            $dispval = '';
        }
        // end if... else...
        if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
            $result .= ($transform_function != $default_function ? $transform_function($data, $transform_options, $meta) : $transform_function($data, array(), $meta)) . ' <code>[-&gt;' . $dispval . ']</code>';
        } else {
            if ('K' == $_SESSION['tmp_user_values']['relational_display']) {
                // user chose "relational key" in the display options, so
                // the title contains the display field
                $title = !empty($dispval) ? ' title="' . htmlspecialchars($dispval) . '"' : '';
            } else {
                $title = ' title="' . htmlspecialchars($data) . '"';
            }
            $_url_params = array('db' => $map[$meta->name][3], 'table' => $map[$meta->name][0], 'pos' => '0', 'sql_query' => 'SELECT * FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . $where_comparison);
            $result .= '<a href="sql.php' . PMA_generate_common_url($_url_params) . '"' . $title . '>';
            if ($transform_function != $default_function) {
                // always apply a transformation on the real data,
                // not on the display field
                $result .= $transform_function($data, $transform_options, $meta);
            } else {
                if ('D' == $_SESSION['tmp_user_values']['relational_display']) {
                    // user chose "relational display field" in the
                    // display options, so show display field in the cell
                    $result .= $transform_function($dispval, array(), $meta);
                } else {
                    // otherwise display data in the cell
                    $result .= $transform_function($data, array(), $meta);
                }
            }
            $result .= '</a>';
        }
    } else {
        $result .= $transform_function != $default_function ? $transform_function($data, $transform_options, $meta) : $transform_function($data, array(), $meta);
    }
    $result .= '</td>' . "\n";
    return $result;
}
开发者ID:kolbermoorer,项目名称:edugame,代码行数:97,代码来源:display_tbl.lib.php

示例13: PMA_replication_master_replicated_dbs

/**
 * Get list of replicated databases on master server
 * 
 * @param mixed mysql link
 *
 * @return array array of replicated databases
 */
function PMA_replication_master_replicated_dbs($link = null)
{
    $data = PMA_DBI_fetch_result('SHOW MASTER STATUS', null, null, $link);
    // let's find out, which databases are replicated
    $do_db = array();
    $ignore_db = array();
    if (!empty($data[0]['Binlog_Do_DB'])) {
        $do_db = explode(',', $data[0]['Binlog_Do_DB']);
    }
    if (!empty($data[0]['Binlog_Ignore_DB'])) {
        $ignore_db = explode(',', $data[0]['Binlog_Ignore_DB']);
    }
    $tmp_alldbs = PMA_DBI_query('SHOW DATABASES;', $link);
    while ($tmp_row = PMA_DBI_fetch_row($tmp_alldbs)) {
        if ($tmp_row[0] == 'information_schema') {
            continue;
        }
        if (count($do_db) == 0) {
            if (array_search($tmp_row[0], $ignore_db) !== false) {
                continue;
            }
            $dblist[] = $tmp_row[0];
        } else {
            if (array_search($tmp_row[0], $do_db) !== false) {
                $dblist[] = $tmp_row[0];
            }
        }
    }
    // end while
    return $link;
}
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:38,代码来源:replication.inc.php

示例14: exportData


//.........这里部分代码省略.........
             }
             // insert ignore?
             if (isset($GLOBALS['sql_type']) && $GLOBALS['sql_type'] == 'INSERT' && isset($GLOBALS['sql_ignore'])) {
                 $insert_delayed .= ' IGNORE';
             }
             //truncate table before insert
             if (isset($GLOBALS['sql_truncate']) && $GLOBALS['sql_truncate'] && $sql_command == 'INSERT') {
                 $truncate = 'TRUNCATE TABLE ' . PMA_Util::backquoteCompat($table, $compat, $sql_backquotes) . ";";
                 $truncatehead = $this->_possibleCRLF() . $this->_exportComment() . $this->_exportComment(__('Truncate table before insert') . ' ' . $formatted_table_name) . $this->_exportComment() . $crlf;
                 PMA_exportOutputHandler($truncatehead);
                 PMA_exportOutputHandler($truncate);
             } else {
                 $truncate = '';
             }
             // scheme for inserting fields
             if ($GLOBALS['sql_insert_syntax'] == 'complete' || $GLOBALS['sql_insert_syntax'] == 'both') {
                 $fields = implode(', ', $field_set);
                 $schema_insert = $sql_command . $insert_delayed . ' INTO ' . PMA_Util::backquoteCompat($table, $compat, $sql_backquotes) . ' (' . $fields . ') VALUES';
             } else {
                 $schema_insert = $sql_command . $insert_delayed . ' INTO ' . PMA_Util::backquoteCompat($table, $compat, $sql_backquotes) . ' VALUES';
             }
         }
         //\x08\\x09, not required
         $search = array("", "\n", "\r", "");
         $replace = array('\\0', '\\n', '\\r', '\\Z');
         $current_row = 0;
         $query_size = 0;
         if (($GLOBALS['sql_insert_syntax'] == 'extended' || $GLOBALS['sql_insert_syntax'] == 'both') && (!isset($GLOBALS['sql_type']) || $GLOBALS['sql_type'] != 'UPDATE')) {
             $separator = ',';
             $schema_insert .= $crlf;
         } else {
             $separator = ';';
         }
         while ($row = PMA_DBI_fetch_row($result)) {
             if ($current_row == 0) {
                 $head = $this->_possibleCRLF() . $this->_exportComment() . $this->_exportComment(__('Dumping data for table') . ' ' . $formatted_table_name) . $this->_exportComment() . $crlf;
                 if (!PMA_exportOutputHandler($head)) {
                     return false;
                 }
             }
             // We need to SET IDENTITY_INSERT ON for MSSQL
             if (isset($GLOBALS['sql_compatibility']) && $GLOBALS['sql_compatibility'] == 'MSSQL' && $current_row == 0) {
                 if (!PMA_exportOutputHandler('SET IDENTITY_INSERT ' . PMA_Util::backquoteCompat($table, $compat) . ' ON ;' . $crlf)) {
                     return false;
                 }
             }
             $current_row++;
             for ($j = 0; $j < $fields_cnt; $j++) {
                 // NULL
                 if (!isset($row[$j]) || is_null($row[$j])) {
                     $values[] = 'NULL';
                 } elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp' && !$fields_meta[$j]->blob) {
                     // a number
                     // timestamp is numeric on some MySQL 4.1, BLOBs are
                     // sometimes numeric
                     $values[] = $row[$j];
                 } elseif (stristr($field_flags[$j], 'BINARY') && $fields_meta[$j]->blob && isset($GLOBALS['sql_hex_for_blob'])) {
                     // a true BLOB
                     // - mysqldump only generates hex data when the --hex-blob
                     //   option is used, for fields having the binary attribute
                     //   no hex is generated
                     // - a TEXT field returns type blob but a real blob
                     //   returns also the 'binary' flag
                     // empty blobs need to be different, but '0' is also empty
                     // :-(
                     if (empty($row[$j]) && $row[$j] != '0') {
开发者ID:fanscky,项目名称:HTPMS,代码行数:67,代码来源:ExportSql.class.php

示例15: PMA_exportData

/**
 * Outputs the content of a table in CSV format
 *
 * @param   string      the database name
 * @param   string      the table name
 * @param   string      the end of line sequence
 * @param   string      the url to go back in case of error
 * @param   string      SQL query for obtaining data
 *
 * @return  bool        Whether it suceeded
 *
 * @access  public
 */
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
{
    global $what;
    global $add_character;
    global $separator;
    global $enclosed;
    global $escaped;
    // Gets the data from the database
    $result = PMA_DBI_query($sql_query, NULL, PMA_DBI_QUERY_UNBUFFERED);
    $fields_cnt = PMA_DBI_num_fields($result);
    // If required, get fields name at the first line
    if (isset($GLOBALS['showcsvnames']) && $GLOBALS['showcsvnames'] == 'yes') {
        $schema_insert = '';
        for ($i = 0; $i < $fields_cnt; $i++) {
            if ($enclosed == '') {
                $schema_insert .= stripslashes(PMA_DBI_field_name($result, $i));
            } else {
                $schema_insert .= $enclosed . str_replace($enclosed, $escaped . $enclosed, stripslashes(PMA_DBI_field_name($result, $i))) . $enclosed;
            }
            $schema_insert .= $separator;
        }
        // end for
        $schema_insert = trim(substr($schema_insert, 0, -1));
        if (!PMA_exportOutputHandler($schema_insert . $add_character)) {
            return FALSE;
        }
    }
    // end if
    // Format the data
    while ($row = PMA_DBI_fetch_row($result)) {
        $schema_insert = '';
        for ($j = 0; $j < $fields_cnt; $j++) {
            if (!isset($row[$j]) || is_null($row[$j])) {
                $schema_insert .= $GLOBALS[$what . '_replace_null'];
            } else {
                if ($row[$j] == '0' || $row[$j] != '') {
                    // loic1 : always enclose fields
                    if ($what == 'excel') {
                        $row[$j] = ereg_replace("\r(\n)?", "\n", $row[$j]);
                    }
                    if ($enclosed == '') {
                        $schema_insert .= $row[$j];
                    } else {
                        $schema_insert .= $enclosed . str_replace($enclosed, $escaped . $enclosed, $row[$j]) . $enclosed;
                    }
                } else {
                    $schema_insert .= '';
                }
            }
            if ($j < $fields_cnt - 1) {
                $schema_insert .= $separator;
            }
        }
        // end for
        if (!PMA_exportOutputHandler($schema_insert . $add_character)) {
            return FALSE;
        }
    }
    // end while
    PMA_DBI_free_result($result);
    return TRUE;
}
开发者ID:lifecom,项目名称:test,代码行数:75,代码来源:csv.php


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