/** * Tests for PMA_getColumnMap() method. * * @return void * @test */ public function testPMAGetColumnMap() { $sql_query = "PMA_sql_query"; $view_columns = array("view_columns1", "view_columns2"); $column_map = PMA_getColumnMap($sql_query, $view_columns); $this->assertEquals(array('table_name' => 'meta1_table', 'refering_column' => 'meta1_name', 'real_column' => 'view_columns1'), $column_map[0]); $this->assertEquals(array('table_name' => 'meta2_table', 'refering_column' => 'meta2_name', 'real_column' => 'view_columns2'), $column_map[1]); }
if (count($options)) { $sql_query .= $sep . ' WITH ' . implode(' ', $options); } } if (PMA_DBI_try_query($sql_query)) { require_once './libraries/tbl_views.lib.php'; // If different column names defined for VIEW $view_columns = array(); if (isset($_REQUEST['view']['column_names'])) { $view_columns = explode(',', $_REQUEST['view']['column_names']); } $column_map = PMA_getColumnMap($_REQUEST['view']['as'], $view_columns); $pma_tranformation_data = PMA_getExistingTranformationData($GLOBALS['db']); if ($pma_tranformation_data !== false) { // SQL for store new transformation details of VIEW $new_transformations_sql = PMA_getNewTransformationDataSql( $pma_tranformation_data, $column_map, $_REQUEST['view']['name'], $GLOBALS['db'] ); // Store new transformations if ($new_transformations_sql != '') { PMA_DBI_try_query($new_transformations_sql); }