Skip to content

Commit

Permalink
Merge pull request #17656 from cakephp/debuginfo-role
Browse files Browse the repository at this point in the history
Add connection role to query debug info
  • Loading branch information
markstory committed Apr 9, 2024
2 parents 97f49cf + e73fccd commit 9f39c4e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Database/Query.php
Expand Up @@ -1847,6 +1847,7 @@ function ($errno, $errstr): void {
'(help)' => 'This is a Query object, to get the results execute or iterate it.',
'sql' => $sql,
'params' => $params,
'role' => $this->connectionRole,
'defaultTypes' => $this->getDefaultTypes(),
'executed' => (bool)$this->_statement,
];
Expand Down
3 changes: 3 additions & 0 deletions tests/TestCase/Database/Query/SelectQueryTest.php
Expand Up @@ -16,6 +16,7 @@
*/
namespace Cake\Test\TestCase\Database\Query;

use Cake\Database\Connection;
use Cake\Database\Driver\Mysql;
use Cake\Database\Driver\Postgres;
use Cake\Database\Driver\Sqlite;
Expand Down Expand Up @@ -3260,6 +3261,7 @@ public function testDebugInfo(): void
'params' => [
':c0' => ['value' => '1', 'type' => 'integer', 'placeholder' => 'c0'],
],
'role' => Connection::ROLE_WRITE,
'defaultTypes' => ['id' => 'integer'],
'decorators' => 0,
'executed' => false,
Expand All @@ -3274,6 +3276,7 @@ public function testDebugInfo(): void
'params' => [
':c0' => ['value' => '1', 'type' => 'integer', 'placeholder' => 'c0'],
],
'role' => Connection::ROLE_WRITE,
'defaultTypes' => ['id' => 'integer'],
'decorators' => 0,
'executed' => true,
Expand Down
1 change: 1 addition & 0 deletions tests/TestCase/ORM/Query/SelectQueryTest.php
Expand Up @@ -2602,6 +2602,7 @@ public function testDebugInfo(): void
'(help)' => 'This is a Query object, to get the results execute or iterate it.',
'sql' => $query->sql(),
'params' => $query->getValueBinder()->bindings(),
'role' => 'write',
'defaultTypes' => [
'authors__id' => 'integer',
'authors.id' => 'integer',
Expand Down

0 comments on commit 9f39c4e

Please sign in to comment.