Merge pull request #18606 from kamil-tekiela/Fix-query-out-of-sync

Fix: Cannot execute stored procedure with SELECT using the SQL tab
This commit is contained in:
Maurício Meneghini Fauth 2023-08-15 00:55:58 -03:00 committed by GitHub
commit 960f7d90a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 20 additions and 16 deletions

View File

@ -4191,7 +4191,7 @@ class Results
// display the Export link).
if (
($analyzedSqlResults['querytype'] === self::QUERY_TYPE_SELECT)
&& empty($analyzedSqlResults['procedure'])
&& empty($analyzedSqlResults['is_procedure'])
) {
if (count($analyzedSqlResults['select_tables']) === 1) {
$urlParams['single_table'] = 'true';
@ -4227,7 +4227,7 @@ class Results
}
return [
'has_procedure' => ! empty($analyzedSqlResults['procedure']),
'has_procedure' => ! empty($analyzedSqlResults['is_procedure']),
'has_geometry' => $geometryFound,
'has_print_link' => $printLink == '1',
'has_export_link' => $analyzedSqlResults['querytype'] === self::QUERY_TYPE_SELECT,

View File

@ -1061,7 +1061,7 @@ class Sql
$response = ResponseRenderer::getInstance();
$response->addJSON($extraData ?? []);
if (empty($analyzedSqlResults['is_select']) || isset($extraData['error'])) {
if (($result instanceof ResultInterface && $result->numFields() === 0) || isset($extraData['error'])) {
return $queryMessage;
}
@ -1125,7 +1125,7 @@ class Sql
'db' => $db,
'table' => $table,
'sql_query' => $sqlQuery,
'is_procedure' => ! empty($analyzedSqlResults['procedure']),
'is_procedure' => ! empty($analyzedSqlResults['is_procedure']),
]);
}
@ -1724,10 +1724,6 @@ class Sql
$extraData
);
if ($this->dbi->moreResults()) {
$this->dbi->nextResult();
}
$warningMessages = $this->operations->getWarningMessagesArray();
// No rows returned -> move back to the calling page

View File

@ -41,7 +41,8 @@ class ImportControllerTest extends AbstractTestCase
$this->dummyDbi->addResult(
'SELECT A.* FROM table1 A WHERE A.nomEtablissement = \'Saint-Louis - Châteaulin\''
. ' AND foo = 4 AND `:a` IS NULL LIMIT 0, 25',
[]
[],
['nomEtablissement', 'foo']
);
$this->dummyDbi->addResult(

View File

@ -82,7 +82,8 @@ class CreateDropDatabaseTest extends TestBase
$this->dbQuery(
'SHOW DATABASES LIKE \'' . $this->databaseName . '\';',
function (): void {
$this->assertFalse($this->isElementPresent('className', 'table_results'));
$this->assertTrue($this->isElementPresent('className', 'table_results'));
$this->assertFalse($this->isElementPresent('cssSelector', '.table_results tbody tr'));
}
);
}

View File

@ -215,7 +215,8 @@ class EventsTest extends TestBase
'USE `' . $this->databaseName . '`;'
. 'SHOW EVENTS WHERE Db=\'' . $this->databaseName . '\' AND Name=\'test_event\';',
function (): void {
$this->assertFalse($this->isElementPresent('className', 'table_results'));
$this->assertTrue($this->isElementPresent('className', 'table_results'));
$this->assertFalse($this->isElementPresent('cssSelector', '.table_results tbody tr'));
}
);
}

View File

@ -86,7 +86,8 @@ class OperationsTest extends TestBase
$this->dbQuery(
'SHOW DATABASES LIKE \'' . $this->databaseName . '\'',
function (): void {
$this->assertFalse($this->isElementPresent('className', 'table_results'));
$this->assertTrue($this->isElementPresent('className', 'table_results'));
$this->assertFalse($this->isElementPresent('cssSelector', '.table_results tbody tr'));
}
);

View File

@ -216,7 +216,8 @@ class ProceduresTest extends TestBase
$this->dbQuery(
"SHOW PROCEDURE STATUS WHERE Db='" . $this->databaseName . "'",
function (): void {
$this->assertFalse($this->isElementPresent('className', 'table_results'));
$this->assertTrue($this->isElementPresent('className', 'table_results'));
$this->assertFalse($this->isElementPresent('cssSelector', '.table_results tbody tr'));
}
);
}

View File

@ -90,7 +90,8 @@ class StructureTest extends TestBase
$this->dbQuery(
'SHOW TABLES FROM `' . $this->databaseName . '`;',
function (): void {
$this->assertFalse($this->isElementPresent('className', 'table_results'));
$this->assertTrue($this->isElementPresent('className', 'table_results'));
$this->assertFalse($this->isElementPresent('cssSelector', '.table_results tbody tr'));
}
);
}

View File

@ -200,7 +200,8 @@ class TriggersTest extends TestBase
$this->dbQuery(
'SHOW TRIGGERS FROM `' . $this->databaseName . '`;',
function (): void {
$this->assertFalse($this->isElementPresent('className', 'table_results'));
$this->assertTrue($this->isElementPresent('className', 'table_results'));
$this->assertFalse($this->isElementPresent('cssSelector', '.table_results tbody tr'));
}
);
}

View File

@ -226,7 +226,8 @@ class OperationsTest extends TestBase
'USE `' . $this->databaseName . '`;'
. 'SHOW TABLES',
function (): void {
$this->assertFalse($this->isElementPresent('className', 'table_results'));
$this->assertTrue($this->isElementPresent('className', 'table_results'));
$this->assertFalse($this->isElementPresent('cssSelector', '.table_results tbody tr'));
}
);
}