Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Tests/Mock/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public static function create(TestCase $test, $nullDate = '0000-00-00 00:00:00',
'getCollation',
'getConnectionCollation',
'getConnectionEncryption',
'isConnectionEncryptionSupported',
'getConnectors',
'getDateFormat',
'getInstance',
Expand Down
12 changes: 12 additions & 0 deletions Tests/Stubs/nosqldriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,18 @@ public function getConnectionEncryption(): string
return '';
}

/**
* Method to test if the database TLS connections encryption are supported.
*
* @return boolean Whether the databse supports TLS connections encryption.
*
* @since __DEPLOY_VERSION__
*/
public function isConnectionEncryptionSupported(): bool
{
return false;
}

/**
* Get the number of returned rows for the previous executed SQL statement.
*
Expand Down
9 changes: 9 additions & 0 deletions src/DatabaseInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ public function getConnectionCollation();
*/
public function getConnectionEncryption(): string;

/**
* Method to test if the database TLS connections encryption are supported.
*
* @return boolean Whether the databse supports TLS connections encryption.
*
* @since __DEPLOY_VERSION__
*/
public function isConnectionEncryptionSupported(): bool;

/**
* Get the total number of SQL statements executed by the database driver.
*
Expand Down
16 changes: 16 additions & 0 deletions src/Mysql/MysqlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,22 @@ public function getConnectionEncryption(): string
return '';
}

/**
* Method to test if the database TLS connections encryption are supported.
*
* @return boolean Whether the databse supports TLS connections encryption.
*
* @since __DEPLOY_VERSION__
*/
public function isConnectionEncryptionSupported(): bool
{
$this->connect();

$variables = $this->setQuery('SHOW SESSION VARIABLES WHERE `Variable_name` IN (\'have_ssl\')')->loadObjectList('Variable_name');

return !empty($variables['have_ssl']->Value) && $variables['have_ssl']->Value === 'YES';
}

/**
* Return the query string to create new Database.
*
Expand Down
16 changes: 16 additions & 0 deletions src/Mysqli/MysqliDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,22 @@ public function getConnectionEncryption(): string
return '';
}

/**
* Method to test if the database TLS connections encryption are supported.
*
* @return boolean Whether the databse supports TLS connections encryption.
*
* @since __DEPLOY_VERSION__
*/
public function isConnectionEncryptionSupported(): bool
{
$this->connect();

$variables = $this->setQuery('SHOW SESSION VARIABLES WHERE `Variable_name` IN (\'have_ssl\')')->loadObjectList('Variable_name');

return !empty($variables['have_ssl']->Value) && $variables['have_ssl']->Value === 'YES';
}

/**
* Return the query string to create new Database.
*
Expand Down
14 changes: 14 additions & 0 deletions src/Pgsql/PgsqlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,20 @@ public function getConnectionEncryption(): string
return '';
}

/**
* Method to test if the database TLS connections encryption are supported.
*
* @return boolean Whether the databse supports TLS connections encryption.
*
* @since __DEPLOY_VERSION__
*/
public function isConnectionEncryptionSupported(): bool
{
$variables = $this->setQuery('SHOW "ssl"')->loadAssoc();

return !empty($variables['ssl']) && $variables['ssl'] === 'on';
}

/**
* Shows the table CREATE statement that creates the given tables.
*
Expand Down
13 changes: 13 additions & 0 deletions src/Sqlite/SqliteDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,19 @@ public function getConnectionEncryption(): string
return '';
}

/**
* Method to test if the database TLS connections encryption are supported.
*
* @return boolean Whether the databse supports TLS connections encryption.
*
* @since __DEPLOY_VERSION__
*/
public function isConnectionEncryptionSupported(): bool
{
// TODO: Not fake this
return false;
}

/**
* Shows the table CREATE statement that creates the given tables.
*
Expand Down
13 changes: 13 additions & 0 deletions src/Sqlsrv/SqlsrvDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,19 @@ public function getConnectionEncryption(): string
return '';
}

/**
* Method to test if the database TLS connections encryption are supported.
*
* @return boolean Whether the databse supports TLS connections encryption.
*
* @since __DEPLOY_VERSION__
*/
public function isConnectionEncryptionSupported(): bool
{
// TODO: Not fake this
return false;
}

/**
* Retrieves field information about the given tables.
*
Expand Down