You've already forked phpmyadmin
mirror of
https://github.com/phpmyadmin/phpmyadmin.git
synced 2026-10-23 18:29:15 +03:00
Move getColumnMapFromSql into the method
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
@@ -161,8 +161,6 @@ class CreateController extends AbstractController
|
||||
$view_columns = explode(',', $_POST['view']['column_names']);
|
||||
}
|
||||
|
||||
$column_map = $this->dbi->getColumnMapFromSql($_POST['view']['as'], $view_columns);
|
||||
|
||||
$systemDb = $this->dbi->getSystemDatabase();
|
||||
$pma_transformation_data = $systemDb->getExistingTransformationData($db);
|
||||
|
||||
@@ -170,7 +168,8 @@ class CreateController extends AbstractController
|
||||
// SQL for store new transformation details of VIEW
|
||||
$new_transformations_sql = $systemDb->getNewTransformationDataSql(
|
||||
$pma_transformation_data,
|
||||
$column_map,
|
||||
$view_columns,
|
||||
$_POST['view']['as'],
|
||||
$_POST['view']['name'],
|
||||
$db
|
||||
);
|
||||
|
||||
@@ -60,7 +60,7 @@ class SystemDatabase
|
||||
* Get SQL query for store new transformation details of a VIEW
|
||||
*
|
||||
* @param ResultInterface $transformationData Result set of SQL execution
|
||||
* @param array $columnMap Details of VIEW columns
|
||||
* @param string[] $view_columns Details of VIEW columns
|
||||
* @param string $viewName Name of the VIEW
|
||||
* @param string $db Database name of the VIEW
|
||||
*
|
||||
@@ -68,7 +68,8 @@ class SystemDatabase
|
||||
*/
|
||||
public function getNewTransformationDataSql(
|
||||
ResultInterface $transformationData,
|
||||
array $columnMap,
|
||||
array $view_columns,
|
||||
string $viewSql,
|
||||
$viewName,
|
||||
$db
|
||||
) {
|
||||
@@ -77,6 +78,8 @@ class SystemDatabase
|
||||
return '';
|
||||
}
|
||||
|
||||
$columnMap = $this->dbi->getColumnMapFromSql($viewSql, $view_columns);
|
||||
|
||||
// Need to store new transformation details for VIEW
|
||||
$newTransformationsSql = sprintf(
|
||||
'INSERT INTO %s.%s ('
|
||||
|
||||
@@ -11895,11 +11895,6 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Controllers/View/CreateController.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$sql_query of method PhpMyAdmin\\\\DatabaseInterface\\:\\:getColumnMapFromSql\\(\\) expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Controllers/View/CreateController.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$str of method PhpMyAdmin\\\\DatabaseInterface\\:\\:escapeString\\(\\) expects string, mixed given\\.$#"
|
||||
count: 2
|
||||
@@ -11926,12 +11921,17 @@ parameters:
|
||||
path: libraries/classes/Controllers/View/CreateController.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$viewName of method PhpMyAdmin\\\\SystemDatabase\\:\\:getNewTransformationDataSql\\(\\) expects string, mixed given\\.$#"
|
||||
message: "#^Parameter \\#3 \\$viewSql of method PhpMyAdmin\\\\SystemDatabase\\:\\:getNewTransformationDataSql\\(\\) expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Controllers/View/CreateController.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#4 \\$db of method PhpMyAdmin\\\\SystemDatabase\\:\\:getNewTransformationDataSql\\(\\) expects string, mixed given\\.$#"
|
||||
message: "#^Parameter \\#4 \\$viewName of method PhpMyAdmin\\\\SystemDatabase\\:\\:getNewTransformationDataSql\\(\\) expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Controllers/View/CreateController.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#5 \\$db of method PhpMyAdmin\\\\SystemDatabase\\:\\:getNewTransformationDataSql\\(\\) expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Controllers/View/CreateController.php
|
||||
|
||||
@@ -34755,31 +34755,11 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/StorageEngine.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'real_column' on mixed\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/SystemDatabase.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'refering_column' on mixed\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/SystemDatabase.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'table_name' on mixed\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/SystemDatabase.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method escapeString\\(\\) on mixed\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/SystemDatabase.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\SystemDatabase\\:\\:getNewTransformationDataSql\\(\\) has parameter \\$columnMap with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/SystemDatabase.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#5 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
|
||||
count: 1
|
||||
|
||||
@@ -13076,15 +13076,6 @@
|
||||
<MixedArgument occurrences="1">
|
||||
<code>$column['real_column'] ?? $column['refering_column']</code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess occurrences="4">
|
||||
<code>$column['real_column']</code>
|
||||
<code>$column['refering_column']</code>
|
||||
<code>$column['refering_column']</code>
|
||||
<code>$column['table_name']</code>
|
||||
</MixedArrayAccess>
|
||||
<MixedAssignment occurrences="1">
|
||||
<code>$column</code>
|
||||
</MixedAssignment>
|
||||
<PossiblyNullArgument occurrences="4">
|
||||
<code>$dataRow['comment']</code>
|
||||
<code>$dataRow['mimetype']</code>
|
||||
|
||||
@@ -41,6 +41,14 @@ class SystemDatabaseTest extends AbstractTestCase
|
||||
|
||||
$dbi->method('tryQuery')->willReturn($this->createStub(DummyResult::class));
|
||||
|
||||
$column_map = [
|
||||
[
|
||||
'table_name' => 'table_name',
|
||||
'refering_column' => 'column_name',
|
||||
],
|
||||
];
|
||||
$dbi->method('getColumnMapFromSql')->willReturn($column_map);
|
||||
|
||||
$_SESSION['relation'] = [];
|
||||
$_SESSION['relation'][$GLOBALS['server']] = RelationParameters::fromArray([
|
||||
'table_coords' => 'table_name',
|
||||
@@ -88,17 +96,12 @@ class SystemDatabaseTest extends AbstractTestCase
|
||||
]);
|
||||
|
||||
$db = 'PMA_db';
|
||||
$column_map = [
|
||||
[
|
||||
'table_name' => 'table_name',
|
||||
'refering_column' => 'column_name',
|
||||
],
|
||||
];
|
||||
$view_name = 'view_name';
|
||||
|
||||
$ret = $this->sysDb->getNewTransformationDataSql(
|
||||
$resultStub,
|
||||
$column_map,
|
||||
[],
|
||||
'',
|
||||
$view_name,
|
||||
$db
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user