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


PHP PMA_getRelationsParam函数代码示例

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


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

示例1: PMA_relationsCleanupDatabase

/**
 * Cleanup database related relation stuff
 *
 * @param string $db
 */
function PMA_relationsCleanupDatabase($db)
{
    $cfgRelation = PMA_getRelationsParam();
    if ($cfgRelation['commwork']) {
        $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . ' WHERE db_name  = \'' . PMA_sqlAddSlashes($db) . '\'';
        PMA_query_as_controluser($remove_query);
    }
    if ($cfgRelation['bookmarkwork']) {
        $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['bookmark']) . ' WHERE dbase  = \'' . PMA_sqlAddSlashes($db) . '\'';
        PMA_query_as_controluser($remove_query);
    }
    if ($cfgRelation['displaywork']) {
        $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['table_info']) . ' WHERE db_name  = \'' . PMA_sqlAddSlashes($db) . '\'';
        PMA_query_as_controluser($remove_query);
    }
    if ($cfgRelation['pdfwork']) {
        $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']) . ' WHERE db_name  = \'' . PMA_sqlAddSlashes($db) . '\'';
        PMA_query_as_controluser($remove_query);
        $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' WHERE db_name  = \'' . PMA_sqlAddSlashes($db) . '\'';
        PMA_query_as_controluser($remove_query);
    }
    if ($cfgRelation['designerwork']) {
        $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['designer_coords']) . ' WHERE db_name  = \'' . PMA_sqlAddSlashes($db) . '\'';
        PMA_query_as_controluser($remove_query);
    }
    if ($cfgRelation['relwork']) {
        $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['relation']) . ' WHERE master_db  = \'' . PMA_sqlAddSlashes($db) . '\'';
        PMA_query_as_controluser($remove_query);
        $remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['relation']) . ' WHERE foreign_db  = \'' . PMA_sqlAddSlashes($db) . '\'';
        PMA_query_as_controluser($remove_query);
    }
}
开发者ID:AmberWish,项目名称:laba_web,代码行数:37,代码来源:relation_cleanup.lib.php

示例2: PMA_saveUserprefs

/**
 * Saves user preferences
 *
 * @param array $config_array configuration array
 *
 * @return true|PMA\libraries\Message
 */
function PMA_saveUserprefs(array $config_array)
{
    $cfgRelation = PMA_getRelationsParam();
    $server = isset($GLOBALS['server']) ? $GLOBALS['server'] : $GLOBALS['cfg']['ServerDefault'];
    $cache_key = 'server_' . $server;
    if (!$cfgRelation['userconfigwork']) {
        // no pmadb table, use session storage
        $_SESSION['userconfig'] = array('db' => $config_array, 'ts' => time());
        if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
            unset($_SESSION['cache'][$cache_key]['userprefs']);
        }
        return true;
    }
    // save configuration to pmadb
    $query_table = PMA\libraries\Util::backquote($cfgRelation['db']) . '.' . PMA\libraries\Util::backquote($cfgRelation['userconfig']);
    $query = 'SELECT `username` FROM ' . $query_table . ' WHERE `username` = \'' . $GLOBALS['dbi']->escapeString($cfgRelation['user']) . '\'';
    $has_config = $GLOBALS['dbi']->fetchValue($query, 0, 0, $GLOBALS['controllink']);
    $config_data = json_encode($config_array);
    if ($has_config) {
        $query = 'UPDATE ' . $query_table . ' SET `timevalue` = NOW(), `config_data` = \'' . $GLOBALS['dbi']->escapeString($config_data) . '\'' . ' WHERE `username` = \'' . $GLOBALS['dbi']->escapeString($cfgRelation['user']) . '\'';
    } else {
        $query = 'INSERT INTO ' . $query_table . ' (`username`, `timevalue`,`config_data`) ' . 'VALUES (\'' . $GLOBALS['dbi']->escapeString($cfgRelation['user']) . '\', NOW(), ' . '\'' . $GLOBALS['dbi']->escapeString($config_data) . '\')';
    }
    if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
        unset($_SESSION['cache'][$cache_key]['userprefs']);
    }
    if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['controllink'])) {
        $message = Message::error(__('Could not save configuration'));
        $message->addMessage('<br /><br />');
        $message->addMessage(Message::rawError($GLOBALS['dbi']->getError($GLOBALS['controllink'])));
        return $message;
    }
    return true;
}
开发者ID:wp-cloud,项目名称:phpmyadmin,代码行数:41,代码来源:user_preferences.lib.php

示例3: PMA_getNewTransformationDataSql

/**
 * Get SQL query for store new transformation details of a VIEW
 *
 * @param mysqli_result $pma_transformation_data Result set of SQL execution
 * @param array         $column_map              Details of VIEW columns
 * @param string        $view_name               Name of the VIEW
 * @param string        $db                      Database name of the VIEW
 *
 * @return string $new_transformations_sql SQL query for new transformations
 */
function PMA_getNewTransformationDataSql($pma_transformation_data, $column_map, $view_name, $db)
{
    $cfgRelation = PMA_getRelationsParam();
    // Need to store new transformation details for VIEW
    $new_transformations_sql = 'INSERT INTO ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['column_info']) . ' (`db_name`, `table_name`, `column_name`, `comment`, ' . '`mimetype`, `transformation`, `transformation_options`)' . ' VALUES ';
    $column_count = 0;
    $add_comma = false;
    while ($data_row = $GLOBALS['dbi']->fetchAssoc($pma_transformation_data)) {
        foreach ($column_map as $column) {
            if ($data_row['table_name'] == $column['table_name'] && $data_row['column_name'] == $column['refering_column']) {
                $new_transformations_sql .= $add_comma ? ', ' : '';
                $new_transformations_sql .= '(' . '\'' . $db . '\', ' . '\'' . $view_name . '\', ' . '\'';
                $new_transformations_sql .= isset($column['real_column']) ? $column['real_column'] : $column['refering_column'];
                $new_transformations_sql .= '\', ' . '\'' . $data_row['comment'] . '\', ' . '\'' . $data_row['mimetype'] . '\', ' . '\'' . $data_row['transformation'] . '\', ' . '\'' . PMA_Util::sqlAddSlashes($data_row['transformation_options']) . '\')';
                $add_comma = true;
                $column_count++;
                break;
            }
        }
        if ($column_count == count($column_map)) {
            break;
        }
    }
    return $column_count > 0 ? $new_transformations_sql : '';
}
开发者ID:mercysmart,项目名称:naikelas,代码行数:35,代码来源:tbl_views.lib.php

示例4: setUp

 /**
  * Setup function for test cases
  *
  * @access protected
  * @return void
  */
 protected function setUp()
 {
     /**
      * SET these to avoid undefined index error
      */
     $_SESSION['PMA_Theme'] = new PMA_Theme();
     $_POST['zoom_submit'] = 'zoom';
     $GLOBALS['server'] = 1;
     $GLOBALS['PMA_PHP_SELF'] = 'index.php';
     $GLOBALS['pmaThemeImage'] = 'themes/dot.gif';
     $GLOBALS['is_ajax_request'] = false;
     $GLOBALS['cfgRelation'] = PMA_getRelationsParam();
     $GLOBALS['PMA_Types'] = new PMA_Types_MySQL();
     $GLOBALS['cfg']['ServerDefault'] = 1;
     $GLOBALS['cfg']['maxRowPlotLimit'] = 500;
     $GLOBALS['cfg']['Server']['DisableIS'] = false;
     $GLOBALS['cfg']['ServerDefault'] = 1;
     $GLOBALS['cfg']['ActionLinksMode'] = 'both';
     $GLOBALS['cfg']['ForeignKeyMaxLimit'] = 100;
     $GLOBALS['cfg']['InitialSlidersState'] = 'closed';
     $GLOBALS['cfg']['MaxRows'] = 25;
     $GLOBALS['cfg']['TabsMode'] = 'text';
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $columns = array(array('Field' => 'Field1', 'Type' => 'Type1', 'Null' => 'Null1', 'Collation' => 'Collation1'), array('Field' => 'Field2', 'Type' => 'Type2', 'Null' => 'Null2', 'Collation' => 'Collation2'));
     $dbi->expects($this->any())->method('getColumns')->will($this->returnValue($columns));
     $show_create_table = "CREATE TABLE `pma_bookmark` (\n        `id` int(11) NOT NULL AUTO_INCREMENT,\n        `dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',\n        `user` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',\n        `label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',\n        `query` text COLLATE utf8_bin NOT NULL,\n        PRIMARY KEY (`id`),\n        KEY `foreign_field` (`foreign_db`,`foreign_table`)\n        ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin " . "COMMENT='Bookmarks'";
     $dbi->expects($this->any())->method('fetchValue')->will($this->returnValue($show_create_table));
     $GLOBALS['dbi'] = $dbi;
 }
开发者ID:saisai,项目名称:phpmyadmin,代码行数:35,代码来源:PMA_TableSearch_test.php

示例5: testPMAGetRelationsParam

 /**
  * Test for PMA_getRelationsParam & PMA_getRelationsParamDiagnostic
  *
  * @return void
  */
 public function testPMAGetRelationsParam()
 {
     $relationsPara = PMA_getRelationsParam();
     $this->assertEquals(false, $relationsPara['relwork']);
     $this->assertEquals(false, $relationsPara['bookmarkwork']);
     $this->assertEquals('root', $relationsPara['user']);
     $this->assertEquals('phpmyadmin', $relationsPara['db']);
     $retval = PMA_getRelationsParamDiagnostic($relationsPara);
     //check $cfg['Servers'][$i]['pmadb']
     $this->assertContains("\$cfg['Servers'][\$i]['pmadb']", $retval);
     $this->assertContains('<strong>OK</strong>', $retval);
     //$cfg['Servers'][$i]['relation']
     $result = "\$cfg['Servers'][\$i]['pmadb']  ... </th><td class=\"right\">" . "<font color=\"green\"><strong>OK</strong></font>";
     $this->assertContains($result, $retval);
     // $cfg['Servers'][$i]['relation']
     $result = "\$cfg['Servers'][\$i]['relation']  ... </th><td class=\"right\">" . "<font color=\"red\"><strong>not OK</strong></font>";
     $this->assertContains($result, $retval);
     // General relation features
     $result = 'General relation features: <font color="red">Disabled</font>';
     $this->assertContains($result, $retval);
     // $cfg['Servers'][$i]['table_info']
     $result = "\$cfg['Servers'][\$i]['table_info']  ... </th>" . "<td class=\"right\">" . "<font color=\"red\"><strong>not OK</strong></font>";
     $this->assertContains($result, $retval);
     // Display Features:
     $result = 'Display Features: <font color="red">Disabled</font>';
     $this->assertContains($result, $retval);
     $relationsPara['db'] = false;
     $retval = PMA_getRelationsParamDiagnostic($relationsPara);
     $result = __('General relation features');
     $this->assertContains($result, $retval);
     $result = 'Configuration of pmadb… ';
     $this->assertContains($result, $retval);
     $result = "<strong>not OK</strong>";
     $this->assertContains($result, $retval);
 }
开发者ID:ryanfmurphy,项目名称:phpmyadmin,代码行数:40,代码来源:PMA_relation_test.php

示例6: setProperties

 /**
  * Sets the import plugin properties.
  * Called in the constructor.
  *
  * @return void
  */
 protected function setProperties()
 {
     $this->_setCfgRelation(PMA_getRelationsParam());
     $cfgRelation = $this->_getCfgRelation();
     if ($GLOBALS['num_tables'] < 1 || !$cfgRelation['relwork'] || !$cfgRelation['commwork']) {
         return;
     }
     $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/TextPropertyItem.class.php";
     $importPluginProperties = new ImportPluginProperties();
     $importPluginProperties->setText('DocSQL');
     $importPluginProperties->setExtension('');
     $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 TextPropertyItem();
     $leaf->setName("table");
     $leaf->setText(__('Table name'));
     $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:nhodges,项目名称:phpmyadmin,代码行数:41,代码来源:ImportDocsql.class.php

示例7: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  * @return void
  */
 protected function setUp()
 {
     $_REQUEST['page_number'] = 33;
     $_REQUEST['dia_show_color'] = true;
     $_REQUEST['dia_show_keys'] = true;
     $_REQUEST['dia_orientation'] = 'orientation';
     $_REQUEST['dia_paper'] = 'paper';
     $_REQUEST['t_h'] = array('information_schema.files' => 1);
     $_REQUEST['t_x'] = array('information_schema.files' => 0);
     $_REQUEST['t_y'] = array('information_schema.files' => 0);
     $GLOBALS['server'] = 1;
     $GLOBALS['controllink'] = null;
     $GLOBALS['db'] = 'information_schema';
     $GLOBALS['cfg']['ServerDefault'] = 1;
     $GLOBALS['cfg']['Server']['table_coords'] = "table_name";
     //_SESSION
     $_SESSION['relation'][$GLOBALS['server']] = array('PMA_VERSION' => PMA_VERSION, 'table_coords' => "table_name", 'displaywork' => 'displaywork', 'db' => "information_schema", 'table_info' => 'table_info', 'relwork' => 'relwork', 'relation' => 'relation');
     PMA_getRelationsParam();
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->any())->method('numRows')->will($this->returnValue(1));
     $dbi->expects($this->any())->method('query')->will($this->returnValue("executed_1"));
     $dbi->expects($this->any())->method('tryQuery')->will($this->returnValue("executed_1"));
     $fetchArrayReturn = array('table_name' => 'CHARACTER_SETS');
     $fetchArrayReturn2 = array('table_name' => 'COLLATIONS');
     $dbi->expects($this->at(2))->method('fetchAssoc')->will($this->returnValue($fetchArrayReturn));
     $dbi->expects($this->at(3))->method('fetchAssoc')->will($this->returnValue($fetchArrayReturn2));
     $dbi->expects($this->at(4))->method('fetchAssoc')->will($this->returnValue(false));
     $getIndexesResult = array(array('Table' => 'pma_tbl', 'Field' => 'field1', 'Key' => 'PRIMARY', 'Key_name' => "Key_name", 'Column_name' => "Column_name"));
     $dbi->expects($this->any())->method('getTableIndexes')->will($this->returnValue($getIndexesResult));
     $fetchValue = "CREATE TABLE `pma_bookmark` (\n             `id` int(11) NOT NULL AUTO_INCREMENT,\n              `dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',\n              `user` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',\n              `label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',\n              `query` text COLLATE utf8_bin NOT NULL,\n              PRIMARY KEY (`id`)\n             ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 " . "COLLATE=utf8_bin COMMENT='Bookmarks'";
     $dbi->expects($this->any())->method('fetchValue')->will($this->returnValue($fetchValue));
     $GLOBALS['dbi'] = $dbi;
     $this->object = new PMA_Dia_Relation_Schema('information_schema');
 }
开发者ID:yonh,项目名称:php-mvc,代码行数:41,代码来源:Dia_Relation_Schema_test.php

示例8: setUp

 /**
  * Setup function for test cases
  *
  * @access protected
  * @return void
  */
 protected function setUp()
 {
     /**
      * SET these to avoid undefined index error
      */
     $_SESSION['PMA_Theme'] = new Theme();
     $_POST['zoom_submit'] = 'zoom';
     $GLOBALS['server'] = 1;
     $GLOBALS['PMA_PHP_SELF'] = 'index.php';
     $GLOBALS['pmaThemeImage'] = 'themes/dot.gif';
     $GLOBALS['is_ajax_request'] = false;
     $GLOBALS['cfgRelation'] = PMA_getRelationsParam();
     $GLOBALS['PMA_Types'] = new TypesMySQL();
     $GLOBALS['cfg']['Server']['DisableIS'] = false;
     $dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
     $columns = array(array('Field' => 'Field1', 'Type' => 'Type1', 'Null' => 'Null1', 'Collation' => 'Collation1'), array('Field' => 'Field2', 'Type' => 'Type2', 'Null' => 'Null2', 'Collation' => 'Collation2'));
     $dbi->expects($this->any())->method('getColumns')->will($this->returnValue($columns));
     $show_create_table = "CREATE TABLE `pma_bookmark` (\n        `id` int(11) NOT NULL AUTO_INCREMENT,\n        `dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',\n        `user` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',\n        `label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',\n        `query` text COLLATE utf8_bin NOT NULL,\n        PRIMARY KEY (`id`),\n        KEY `foreign_field` (`foreign_db`,`foreign_table`)\n        ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin " . "COMMENT='Bookmarks'";
     $dbi->expects($this->any())->method('fetchValue')->will($this->returnValue($show_create_table));
     $GLOBALS['dbi'] = $dbi;
     $this->_response = new PMA\Test\Stubs\Response();
     $container = Container::getDefaultContainer();
     $container->set('db', 'PMA');
     $container->set('table', 'PMA_BookMark');
     $container->set('dbi', $GLOBALS['dbi']);
     $container->set('response', $this->_response);
     $container->set('searchType', 'replace');
 }
开发者ID:akandshuvo,项目名称:phpmyadmin,代码行数:34,代码来源:TableSearchControllerTest.php

示例9: setUp

 /**
  * Configures environment
  *
  * @return void
  */
 protected function setUp()
 {
     /**
      * SET these to avoid undefined index error
      */
     $GLOBALS['server'] = 0;
     $GLOBALS['cfg']['Server']['DisableIS'] = false;
     $GLOBALS['cfg']['ServerDefault'] = 1;
     $GLOBALS['cfg']['ActionLinksMode'] = 'both';
     $GLOBALS['cfg']['MaxExactCount'] = 100;
     $GLOBALS['cfg']['MaxExactCountViews'] = 100;
     $GLOBALS['cfg']['Server']['pmadb'] = "pmadb";
     $GLOBALS['sql_auto_increment'] = true;
     $GLOBALS['sql_if_not_exists'] = true;
     $GLOBALS['sql_drop_table'] = true;
     $GLOBALS['cfg']['Server']['table_uiprefs'] = "pma__table_uiprefs";
     $_SESSION['PMA_Theme'] = new PMA_Theme();
     $GLOBALS['pmaThemeImage'] = 'themes/dot.gif';
     $GLOBALS['is_ajax_request'] = false;
     $GLOBALS['cfgRelation'] = PMA_getRelationsParam();
     $GLOBALS['pma'] = new DataBasePMAMock();
     $GLOBALS['pma']->databases = new DataBaseMock();
     $sql_isView_true = "SELECT TABLE_NAME\n            FROM information_schema.VIEWS\n            WHERE TABLE_SCHEMA = 'PMA'\n                AND TABLE_NAME = 'PMA_BookMark'";
     $sql_isView_false = "SELECT TABLE_NAME\n            FROM information_schema.VIEWS\n            WHERE TABLE_SCHEMA = 'PMA'\n                AND TABLE_NAME = 'PMA_BookMark_2'";
     $sql_isUpdatableView_true = "SELECT TABLE_NAME\n            FROM information_schema.VIEWS\n            WHERE TABLE_SCHEMA = 'PMA'\n                AND TABLE_NAME = 'PMA_BookMark'\n                AND IS_UPDATABLE = 'YES'";
     $sql_isUpdatableView_false = "SELECT TABLE_NAME\n            FROM information_schema.VIEWS\n            WHERE TABLE_SCHEMA = 'PMA'\n                AND TABLE_NAME = 'PMA_BookMark_2'\n                AND IS_UPDATABLE = 'YES'";
     $sql_analyzeStructure_true = "SELECT COLUMN_NAME, DATA_TYPE\n                FROM information_schema.COLUMNS\n                WHERE TABLE_SCHEMA = 'PMA'\n                AND TABLE_NAME = 'PMA_BookMark'";
     $sql_copy_data = "SELECT TABLE_NAME\n            FROM information_schema.VIEWS\n            WHERE TABLE_SCHEMA = 'db_data'\n                AND TABLE_NAME = 'table_data'";
     $getUniqueColumns_sql = "select unique column";
     $fetchResult = array(array($sql_isView_true, null, null, null, 0, true), array($sql_copy_data, null, null, null, 0, false), array($sql_isView_false, null, null, null, 0, false), array($sql_isUpdatableView_true, null, null, null, 0, true), array($sql_isUpdatableView_false, null, null, null, 0, false), array($sql_analyzeStructure_true, null, null, null, 0, array(array('COLUMN_NAME' => 'COLUMN_NAME', 'DATA_TYPE' => 'DATA_TYPE'))), array($getUniqueColumns_sql, array('Key_name', null), 'Column_name', null, 0, array(array('index1'), array('index3'), array('index5'))), array($getUniqueColumns_sql, 'Column_name', 'Column_name', null, 0, array('column1', 'column3', 'column5', 'ACCESSIBLE', 'ADD', 'ALL')), array('SHOW COLUMNS FROM `PMA`.`PMA_BookMark`', 'Field', 'Field', null, 0, array('column1', 'column3', 'column5', 'ACCESSIBLE', 'ADD', 'ALL')));
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->any())->method('fetchResult')->will($this->returnValueMap($fetchResult));
     $dbi->expects($this->any())->method('fetchValue')->will($this->returnValue("CREATE TABLE `PMA`.`PMA_BookMark_2` (\n                    `id` int(11) NOT NULL AUTO_INCREMENT,\n                    `username` text NOT NULL\n                    )"));
     $dbi->_table_cache["PMA"]["PMA_BookMark"] = array('ENGINE' => true, 'Create_time' => true, 'TABLE_TYPE' => true, 'Comment' => true);
     $databases = array();
     $database_name = 'PMA';
     $databases[$database_name]['SCHEMA_TABLES'] = 1;
     $databases[$database_name]['SCHEMA_TABLE_ROWS'] = 3;
     $databases[$database_name]['SCHEMA_DATA_LENGTH'] = 5;
     $databases[$database_name]['SCHEMA_MAX_DATA_LENGTH'] = 10;
     $databases[$database_name]['SCHEMA_INDEX_LENGTH'] = 10;
     $databases[$database_name]['SCHEMA_LENGTH'] = 10;
     $dbi->expects($this->any())->method('getTablesFull')->will($this->returnValue($databases));
     $dbi->expects($this->any())->method('isSystemSchema')->will($this->returnValue(false));
     $dbi->expects($this->any())->method('numRows')->will($this->returnValue(20));
     $dbi->expects($this->any())->method('tryQuery')->will($this->returnValue(10));
     $triggers = array(array("name" => "name1", "create" => "crate1"), array("name" => "name2", "create" => "crate2"), array("name" => "name3", "create" => "crate3"));
     $dbi->expects($this->any())->method('getTriggers')->will($this->returnValue($triggers));
     $create_sql = "CREATE TABLE `PMA`.`PMA_BookMark_2` (\n                    `id` int(11) NOT NULL AUTO_INCREMENT,\n                    `username` text NOT NULL";
     $dbi->expects($this->any())->method('query')->will($this->returnValue($create_sql));
     $dbi->expects($this->any())->method('getTableIndexesSql')->will($this->returnValue($getUniqueColumns_sql));
     $dbi->expects($this->any())->method('insertId')->will($this->returnValue(10));
     $dbi->expects($this->any())->method('fetchAssoc')->will($this->returnValue(false));
     $value = array("Auto_increment" => "Auto_increment");
     $dbi->expects($this->any())->method('fetchSingleRow')->will($this->returnValue($value));
     $dbi->expects($this->any())->method('fetchRow')->will($this->returnValue(false));
     $GLOBALS['dbi'] = $dbi;
 }
开发者ID:nervo,项目名称:phpmyadmin,代码行数:63,代码来源:PMA_Table_test.php

示例10: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  * @return void
  */
 protected function setUp()
 {
     $_REQUEST['page_number'] = 33;
     $_REQUEST['pdf_show_grid'] = true;
     $_REQUEST['pdf_show_color'] = true;
     $_REQUEST['pdf_show_keys'] = true;
     $_REQUEST['pdf_orientation'] = 'orientation';
     $_REQUEST['pdf_show_table_dimension'] = true;
     $_REQUEST['pdf_all_tables_same_width'] = true;
     $_REQUEST['pdf_paper'] = 'paper';
     $_REQUEST['pdf_table_order'] = '';
     $_REQUEST['t_h'] = array('information_schema.files' => 1);
     $_REQUEST['t_x'] = array('information_schema.files' => 0);
     $_REQUEST['t_y'] = array('information_schema.files' => 0);
     $GLOBALS['server'] = 1;
     $GLOBALS['controllink'] = null;
     $GLOBALS['db'] = 'information_schema';
     $GLOBALS['cfg']['Server']['pmadb'] = "pmadb";
     $GLOBALS['cfg']['LimitChars'] = 100;
     $GLOBALS['cfg']['ServerDefault'] = 1;
     $GLOBALS['cfg']['Server']['user'] = "user";
     $GLOBALS['cfg']['Server']['table_coords'] = "table_name";
     $GLOBALS['cfg']['Server']['bookmarktable'] = "bookmarktable";
     $GLOBALS['cfg']['Server']['relation'] = "relation";
     $GLOBALS['cfg']['Server']['table_info'] = "table_info";
     //_SESSION
     $_SESSION['relation'][$GLOBALS['server']] = array('PMA_VERSION' => PMA_VERSION, 'table_coords' => "table_name", 'displaywork' => 'displaywork', 'db' => "information_schema", 'table_info' => 'table_info', 'relwork' => false, 'relation' => 'relation', 'mimework' => 'mimework', 'commwork' => 'commwork', 'column_info' => 'column_info', 'pdf_pages' => 'pdf_pages');
     PMA_getRelationsParam();
     $dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->any())->method('numRows')->will($this->returnValue(1));
     $dbi->expects($this->any())->method('query')->will($this->returnValue("executed_1"));
     $dbi->expects($this->any())->method('tryQuery')->will($this->returnValue("executed_1"));
     $fetchArrayReturn = array('table_name' => 'CHARACTER_SETS');
     $fetchArrayReturn2 = array('table_name' => 'COLLATIONS');
     $dbi->expects($this->at(2))->method('fetchAssoc')->will($this->returnValue($fetchArrayReturn));
     $dbi->expects($this->at(3))->method('fetchAssoc')->will($this->returnValue($fetchArrayReturn2));
     $dbi->expects($this->at(4))->method('fetchAssoc')->will($this->returnValue(false));
     $fetchRowReturn = array('table_name', 'table_name');
     //let fetchRow have more results
     for ($index = 0; $index < 4; ++$index) {
         $dbi->expects($this->at($index))->method('fetchRow')->will($this->returnValue($fetchRowReturn));
     }
     $fields_info = array("Host" => array("Field" => "host", "Type" => "char(60)", "Null" => "NO", 'Extra' => "Extra"));
     $dbi->expects($this->any())->method('getColumns')->will($this->returnValue($fields_info));
     $dbi->expects($this->any())->method('selectDb')->will($this->returnValue(true));
     $getIndexesResult = array(array('Table' => 'pma_tbl', 'Field' => 'field1', 'Key' => 'PRIMARY', 'Key_name' => "Key_name", 'Column_name' => "Column_name"));
     $dbi->expects($this->any())->method('getTableIndexes')->will($this->returnValue($getIndexesResult));
     $fetchValue = "CREATE TABLE `pma_bookmark` (\n             `id` int(11) NOT NULL AUTO_INCREMENT,\n              `dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',\n              `user` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',\n              `label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',\n              `query` text COLLATE utf8_bin NOT NULL,\n              PRIMARY KEY (`id`)\n             ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 " . "COLLATE=utf8_bin COMMENT='Bookmarks'";
     $dbi->expects($this->any())->method('fetchValue')->will($this->returnValue($fetchValue));
     $fetchResult = array('column1' => array('mimetype' => 'value1', 'transformation' => 'pdf'), 'column2' => array('mimetype' => 'value2', 'transformation' => 'xml'));
     $dbi->expects($this->any())->method('fetchResult')->will($this->returnValue($fetchResult));
     $GLOBALS['dbi'] = $dbi;
     $this->object = new PdfRelationSchema('information_schema');
 }
开发者ID:ryanfmurphy,项目名称:phpmyadmin,代码行数:61,代码来源:Pdf_Relation_Schema_test.php

示例11: getHtmlForControlButtons

 /**
  * Returns HTML for hide button displayed infront of the database child node
  *
  * @return String HTML for hide button
  */
 public function getHtmlForControlButtons()
 {
     $ret = '';
     $cfgRelation = PMA_getRelationsParam();
     if ($cfgRelation['navwork']) {
         $db = $this->realParent()->real_name;
         $item = $this->real_name;
         $ret = '<span class="navItemControls">' . '<a href="navigation.php' . PMA_URL_getCommon() . '&hideNavItem=true' . '&itemType=' . urlencode($this->getItemType()) . '&itemName=' . urlencode($item) . '&dbName=' . urlencode($db) . '"' . ' class="hideNavItem ajax">' . PMA_Util::getImage('lightbulb_off.png', __('Hide')) . '</a></span>';
     }
     return $ret;
 }
开发者ID:Sorekk,项目名称:cvillecouncilus,代码行数:16,代码来源:Node_DatabaseChild.class.php

示例12: PMA_save_userprefs

/**
 * Saves user preferences
 *
 * @param array $config_array configuration array
 *
 * @return true|PMA_Message
 */
function PMA_save_userprefs(array $config_array)
{
    
    $common_functions = PMA_CommonFunctions::getInstance();
    $cfgRelation = PMA_getRelationsParam();
    $server = isset($GLOBALS['server'])
        ? $GLOBALS['server']
        : $GLOBALS['cfg']['ServerDefault'];
    $cache_key = 'server_' . $server;
    if (! $cfgRelation['userconfigwork']) {
        // no pmadb table, use session storage
        $_SESSION['userconfig'] = array(
            'db' => $config_array,
            'ts' => time());
        if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
            unset($_SESSION['cache'][$cache_key]['userprefs']);
        }
        return true;
    }

    // save configuration to pmadb
    $query_table = $common_functions->backquote($cfgRelation['db']) . '.'
        . $common_functions->backquote($cfgRelation['userconfig']);
    $query = '
        SELECT `username`
        FROM ' . $query_table . '
          WHERE `username` = \'' . $common_functions->sqlAddSlashes($cfgRelation['user']) . '\'';

    $has_config = PMA_DBI_fetch_value($query, 0, 0, $GLOBALS['controllink']);
    $config_data = json_encode($config_array);
    if ($has_config) {
        $query = '
            UPDATE ' . $query_table . '
            SET `config_data` = \'' . $common_functions->sqlAddSlashes($config_data) . '\'
            WHERE `username` = \'' . $common_functions->sqlAddSlashes($cfgRelation['user']) . '\'';
    } else {
        $query = '
            INSERT INTO ' . $query_table . ' (`username`, `config_data`)
            VALUES (\'' . $common_functions->sqlAddSlashes($cfgRelation['user']) . '\',
                \'' . $common_functions->sqlAddSlashes($config_data) . '\')';
    }
    if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
        unset($_SESSION['cache'][$cache_key]['userprefs']);
    }
    if (!PMA_DBI_try_query($query, $GLOBALS['controllink'])) {
        $message = PMA_Message::error(__('Could not save configuration'));
        $message->addMessage('<br /><br />');
        $message->addMessage(
            PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink']))
        );
        return $message;
    }
    return true;
}
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:61,代码来源:user_preferences.lib.php

示例13: getHtmlForControlButtons

 /**
  * Returns HTML for control buttons displayed infront of a node
  *
  * @return String HTML for control buttons
  */
 public function getHtmlForControlButtons()
 {
     $ret = '';
     $cfgRelation = PMA_getRelationsParam();
     if ($cfgRelation['navwork']) {
         $db = $this->realParent()->real_name;
         $item = $this->real_name;
         $params = array('hideNavItem' => true, 'itemType' => $this->getItemType(), 'itemName' => $item, 'dbName' => $db);
         $ret = '<span class="navItemControls">' . '<a href="navigation.php' . URL::getCommon($params) . '"' . ' class="hideNavItem ajax">' . PMA\libraries\Util::getImage('hide.png', __('Hide')) . '</a></span>';
     }
     return $ret;
 }
开发者ID:phpmyadmin,项目名称:phpmyadmin,代码行数:17,代码来源:NodeDatabaseChild.php

示例14: PMA_centralColumnsGetParams

/**
 * Defines the central_columns parameters for the current user
 *
 * @return array    the central_columns parameters for the current user
 * @access  public
 */
function PMA_centralColumnsGetParams()
{
    static $cfgCentralColumns = null;
    if (null !== $cfgCentralColumns) {
        return $cfgCentralColumns;
    }
    $cfgRelation = PMA_getRelationsParam();
    if ($cfgRelation['centralcolumnswork']) {
        $cfgCentralColumns = array('user' => $GLOBALS['cfg']['Server']['user'], 'db' => $cfgRelation['db'], 'table' => $cfgRelation['central_columns']);
    } else {
        $cfgCentralColumns = false;
    }
    return $cfgCentralColumns;
}
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:20,代码来源:central_columns.lib.php

示例15: PMA_Bookmark_getParams

/**
 * Defines the bookmark parameters for the current user
 *
 * @uses    $GLOBALS['server']
 * @uses    PMA_getRelationsParam()
 * @uses    $GLOBALS['cfg']['Server']['user']
 * @uses    $GLOBALS['cfg']['Server']['pmadb']
 * @uses    $GLOBALS['cfg']['Server']['bookmarktable']
 * @return  array    the bookmark parameters for the current user
 * @access  public
 */
function PMA_Bookmark_getParams()
{
    static $cfgBookmark = null;
    if (null !== $cfgBookmark) {
        return $cfgBookmark;
    }
    $cfgRelation = PMA_getRelationsParam();
    if ($cfgRelation['bookmarkwork']) {
        $cfgBookmark = array('user' => $GLOBALS['cfg']['Server']['user'], 'db' => $GLOBALS['cfg']['Server']['pmadb'], 'table' => $GLOBALS['cfg']['Server']['bookmarktable']);
    } else {
        $cfgBookmark = false;
    }
    return $cfgBookmark;
}
开发者ID:BGCX262,项目名称:zuozhenshi-prego-svn-to-git,代码行数:25,代码来源:bookmark.lib.php


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