Skip to content

Commit

Permalink
connection bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
steevenz committed Apr 16, 2018
1 parent faea0bc commit 038d05e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
15 changes: 12 additions & 3 deletions src/Sql/Abstracts/AbstractConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,16 @@ abstract class AbstractConnection
*
* @var bool
*/
public $debugEnable = true;
public $debugEnable = false;

/**
* AbstractConnection::$transactionEnable
*
* Connection debug mode flag.
*
* @var bool
*/
public $transactionEnable = false;

/**
* AbstractConnection::$cacheEnable
Expand Down Expand Up @@ -216,8 +225,8 @@ public function __construct( Config $config )

$this->config = $config;

$this->debugEnable = $config->offsetExists( 'debugEnable' );
$this->transactionEnabled = $config->offsetGet( 'transEnable' );
$this->debugEnable = (bool) $config->offsetGet( 'debugEnable' );
$this->transactionEnable = (bool) $config->offsetGet( 'transEnable' );
$this->database = $config->offsetGet( 'database' );

$this->connect(
Expand Down
6 changes: 3 additions & 3 deletions src/Sql/Drivers/MySql/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ protected function platformConnectHandler( Config $config )
? MYSQLI_CLIENT_COMPRESS
: 0;
$this->handle = mysqli_init();
//$this->handle->autocommit( ( $this->transactionEnabled ? true : false ) );
//$this->handle->autocommit( ( $this->transactionEnable ? true : false ) );

$this->handle->options( MYSQLI_OPT_CONNECT_TIMEOUT, 10 );

Expand Down Expand Up @@ -405,7 +405,7 @@ protected function platformConnectHandler( Config $config )
// 'MySqli was configured for an SSL connection, but got an unencrypted connection instead!';
logger()->error( 'E_DB_CONNECTION_SSL', [ $this->platform ] );

if ( $config->debug ) {
if ( $config->debugEnable ) {
throw new RuntimeException( 'E_DB_CONNECTION_SSL' );
}

Expand All @@ -417,7 +417,7 @@ protected function platformConnectHandler( Config $config )
logger()->error( 'E_DB_CONNECTION_CHARSET', [ $config->charset ] );
$this->handle->close();

if ( $config->debug ) {
if ( $config->debugEnable ) {
// 'Unable to set client connection character set: ' . $this->charset
throw new RuntimeException( 'E_DB_CONNECTION_CHARSET', [ $config->charset ] );
}
Expand Down

0 comments on commit 038d05e

Please sign in to comment.