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


PHP PMA_DBI_get_tables函数代码示例

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


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

示例1: PMA_mysqlDie

require 'libraries/db_common.inc.php';
/**
 * init
 */
// If config variable $GLOBALS['cfg']['Usedbsearch'] is on false : exit.
if (!$GLOBALS['cfg']['UseDbSearch']) {
    PMA_mysqlDie(__('Access denied'), '', false, $err_url);
}
// end if
$url_query .= '&goto=db_search.php';
$url_params['goto'] = 'db_search.php';
/**
 * @global array list of tables from the current database
 * but do not clash with $tables coming from db_info.inc.php
 */
$tables_names_only = PMA_DBI_get_tables($GLOBALS['db']);
$search_options = array('1' => __('at least one of the words'), '2' => __('all words'), '3' => __('the exact phrase'), '4' => __('as regular expression'));
if (empty($_REQUEST['search_option']) || !is_string($_REQUEST['search_option']) || !array_key_exists($_REQUEST['search_option'], $search_options)) {
    $search_option = 1;
    unset($_REQUEST['submit_search']);
} else {
    $search_option = (int) $_REQUEST['search_option'];
    $option_str = $search_options[$_REQUEST['search_option']];
}
if (empty($_REQUEST['search_str']) || !is_string($_REQUEST['search_str'])) {
    unset($_REQUEST['submit_search']);
    $searched = '';
} else {
    $searched = htmlspecialchars($_REQUEST['search_str']);
    // For "as regular expression" (search option 4), we should not treat
    // this as an expression that contains a LIKE (second parameter of
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:31,代码来源:db_search.php

示例2: PMA_DBI_get_tables_full

             $sort_order = 'DESC';
         }
     }
 }
 if (!empty($tbl_group) && !$cfg['ShowTooltipAliasTB']) {
     // only tables for selected group
     $tables = PMA_DBI_get_tables_full($db, $tbl_group, true, null, 0, false, $sort, $sort_order);
 } elseif (!empty($tbl_group) && $cfg['ShowTooltipAliasTB']) {
     // only tables for selected group,
     // but grouping is done on comment ...
     $tables = PMA_DBI_get_tables_full($db, $tbl_group, 'comment', null, 0, false, $sort, $sort_order);
 } else {
     // all tables in db
     // - get the total number of tables
     //  (needed for proper working of the MaxTableList feature)
     $tables = PMA_DBI_get_tables($db);
     $total_num_tables = count($tables);
     if (isset($sub_part) && $sub_part == '_export') {
         // (don't fetch only a subset if we are coming from db_export.php,
         // because I think it's too risky to display only a subset of the
         // table names when exporting a db)
         /**
          *
          * @todo Page selector for table names?
          */
         $tables = PMA_DBI_get_tables_full($db, false, false, null, 0, false, $sort, $sort_order);
     } else {
         // fetch the details for a possible limited subset
         $tables = PMA_DBI_get_tables_full($db, false, false, null, $pos, true, $sort, $sort_order);
     }
 }
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:db_info.inc.php

示例3: PMA_DBI_get_columns_full

/**
 * returns detailed array with all columns for given table in database,
 * or all tables/databases
 *
 * @param   string  $database   name of database
 * @param   string  $table      name of table to retrieve columns from
 * @param   string  $column     name of specific column
 * @param   mixed   $link       mysql link resource
 */
function PMA_DBI_get_columns_full($database = null, $table = null, $column = null, $link = null)
{
    $columns = array();
    if (!$GLOBALS['cfg']['Server']['DisableIS']) {
        $sql_wheres = array();
        $array_keys = array();
        // get columns information from information_schema
        if (null !== $database) {
            $sql_wheres[] = '`TABLE_SCHEMA` = \'' . addslashes($database) . '\' ';
        } else {
            $array_keys[] = 'TABLE_SCHEMA';
        }
        if (null !== $table) {
            $sql_wheres[] = '`TABLE_NAME` = \'' . addslashes($table) . '\' ';
        } else {
            $array_keys[] = 'TABLE_NAME';
        }
        if (null !== $column) {
            $sql_wheres[] = '`COLUMN_NAME` = \'' . addslashes($column) . '\' ';
        } else {
            $array_keys[] = 'COLUMN_NAME';
        }
        // for PMA bc:
        // `[SCHEMA_FIELD_NAME]` AS `[SHOW_FULL_COLUMNS_FIELD_NAME]`
        $sql = '
             SELECT *,
                    `COLUMN_NAME`       AS `Field`,
                    `COLUMN_TYPE`       AS `Type`,
                    `COLLATION_NAME`    AS `Collation`,
                    `IS_NULLABLE`       AS `Null`,
                    `COLUMN_KEY`        AS `Key`,
                    `COLUMN_DEFAULT`    AS `Default`,
                    `EXTRA`             AS `Extra`,
                    `PRIVILEGES`        AS `Privileges`,
                    `COLUMN_COMMENT`    AS `Comment`
               FROM `information_schema`.`COLUMNS`';
        if (count($sql_wheres)) {
            $sql .= "\n" . ' WHERE ' . implode(' AND ', $sql_wheres);
        }
        $columns = PMA_DBI_fetch_result($sql, $array_keys, null, $link);
        unset($sql_wheres, $sql);
    } else {
        if (null === $database) {
            foreach ($GLOBALS['pma']->databases as $database) {
                $columns[$database] = PMA_DBI_get_columns_full($database, null, null, $link);
            }
            return $columns;
        } elseif (null === $table) {
            $tables = PMA_DBI_get_tables($database);
            foreach ($tables as $table) {
                $columns[$table] = PMA_DBI_get_columns_full($database, $table, null, $link);
            }
            return $columns;
        }
        $sql = 'SHOW FULL COLUMNS FROM ' . PMA_backquote($database) . '.' . PMA_backquote($table);
        if (null !== $column) {
            $sql .= " LIKE '" . $column . "'";
        }
        $columns = PMA_DBI_fetch_result($sql, 'Field', null, $link);
        $ordinal_position = 1;
        foreach ($columns as $column_name => $each_column) {
            // MySQL forward compatibility
            // so pma could use this array as if every server is of version >5.0
            $columns[$column_name]['COLUMN_NAME'] =& $columns[$column_name]['Field'];
            $columns[$column_name]['COLUMN_TYPE'] =& $columns[$column_name]['Type'];
            $columns[$column_name]['COLLATION_NAME'] =& $columns[$column_name]['Collation'];
            $columns[$column_name]['IS_NULLABLE'] =& $columns[$column_name]['Null'];
            $columns[$column_name]['COLUMN_KEY'] =& $columns[$column_name]['Key'];
            $columns[$column_name]['COLUMN_DEFAULT'] =& $columns[$column_name]['Default'];
            $columns[$column_name]['EXTRA'] =& $columns[$column_name]['Extra'];
            $columns[$column_name]['PRIVILEGES'] =& $columns[$column_name]['Privileges'];
            $columns[$column_name]['COLUMN_COMMENT'] =& $columns[$column_name]['Comment'];
            $columns[$column_name]['TABLE_CATALOG'] = null;
            $columns[$column_name]['TABLE_SCHEMA'] = $database;
            $columns[$column_name]['TABLE_NAME'] = $table;
            $columns[$column_name]['ORDINAL_POSITION'] = $ordinal_position;
            $columns[$column_name]['DATA_TYPE'] = substr($columns[$column_name]['COLUMN_TYPE'], 0, strpos($columns[$column_name]['COLUMN_TYPE'], '('));
            /**
             * @todo guess CHARACTER_MAXIMUM_LENGTH from COLUMN_TYPE
             */
            $columns[$column_name]['CHARACTER_MAXIMUM_LENGTH'] = null;
            /**
             * @todo guess CHARACTER_OCTET_LENGTH from CHARACTER_MAXIMUM_LENGTH
             */
            $columns[$column_name]['CHARACTER_OCTET_LENGTH'] = null;
            $columns[$column_name]['NUMERIC_PRECISION'] = null;
            $columns[$column_name]['NUMERIC_SCALE'] = null;
            $columns[$column_name]['CHARACTER_SET_NAME'] = substr($columns[$column_name]['COLLATION_NAME'], 0, strpos($columns[$column_name]['COLLATION_NAME'], '_'));
            $ordinal_position++;
        }
        if (null !== $column) {
//.........这里部分代码省略.........
开发者ID:alexhava,项目名称:elixirjuice,代码行数:101,代码来源:database_interface.lib.php

示例4: PMA_replication_synchronize_db

/**
 * This function provides synchronization of structure and data between two mysql servers. 
 * TODO: improve code sharing between the function and synchronization
 *
 * @param String $db - name of database, which should be synchronized
 * @param mixed $src_link - link of source server, note: if the server is current PMA server, use null
 * @param mixed $trg_link - link of target server, note: if the server is current PMA server, use null
 * @param boolean $data - if true, then data will be copied as well
 */
function PMA_replication_synchronize_db($db, $src_link, $trg_link, $data = true)
{
    $src_db = $trg_db = $db;
    $src_connection = PMA_DBI_select_db($src_db, $src_link);
    $trg_connection = PMA_DBI_select_db($trg_db, $trg_link);
    $src_tables = PMA_DBI_get_tables($src_db, $src_link);
    $source_tables_num = sizeof($src_tables);
    $trg_tables = PMA_DBI_get_tables($trg_db, $trg_link);
    $target_tables_num = sizeof($trg_tables);
    /**
     * initializing arrays to save table names 
     */
    $unmatched_num_src = 0;
    $source_tables_uncommon = array();
    $unmatched_num_trg = 0;
    $target_tables_uncommon = array();
    $matching_tables = array();
    $matching_tables_num = 0;
    /**
     * Criterion for matching tables is just their names.
     * Finding the uncommon tables for the source database
     * BY comparing the matching tables with all the tables in the source database
     */
    PMA_getMatchingTables($trg_tables, $src_tables, $matching_tables, $source_tables_uncommon);
    /**
     * Finding the uncommon tables for the target database
     * BY comparing the matching tables with all the tables in the target database
     */
    PMA_getNonMatchingTargetTables($trg_tables, $matching_tables, $target_tables_uncommon);
    /**
     * 
     * Comparing Data In the Matching Tables 
     * It is assumed that the matching tables are structurally 
     * and typely exactly the same  
     */
    $fields_num = array();
    $matching_tables_fields = array();
    $matching_tables_keys = array();
    $insert_array = array(array(array()));
    $update_array = array(array(array()));
    $delete_array = array();
    $row_count = array();
    $uncommon_tables_fields = array();
    $matching_tables_num = sizeof($matching_tables);
    for ($i = 0; $i < sizeof($matching_tables); $i++) {
        PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link, $matching_tables, $matching_tables_fields, $update_array, $insert_array, $delete_array, $fields_num, $i, $matching_tables_keys);
    }
    for ($j = 0; $j < sizeof($source_tables_uncommon); $j++) {
        PMA_dataDiffInUncommonTables($source_tables_uncommon, $src_db, $src_link, $j, $row_count);
    }
    /**
     * INTEGRATION OF STRUCTURE DIFFERENCE CODE
     *
     */
    $source_columns = array();
    $target_columns = array();
    $alter_str_array = array(array());
    $add_column_array = array(array());
    $uncommon_columns = array();
    $target_tables_keys = array();
    $source_indexes = array();
    $target_indexes = array();
    $add_indexes_array = array();
    $remove_indexes_array = array();
    $criteria = array('Field', 'Type', 'Null', 'Collation', 'Key', 'Default', 'Comment');
    for ($counter = 0; $counter < $matching_tables_num; $counter++) {
        PMA_structureDiffInTables($src_db, $trg_db, $src_link, $trg_link, $matching_tables, $source_columns, $target_columns, $alter_str_array, $add_column_array, $uncommon_columns, $criteria, $target_tables_keys, $counter);
        PMA_indexesDiffInTables($src_db, $trg_db, $src_link, $trg_link, $matching_tables, $source_indexes, $target_indexes, $add_indexes_array, $alter_indexes_array, $remove_indexes_array, $counter);
    }
    $matching_table_data_diff = array();
    $matching_table_structure_diff = array();
    $uncommon_table_structure_diff = array();
    $uncommon_table_data_diff = array();
    $uncommon_tables = $source_tables_uncommon;
    /**
     * Generating Create Table query for all the non-matching tables present in Source but not in Target and populating tables.  
     */
    for ($q = 0; $q < sizeof($source_tables_uncommon); $q++) {
        if (isset($uncommon_tables[$q])) {
            PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link, $source_tables_uncommon, $q, $uncommon_tables_fields, false);
        }
        if (isset($row_count[$q]) && $data) {
            PMA_populateTargetTables($src_db, $trg_db, $src_link, $trg_link, $source_tables_uncommon, $q, $uncommon_tables_fields, false);
        }
    }
}
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:95,代码来源:replication.inc.php

示例5: implode

 // Gets the number of tables if a dump of a database has been required
 if ($export_type == 'server') {
     if (isset($db_select)) {
         $tmp_select = implode($db_select, '|');
         $tmp_select = '|' . $tmp_select . '|';
     }
     // Walk over databases
     foreach ($GLOBALS['pma']->databases as $current_db) {
         if (isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $current_db . '|') || !isset($tmp_select)) {
             if (!PMA_exportDBHeader($current_db)) {
                 break 2;
             }
             if (!PMA_exportDBCreate($current_db)) {
                 break 2;
             }
             $tables = PMA_DBI_get_tables($current_db);
             $views = array();
             foreach ($tables as $table) {
                 // if this is a view, collect it for later; views must be exported
                 // after the tables
                 $is_view = PMA_Table::isView($current_db, $table);
                 if ($is_view) {
                     $views[] = $table;
                 }
                 if (isset($GLOBALS[$what . '_structure'])) {
                     // for a view, export a stand-in definition of the table
                     // to resolve view dependencies
                     if (!PMA_exportStructure($current_db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, $is_view ? 'stand_in' : 'create_table', $export_type)) {
                         break 3;
                     }
                 }
开发者ID:alexhava,项目名称:elixirjuice,代码行数:31,代码来源:export.php

示例6: PMA_DBI_get_columns_full

/**
 * returns detailed array with all columns for given table in database,
 * or all tables/databases
 *
 * @param string $database name of database
 * @param string $table    name of table to retrieve columns from
 * @param string $column   name of specific column
 * @param mixed  $link     mysql link resource
 *
 * @return array
 */
function PMA_DBI_get_columns_full($database = null, $table = null, $column = null, $link = null)
{
    $common_functions = PMA_CommonFunctions::getInstance();
    $columns = array();
    if (!$GLOBALS['cfg']['Server']['DisableIS']) {
        $sql_wheres = array();
        $array_keys = array();
        // get columns information from information_schema
        if (null !== $database) {
            $sql_wheres[] = '`TABLE_SCHEMA` = \'' . $common_functions->sqlAddSlashes($database) . '\' ';
        } else {
            $array_keys[] = 'TABLE_SCHEMA';
        }
        if (null !== $table) {
            $sql_wheres[] = '`TABLE_NAME` = \'' . $common_functions->sqlAddSlashes($table) . '\' ';
        } else {
            $array_keys[] = 'TABLE_NAME';
        }
        if (null !== $column) {
            $sql_wheres[] = '`COLUMN_NAME` = \'' . $common_functions->sqlAddSlashes($column) . '\' ';
        } else {
            $array_keys[] = 'COLUMN_NAME';
        }
        // for PMA bc:
        // `[SCHEMA_FIELD_NAME]` AS `[SHOW_FULL_COLUMNS_FIELD_NAME]`
        if (PMA_DRIZZLE) {
            $sql = "SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME,\n                column_name        AS `Field`,\n                (CASE\n                    WHEN character_maximum_length > 0\n                        THEN concat(lower(data_type), '(', character_maximum_length, ')')\n                    WHEN numeric_precision > 0 OR numeric_scale > 0\n                        THEN concat(lower(data_type), '(', numeric_precision, ',', numeric_scale, ')')\n                    WHEN enum_values IS NOT NULL\n                        THEN concat(lower(data_type), '(', enum_values, ')')\n                    ELSE lower(data_type) END)\n                                   AS `Type`,\n                collation_name     AS `Collation`,\n                (CASE is_nullable\n                    WHEN 1 THEN 'YES'\n                    ELSE 'NO' END) AS `Null`,\n                (CASE\n                    WHEN is_used_in_primary THEN 'PRI'\n                    ELSE '' END)   AS `Key`,\n                column_default     AS `Default`,\n                (CASE\n                    WHEN is_auto_increment THEN 'auto_increment'\n                    WHEN column_default_update THEN 'on update ' || column_default_update\n                    ELSE '' END)   AS `Extra`,\n                NULL               AS `Privileges`,\n                column_comment     AS `Comment`\n            FROM data_dictionary.columns";
        } else {
            $sql = '
                 SELECT *,
                        `COLUMN_NAME`       AS `Field`,
                        `COLUMN_TYPE`       AS `Type`,
                        `COLLATION_NAME`    AS `Collation`,
                        `IS_NULLABLE`       AS `Null`,
                        `COLUMN_KEY`        AS `Key`,
                        `COLUMN_DEFAULT`    AS `Default`,
                        `EXTRA`             AS `Extra`,
                        `PRIVILEGES`        AS `Privileges`,
                        `COLUMN_COMMENT`    AS `Comment`
                   FROM `information_schema`.`COLUMNS`';
        }
        if (count($sql_wheres)) {
            $sql .= "\n" . ' WHERE ' . implode(' AND ', $sql_wheres);
        }
        $columns = PMA_DBI_fetch_result($sql, $array_keys, null, $link);
        unset($sql_wheres, $sql);
    } else {
        if (null === $database) {
            foreach ($GLOBALS['pma']->databases as $database) {
                $columns[$database] = PMA_DBI_get_columns_full($database, null, null, $link);
            }
            return $columns;
        } elseif (null === $table) {
            $tables = PMA_DBI_get_tables($database);
            foreach ($tables as $table) {
                $columns[$table] = PMA_DBI_get_columns_full($database, $table, null, $link);
            }
            return $columns;
        }
        $sql = 'SHOW FULL COLUMNS FROM ' . $common_functions->backquote($database) . '.' . $common_functions->backquote($table);
        if (null !== $column) {
            $sql .= " LIKE '" . $common_functions->sqlAddSlashes($column, true) . "'";
        }
        $columns = PMA_DBI_fetch_result($sql, 'Field', null, $link);
    }
    $ordinal_position = 1;
    foreach ($columns as $column_name => $each_column) {
        // MySQL forward compatibility
        // so pma could use this array as if every server is of version >5.0
        // todo : remove and check the rest of the code for usage,
        // MySQL 5.0 or higher is required for current PMA version
        $columns[$column_name]['COLUMN_NAME'] =& $columns[$column_name]['Field'];
        $columns[$column_name]['COLUMN_TYPE'] =& $columns[$column_name]['Type'];
        $columns[$column_name]['COLLATION_NAME'] =& $columns[$column_name]['Collation'];
        $columns[$column_name]['IS_NULLABLE'] =& $columns[$column_name]['Null'];
        $columns[$column_name]['COLUMN_KEY'] =& $columns[$column_name]['Key'];
        $columns[$column_name]['COLUMN_DEFAULT'] =& $columns[$column_name]['Default'];
        $columns[$column_name]['EXTRA'] =& $columns[$column_name]['Extra'];
        $columns[$column_name]['PRIVILEGES'] =& $columns[$column_name]['Privileges'];
        $columns[$column_name]['COLUMN_COMMENT'] =& $columns[$column_name]['Comment'];
        $columns[$column_name]['TABLE_CATALOG'] = null;
        $columns[$column_name]['TABLE_SCHEMA'] = $database;
        $columns[$column_name]['TABLE_NAME'] = $table;
        $columns[$column_name]['ORDINAL_POSITION'] = $ordinal_position;
        $columns[$column_name]['DATA_TYPE'] = substr($columns[$column_name]['COLUMN_TYPE'], 0, strpos($columns[$column_name]['COLUMN_TYPE'], '('));
        /**
         * @todo guess CHARACTER_MAXIMUM_LENGTH from COLUMN_TYPE
         */
        $columns[$column_name]['CHARACTER_MAXIMUM_LENGTH'] = null;
//.........这里部分代码省略.........
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:101,代码来源:database_interface.lib.php

示例7: _getDbTabs

 /**
  * Returns the db tabs as an array
  *
  * @return array Data for generating db tabs
  */
 private function _getDbTabs()
 {
     $db_is_information_schema = PMA_is_system_schema($this->_db);
     $num_tables = count(PMA_DBI_get_tables($this->_db));
     $is_superuser = PMA_isSuperuser();
     /**
      * Gets the relation settings
      */
     $cfgRelation = PMA_getRelationsParam();
     $tabs = array();
     $tabs['structure']['link'] = 'db_structure.php';
     $tabs['structure']['text'] = __('Structure');
     $tabs['structure']['icon'] = 'b_props.png';
     $tabs['sql']['link'] = 'db_sql.php';
     $tabs['sql']['args']['db_query_force'] = 1;
     $tabs['sql']['text'] = __('SQL');
     $tabs['sql']['icon'] = 'b_sql.png';
     $tabs['search']['text'] = __('Search');
     $tabs['search']['icon'] = 'b_search.png';
     $tabs['search']['link'] = 'db_search.php';
     if ($num_tables == 0) {
         $tabs['search']['warning'] = __('Database seems to be empty!');
     }
     $tabs['qbe']['text'] = __('Query');
     $tabs['qbe']['icon'] = 's_db.png';
     $tabs['qbe']['link'] = 'db_qbe.php';
     if ($num_tables == 0) {
         $tabs['qbe']['warning'] = __('Database seems to be empty!');
     }
     $tabs['export']['text'] = __('Export');
     $tabs['export']['icon'] = 'b_export.png';
     $tabs['export']['link'] = 'db_export.php';
     if ($num_tables == 0) {
         $tabs['export']['warning'] = __('Database seems to be empty!');
     }
     if (!$db_is_information_schema) {
         $tabs['import']['link'] = 'db_import.php';
         $tabs['import']['text'] = __('Import');
         $tabs['import']['icon'] = 'b_import.png';
         $tabs['operation']['link'] = 'db_operations.php';
         $tabs['operation']['text'] = __('Operations');
         $tabs['operation']['icon'] = 'b_tblops.png';
         if ($is_superuser && !PMA_DRIZZLE) {
             $tabs['privileges']['link'] = 'server_privileges.php';
             $tabs['privileges']['args']['checkprivs'] = $this->_db;
             // stay on database view
             $tabs['privileges']['args']['viewing_mode'] = 'db';
             $tabs['privileges']['text'] = __('Privileges');
             $tabs['privileges']['icon'] = 's_rights.png';
         }
         if (!PMA_DRIZZLE) {
             $tabs['routines']['link'] = 'db_routines.php';
             $tabs['routines']['text'] = __('Routines');
             $tabs['routines']['icon'] = 'b_routines.png';
         }
         if (PMA_MYSQL_INT_VERSION >= 50106 && !PMA_DRIZZLE && PMA_Util::currentUserHasPrivilege('EVENT', $this->_db)) {
             $tabs['events']['link'] = 'db_events.php';
             $tabs['events']['text'] = __('Events');
             $tabs['events']['icon'] = 'b_events.png';
         }
         if (!PMA_DRIZZLE && PMA_Util::currentUserHasPrivilege('TRIGGER', $this->_db)) {
             $tabs['triggers']['link'] = 'db_triggers.php';
             $tabs['triggers']['text'] = __('Triggers');
             $tabs['triggers']['icon'] = 'b_triggers.png';
         }
     }
     if (PMA_Tracker::isActive()) {
         $tabs['tracking']['text'] = __('Tracking');
         $tabs['tracking']['icon'] = 'eye.png';
         $tabs['tracking']['link'] = 'db_tracking.php';
     }
     if (!$db_is_information_schema && $cfgRelation['designerwork']) {
         $tabs['designer']['text'] = __('Designer');
         $tabs['designer']['icon'] = 'b_relations.png';
         $tabs['designer']['link'] = 'pmd_general.php';
     }
     return $tabs;
 }
开发者ID:mindfeederllc,项目名称:openemr,代码行数:83,代码来源:Menu.class.php

示例8: PMA_TRI_getQueryFromRequest

/**
 * Composes the query necessary to create a trigger from an HTTP request.
 *
 * @return string  The CREATE TRIGGER query.
 */
function PMA_TRI_getQueryFromRequest()
{
    global $_REQUEST, $db, $errors, $action_timings, $event_manipulations;
    $query = 'CREATE ';
    if (!empty($_REQUEST['item_definer'])) {
        if (strpos($_REQUEST['item_definer'], '@') !== false) {
            $arr = explode('@', $_REQUEST['item_definer']);
            $query .= 'DEFINER=' . PMA_Util::backquote($arr[0]);
            $query .= '@' . PMA_Util::backquote($arr[1]) . ' ';
        } else {
            $errors[] = __('The definer must be in the "username@hostname" format');
        }
    }
    $query .= 'TRIGGER ';
    if (!empty($_REQUEST['item_name'])) {
        $query .= PMA_Util::backquote($_REQUEST['item_name']) . ' ';
    } else {
        $errors[] = __('You must provide a trigger name');
    }
    if (!empty($_REQUEST['item_timing']) && in_array($_REQUEST['item_timing'], $action_timings)) {
        $query .= $_REQUEST['item_timing'] . ' ';
    } else {
        $errors[] = __('You must provide a valid timing for the trigger');
    }
    if (!empty($_REQUEST['item_event']) && in_array($_REQUEST['item_event'], $event_manipulations)) {
        $query .= $_REQUEST['item_event'] . ' ';
    } else {
        $errors[] = __('You must provide a valid event for the trigger');
    }
    $query .= 'ON ';
    if (!empty($_REQUEST['item_table']) && in_array($_REQUEST['item_table'], PMA_DBI_get_tables($db))) {
        $query .= PMA_Util::backquote($_REQUEST['item_table']);
    } else {
        $errors[] = __('You must provide a valid table name');
    }
    $query .= ' FOR EACH ROW ';
    if (!empty($_REQUEST['item_definition'])) {
        $query .= $_REQUEST['item_definition'];
    } else {
        $errors[] = __('You must provide a trigger definition.');
    }
    return $query;
}
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:48,代码来源:rte_triggers.lib.php

示例9:

if (!defined('PHPMYADMIN')) {
    exit;
}
/**
 * Include all other files that are common
 * to routines, triggers and events.
 */
require_once './libraries/rte/rte_words.lib.php';
require_once './libraries/rte/rte_export.lib.php';
require_once './libraries/rte/rte_list.lib.php';
require_once './libraries/rte/rte_footer.lib.php';
if ($GLOBALS['is_ajax_request'] != true) {
    /**
     * Displays the header and tabs
     */
    if (!empty($table) && in_array($table, PMA_DBI_get_tables($db))) {
        include_once './libraries/tbl_common.php';
        include_once './libraries/tbl_links.inc.php';
    } else {
        $table = '';
        include_once './libraries/db_common.inc.php';
        include_once './libraries/db_info.inc.php';
    }
} else {
    /**
     * Since we did not include some libraries, we need
     * to manually select the required database and
     * create the missing $url_query variable
     */
    if (strlen($db)) {
        PMA_DBI_select_db($db);
开发者ID:AmberWish,项目名称:laba_web,代码行数:31,代码来源:rte_main.inc.php

示例10: sprintf

         echo sprintf($GLOBALS['strDatabaseNotExisting'], htmlspecialchars($src_db));
     }
     if ($trg_db_selected != 1) {
         echo sprintf($GLOBALS['strDatabaseNotExisting'], htmlspecialchars($trg_db));
     }
     echo '</div>';
     unset($_REQUEST['submit_connect']);
 } else {
     if ($src_db_selected == 1 && $trg_db_selected == 1) {
         /**
          * Using PMA_DBI_get_tables() to get all the tables 
          * from target and source databases. 
          */
         $src_tables = PMA_DBI_get_tables($src_db, $src_link);
         $source_tables_num = sizeof($src_tables);
         $trg_tables = PMA_DBI_get_tables($trg_db, $trg_link);
         $target_tables_num = sizeof($trg_tables);
         /**
          * initializing arrays to save matching and non-matching 
          * table names from target and source databases.  
          */
         $unmatched_num_src = 0;
         $source_tables_uncommon = array();
         $unmatched_num_trg = 0;
         $target_tables_uncommon = array();
         $matching_tables = array();
         $matching_tables_num = 0;
         /**
          * Using PMA_getMatchingTables to find which of the tables' names match
          * in target and source database. 
          */
开发者ID:fathitarek,项目名称:cop5725-dbms-project,代码行数:31,代码来源:server_synchronize.php

示例11: getTableHtmlForMultipleQueries

/**
 * Generate table html when SQL statement have multiple queries
 * which return displayable results
 *
 * @param PMA_DisplayResults $displayResultsObject object
 * @param string             $db                   database name
 * @param array              $sql_data             information about SQL statement
 * @param string             $goto                 URL to go back in case of errors
 * @param string             $pmaThemeImage        path for theme images directory
 * @param string             $text_dir             text direction
 * @param string             $printview            whether printview is enabled
 * @param string             $url_query            URL query
 * @param array              $disp_mode            the display mode
 * @param string             $sql_limit_to_append  limit clause
 * @param bool               $editable             whether result set is editable
 *
 * @return string   $table_html   html content
 */
function getTableHtmlForMultipleQueries($displayResultsObject, $db, $sql_data, $goto, $pmaThemeImage, $text_dir, $printview, $url_query, $disp_mode, $sql_limit_to_append, $editable)
{
    $table_html = '';
    $tables_array = PMA_DBI_get_tables($db);
    $databases_array = PMA_DBI_get_databases_full();
    $multi_sql = implode(";", $sql_data['valid_sql']);
    $querytime_before = array_sum(explode(' ', microtime()));
    // Assignment for variable is not needed since the results are
    // looiping using the connection
    @PMA_DBI_try_multi_query($multi_sql);
    $querytime_after = array_sum(explode(' ', microtime()));
    $querytime = $querytime_after - $querytime_before;
    $sql_no = 0;
    do {
        $analyzed_sql = array();
        $is_affected = false;
        $result = PMA_DBI_store_result();
        $fields_meta = $result !== false ? PMA_DBI_get_fields_meta($result) : array();
        $fields_cnt = count($fields_meta);
        // Initialize needed params related to each query in multiquery statement
        if (isset($sql_data['valid_sql'][$sql_no])) {
            // 'Use' query can change the database
            if (stripos($sql_data['valid_sql'][$sql_no], "use ")) {
                $db = PMA_getNewDatabase($sql_data['valid_sql'][$sql_no], $databases_array);
            }
            $parsed_sql = PMA_SQP_parse($sql_data['valid_sql'][$sql_no]);
            $table = PMA_getTableNameBySQL($sql_data['valid_sql'][$sql_no], $tables_array);
            $analyzed_sql = PMA_SQP_analyze($parsed_sql);
            $is_select = isset($analyzed_sql[0]['queryflags']['select_from']);
            $unlim_num_rows = PMA_Table::countRecords($db, $table, true);
            $showtable = PMA_Table::sGetStatusInfo($db, $table, null, true);
            $url_query = PMA_generate_common_url($db, $table);
            list($is_group, $is_func, $is_count, $is_export, $is_analyse, $is_explain, $is_delete, $is_affected, $is_insert, $is_replace, $is_show, $is_maint) = PMA_getDisplayPropertyParams($sql_data['valid_sql'][$sql_no], $is_select);
            // Handle remembered sorting order, only for single table query
            if ($GLOBALS['cfg']['RememberSorting'] && !($is_count || $is_export || $is_func || $is_analyse) && isset($analyzed_sql[0]['select_expr']) && count($analyzed_sql[0]['select_expr']) == 0 && isset($analyzed_sql[0]['queryflags']['select_from']) && count($analyzed_sql[0]['table_ref']) == 1) {
                PMA_handleSortOrder($db, $table, $analyzed_sql, $sql_data['valid_sql'][$sql_no]);
            }
            // Do append a "LIMIT" clause?
            if ($_SESSION['tmp_user_values']['max_rows'] != 'all' && !($is_count || $is_export || $is_func || $is_analyse) && isset($analyzed_sql[0]['queryflags']['select_from']) && !isset($analyzed_sql[0]['queryflags']['offset']) && empty($analyzed_sql[0]['limit_clause'])) {
                $sql_limit_to_append = ' LIMIT ' . $_SESSION['tmp_user_values']['pos'] . ', ' . $_SESSION['tmp_user_values']['max_rows'] . " ";
                $sql_data['valid_sql'][$sql_no] = PMA_getSqlWithLimitClause($sql_data['valid_sql'][$sql_no], $analyzed_sql, $sql_limit_to_append);
            }
            // Set the needed properties related to executing sql query
            $displayResultsObject->__set('db', $db);
            $displayResultsObject->__set('table', $table);
            $displayResultsObject->__set('goto', $goto);
        }
        if (!$is_affected) {
            $num_rows = $result ? @PMA_DBI_num_rows($result) : 0;
        } elseif (!isset($num_rows)) {
            $num_rows = @PMA_DBI_affected_rows();
        }
        if (isset($sql_data['valid_sql'][$sql_no])) {
            $displayResultsObject->__set('sql_query', $sql_data['valid_sql'][$sql_no]);
            $displayResultsObject->setProperties($unlim_num_rows, $fields_meta, $is_count, $is_export, $is_func, $is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage, $text_dir, $is_maint, $is_explain, $is_show, $showtable, $printview, $url_query, $editable);
        }
        if ($num_rows == 0) {
            continue;
        }
        // With multiple results, operations are limied
        $disp_mode = 'nnnn000000';
        $is_limited_display = true;
        // Collect the tables
        $table_html .= $displayResultsObject->getTable($result, $disp_mode, $analyzed_sql, $is_limited_display);
        // Free the result to save the memory
        PMA_DBI_free_result($result);
        $sql_no++;
    } while (PMA_DBI_more_results() && PMA_DBI_next_result());
    return $table_html;
}
开发者ID:SashiAsakura,项目名称:AWS_QuikID_website,代码行数:88,代码来源:sql.php

示例12: _setSearchParams

 /**
  * Sets search parameters
  *
  * @return void
  */
 private function _setSearchParams()
 {
     $this->_tables_names_only = PMA_DBI_get_tables($this->_db);
     $this->_searchTypes = array('1' => __('at least one of the words'), '2' => __('all words'), '3' => __('the exact phrase'), '4' => __('as regular expression'));
     if (empty($_REQUEST['criteriaSearchType']) || !is_string($_REQUEST['criteriaSearchType']) || !array_key_exists($_REQUEST['criteriaSearchType'], $this->_searchTypes)) {
         $this->_criteriaSearchType = 1;
         unset($_REQUEST['submit_search']);
     } else {
         $this->_criteriaSearchType = (int) $_REQUEST['criteriaSearchType'];
         $this->_searchTypeDescription = $this->_searchTypes[$_REQUEST['criteriaSearchType']];
     }
     if (empty($_REQUEST['criteriaSearchString']) || !is_string($_REQUEST['criteriaSearchString'])) {
         $this->_criteriaSearchString = '';
         unset($_REQUEST['submit_search']);
     } else {
         $this->_criteriaSearchString = $_REQUEST['criteriaSearchString'];
     }
     $this->_criteriaTables = array();
     if (empty($_REQUEST['criteriaTables']) || !is_array($_REQUEST['criteriaTables'])) {
         unset($_REQUEST['submit_search']);
     } elseif (!isset($_REQUEST['selectall']) && !isset($_REQUEST['unselectall'])) {
         $this->_criteriaTables = array_intersect($_REQUEST['criteriaTables'], $this->_tables_names_only);
     }
     if (isset($_REQUEST['selectall'])) {
         $this->_criteriaTables = $this->_tables_names_only;
     } elseif (isset($_REQUEST['unselectall'])) {
         $this->_criteriaTables = array();
     }
     if (empty($_REQUEST['criteriaColumnName']) || !is_string($_REQUEST['criteriaColumnName'])) {
         unset($this->_criteriaColumnName);
     } else {
         $this->_criteriaColumnName = PMA_Util::sqlAddSlashes($_REQUEST['criteriaColumnName'], true);
     }
 }
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:39,代码来源:DbSearch.class.php

示例13: PMA_mysqlDie

require_once './libraries/common.lib.php';
/**
 * Gets some core libraries and send headers
 */
require './libraries/db_details_common.inc.php';
// If config variable $cfg['Usedbsearch'] is on FALSE : exit.
if (!$cfg['UseDbSearch']) {
    PMA_mysqlDie($strAccessDenied, '', FALSE, $err_url);
}
// end if
$url_query .= '&amp;goto=db_search.php';
$url_params['goto'] = 'db_search.php';
/**
 * Get the list of tables from the current database
 */
$tables = PMA_DBI_get_tables($GLOBALS['db']);
$num_tables = count($tables);
/**
 * Displays top links
 */
$sub_part = '';
require './libraries/db_details_links.inc.php';
/**
 * 1. Main search form has been submitted
 */
if (isset($_REQUEST['submit_search'])) {
    /**
     * Builds the SQL search query
     *
     * @param   string   the table name
     * @param   string   the string to search
开发者ID:robmat,项目名称:samplebator,代码行数:31,代码来源:db_search.php


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