예제 #1
0
             $show_create = PMA_getHtmlShowCreate($GLOBALS['db'], $selected);
             // Send response to client.
             $response = PMA_Response::getInstance();
             $response->addJSON('message', $show_create);
             exit;
         case 'sync_unique_columns_central_list':
             include_once 'libraries/central_columns.lib.php';
             $centralColsError = PMA_syncUniqueColumns($selected);
             break;
         case 'delete_unique_columns_central_list':
             include_once 'libraries/central_columns.lib.php';
             $centralColsError = PMA_deleteColumnsFromList($selected);
             break;
         case 'make_consistent_with_central_list':
             include_once 'libraries/central_columns.lib.php';
             $centralColsError = PMA_makeConsistentWithList($GLOBALS['db'], $selected);
             break;
     }
     // end switch
 } elseif (isset($selected_fld) && !empty($selected_fld)) {
     // coming from table structure view - do something with
     // selected columns
     $selected = $selected_fld;
     list($what_ret, $query_type_ret, $is_unset_submit_mult, $mult_btn_ret, $centralColsError) = PMA_getDataForSubmitMult($submit_mult, $GLOBALS['db'], $table, $selected, $action);
     //update the existing variables
     if (isset($what_ret)) {
         $what = $what_ret;
     }
     if (isset($query_type_ret)) {
         $query_type = $query_type_ret;
     }
 /**
  * Test for PMA_makeConsistentWithList
  *
  * @return void
  */
 public function testPMAMakeConsistentWithList()
 {
     $GLOBALS['dbi']->expects($this->any())->method('fetchResult')->will($this->returnValue($this->_columnData));
     $GLOBALS['dbi']->expects($this->any())->method('fetchValue')->will($this->returnValue('PMA_table=CREATE table `PMA_table` (id integer)'));
     $this->assertTrue(PMA_makeConsistentWithList("phpmyadmin", array('PMA_table')));
 }
 /**
  * Test for PMA_makeConsistentWithList
  *
  * @return void
  */
 public function testPMAMakeConsistentWithList()
 {
     $dbi = $GLOBALS['dbi'];
     $dbitmp = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $GLOBALS['dbi'] = $dbitmp;
     $dbitmp->expects($this->any())->method('selectDb')->will($this->returnValue(true));
     $dbitmp->expects($this->any())->method('getColumnNames')->will($this->returnValue(array("id", "col1", "col2")));
     $dbitmp->expects($this->any())->method('tryQuery')->will($this->returnValue(true));
     $dbitmp->expects($this->any())->method('fetchResult')->will($this->returnValue(array(array('col_name' => "id", "col_type" => 'integer', 'col_length' => 0, 'col_isNull' => 0, 'col_extra' => '', 'col_default' => 1), array('col_name' => "col1", 'col_type' => 'varchar', 'col_length' => 100, 'col_isNull' => 1, 'col_extra' => '', 'col_default' => 1), array('col_name' => "col2", 'col_type' => 'DATETIME', 'col_length' => 0, 'col_isNull' => 1, 'col_extra' => '', 'col_default' => 'CURRENT_TIMESTAMP'))));
     $dbitmp->expects($this->any())->method('fetchValue')->will($this->returnValue('PMA_table=CREATE table `PMA_table` (id integer)'));
     $this->assertTrue(PMA_makeConsistentWithList("phpmyadmin", array('PMA_table')));
     $GLOBALS['dbi'] = $dbi;
 }