Skip to content

Commit 1456e8b

Browse files
Merge pull request #17550 from MauricioFauth/statement-info-vo
Replace `$analyzedSqlResults` array with `StatementInfo` object
2 parents 9aa859b + 10b9375 commit 1456e8b

19 files changed

Lines changed: 938 additions & 890 deletions

libraries/classes/Controllers/Database/QueryByExampleController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function __invoke(): void
126126
);
127127

128128
$this->response->addHTML($sql->executeQueryAndSendQueryResponse(
129-
null, // analyzed_sql_results
129+
null,
130130
false, // is_gotofile
131131
$_POST['db'], // db
132132
null, // table

libraries/classes/Controllers/Import/ImportController.php

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -715,14 +715,13 @@ public function __invoke(): void
715715
// can choke on it so avoid parsing)
716716
$sqlLength = mb_strlen($GLOBALS['sql_query']);
717717
if ($sqlLength <= $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
718-
[
719-
$analyzed_sql_results,
720-
$GLOBALS['db'],
721-
$table_from_sql,
722-
] = ParseAnalyze::sqlQuery($GLOBALS['sql_query'], $GLOBALS['db']);
718+
[$statementInfo, $GLOBALS['db'], $table_from_sql] = ParseAnalyze::sqlQuery(
719+
$GLOBALS['sql_query'],
720+
$GLOBALS['db']
721+
);
723722

724-
$GLOBALS['reload'] = $analyzed_sql_results['reload'];
725-
$GLOBALS['offset'] = $analyzed_sql_results['offset'];
723+
$GLOBALS['reload'] = $statementInfo->reload;
724+
$GLOBALS['offset'] = $statementInfo->offset;
726725

727726
if ($GLOBALS['table'] != $table_from_sql && ! empty($table_from_sql)) {
728727
$GLOBALS['table'] = $table_from_sql;
@@ -747,19 +746,18 @@ public function __invoke(): void
747746

748747
foreach ($queriesToBeExecuted as $GLOBALS['sql_query']) {
749748
// parse sql query
750-
[
751-
$analyzed_sql_results,
752-
$GLOBALS['db'],
753-
$table_from_sql,
754-
] = ParseAnalyze::sqlQuery($GLOBALS['sql_query'], $GLOBALS['db']);
749+
[$statementInfo, $GLOBALS['db'], $table_from_sql] = ParseAnalyze::sqlQuery(
750+
$GLOBALS['sql_query'],
751+
$GLOBALS['db']
752+
);
755753

756-
$GLOBALS['offset'] = $analyzed_sql_results['offset'];
757-
$GLOBALS['reload'] = $analyzed_sql_results['reload'];
754+
$GLOBALS['offset'] = $statementInfo->offset;
755+
$GLOBALS['reload'] = $statementInfo->reload;
758756

759757
// Check if User is allowed to issue a 'DROP DATABASE' Statement
760758
if (
761759
$this->sql->hasNoRightsToDropDatabase(
762-
$analyzed_sql_results,
760+
$statementInfo,
763761
$GLOBALS['cfg']['AllowUserDropDatabase'],
764762
$this->dbi->isSuperUser()
765763
)
@@ -779,7 +777,7 @@ public function __invoke(): void
779777
}
780778

781779
$html_output .= $this->sql->executeQueryAndGetQueryResponse(
782-
$analyzed_sql_results, // analyzed_sql_results
780+
$statementInfo,
783781
false, // is_gotofile
784782
$GLOBALS['db'], // db
785783
$GLOBALS['table'], // table

libraries/classes/Controllers/Sql/SqlController.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,10 @@ public function __invoke(): void
145145
/**
146146
* Parse and analyze the query
147147
*/
148-
[
149-
$analyzed_sql_results,
150-
$GLOBALS['db'],
151-
$GLOBALS['table_from_sql'],
152-
] = ParseAnalyze::sqlQuery($GLOBALS['sql_query'], $GLOBALS['db']);
148+
[$statementInfo, $GLOBALS['db'], $GLOBALS['table_from_sql']] = ParseAnalyze::sqlQuery(
149+
$GLOBALS['sql_query'],
150+
$GLOBALS['db']
151+
);
153152

154153
if ($GLOBALS['table'] != $GLOBALS['table_from_sql'] && ! empty($GLOBALS['table_from_sql'])) {
155154
$GLOBALS['table'] = $GLOBALS['table_from_sql'];
@@ -164,7 +163,7 @@ public function __invoke(): void
164163
*/
165164
if (
166165
$this->sql->hasNoRightsToDropDatabase(
167-
$analyzed_sql_results,
166+
$statementInfo,
168167
$GLOBALS['cfg']['AllowUserDropDatabase'],
169168
$this->dbi->isSuperUser()
170169
)
@@ -206,7 +205,7 @@ public function __invoke(): void
206205
}
207206

208207
$this->response->addHTML($this->sql->executeQueryAndSendQueryResponse(
209-
$analyzed_sql_results,
208+
$statementInfo,
210209
$GLOBALS['is_gotofile'],
211210
$GLOBALS['db'],
212211
$GLOBALS['table'],

libraries/classes/Controllers/Table/SearchController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public function doSelectionAction(): void
259259
);
260260

261261
$this->response->addHTML($sql->executeQueryAndSendQueryResponse(
262-
null, // analyzed_sql_results
262+
null,
263263
false, // is_gotofile
264264
$GLOBALS['db'], // db
265265
$GLOBALS['table'], // table

libraries/classes/Controllers/Table/Structure/BrowseController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ private function displayTableBrowseForSelectedColumns($goto): void
6060
);
6161

6262
// Parse and analyze the query
63-
[$analyzed_sql_results, $GLOBALS['db']] = ParseAnalyze::sqlQuery($sql_query, $GLOBALS['db']);
63+
[$statementInfo, $GLOBALS['db']] = ParseAnalyze::sqlQuery($sql_query, $GLOBALS['db']);
6464

6565
$this->response->addHTML(
6666
$this->sql->executeQueryAndGetQueryResponse(
67-
$analyzed_sql_results ?? '',
67+
$statementInfo,
6868
false, // is_gotofile
69-
(string) $GLOBALS['db'], // db
69+
$GLOBALS['db'], // db
7070
$GLOBALS['table'], // table
7171
null, // find_real_end
7272
null, // sql_query_for_bookmark

libraries/classes/Database/MultiTableQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public static function displayResults($sqlQuery, $db): string
122122
);
123123

124124
return $sql->executeQueryAndSendQueryResponse(
125-
null, // analyzed_sql_results
125+
null,
126126
false, // is_gotofile
127127
$db, // db
128128
null, // table

0 commit comments

Comments
 (0)