Skip to content

Commit

Permalink
fix(Spanner): default creator role is empty str (#5941)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishwarajanand committed Mar 17, 2023
1 parent 465811f commit f922d6c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Spanner/src/Batch/BatchClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function __construct(Operation $operation, $databaseName, array $options
{
$this->operation = $operation;
$this->databaseName = $databaseName;
$this->databaseRole = isset($options['databaseRole']) ? $options['databaseRole'] : null;
$this->databaseRole = isset($options['databaseRole']) ? $options['databaseRole'] : '';
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Spanner/src/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function __construct(
SessionPoolInterface $sessionPool = null,
$returnInt64AsObject = false,
array $info = [],
$databaseRole = null
$databaseRole = ''
) {
$this->connection = $connection;
$this->instance = $instance;
Expand Down Expand Up @@ -2090,7 +2090,7 @@ private function fullyQualifiedDatabaseName($name)

/**
* Returns the 'CREATE DATABASE' statement as per the given database dialect
*
*
* @param string $dialect The dialect of the database to be created
* @return string The specific 'CREATE DATABASE' statement
*/
Expand Down
2 changes: 1 addition & 1 deletion Spanner/src/Instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ public function database($name, array $options = [])
isset($options['sessionPool']) ? $options['sessionPool'] : null,
$this->returnInt64AsObject,
isset($options['database']) ? $options['database'] : [],
isset($options['databaseRole']) ? $options['databaseRole'] : null
isset($options['databaseRole']) ? $options['databaseRole'] : ''
);
}

Expand Down
2 changes: 1 addition & 1 deletion Spanner/src/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ public function createSession($databaseName, array $options = [])
'database' => $databaseName,
'session' => [
'labels' => $this->pluck('labels', $options, false) ?: [],
'creator_role' => $this->pluck('creator_role', $options, false) ?: null
'creator_role' => $this->pluck('creator_role', $options, false) ?: ''
]
] + $options);

Expand Down
2 changes: 1 addition & 1 deletion Spanner/src/Session/CacheSessionPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ private function createSessions($count)
'database' => $this->database->name(),
'sessionTemplate' => [
'labels' => isset($this->config['labels']) ? $this->config['labels'] : [],
'creator_role' => isset($this->config['databaseRole']) ? $this->config['databaseRole'] : null
'creator_role' => isset($this->config['databaseRole']) ? $this->config['databaseRole'] : ''
],
'sessionCount' => $count - $created
]);
Expand Down

0 comments on commit f922d6c

Please sign in to comment.