Skip to content

Commit

Permalink
MDL-57192 dml: Temporarily disable query logging during setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitagarwal committed Jan 3, 2017
1 parent c14fe2c commit c728b45
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/dml/mssql_native_moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dbop
throw new dml_connection_exception($dberr);
}

// Disable logging until we are fully setup.
$this->query_log_prevent();

// already connected, select database and set some env. variables
$this->query_start("--mssql_select_db", null, SQL_QUERY_AUX);
$result = mssql_select_db($this->dbname, $this->mssql);
Expand Down Expand Up @@ -238,6 +241,9 @@ public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dbop
// Fetch/offset is supported staring from SQL Server 2012.
$this->supportsoffsetfetch = $serverinfo['version'] > '11';

// We can enable logging now.
$this->query_log_allow();

// Connection stabilised and configured, going to instantiate the temptables controller
$this->temptables = new mssql_native_moodle_temptables($this);

Expand Down
6 changes: 6 additions & 0 deletions lib/dml/mysqli_native_moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,9 @@ public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dbop
throw new dml_connection_exception($dberr);
}

// Disable logging until we are fully setup.
$this->query_log_prevent();

$this->query_start("--set_charset()", null, SQL_QUERY_AUX);
$this->mysqli->set_charset('utf8');
$this->query_end(true);
Expand All @@ -466,6 +469,9 @@ public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dbop
$this->query_end($result);
}

// We can enable logging now.
$this->query_log_allow();

// Connection stabilised and configured, going to instantiate the temptables controller
$this->temptables = new mysqli_native_moodle_temptables($this);

Expand Down
6 changes: 6 additions & 0 deletions lib/dml/oci_native_moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dbop
throw new dml_connection_exception($dberr);
}

// Disable logging until we are fully setup.
$this->query_log_prevent();

// Make sure moodle package is installed - now required.
if (!$this->oci_package_installed()) {
try {
Expand Down Expand Up @@ -216,6 +219,9 @@ public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dbop
//note: do not send "ALTER SESSION SET NLS_NUMERIC_CHARACTERS='.,'" !
// instead fix our PHP code to convert "," to "." properly!

// We can enable logging now.
$this->query_log_allow();

// Connection stabilised and configured, going to instantiate the temptables controller
$this->temptables = new oci_native_moodle_temptables($this, $this->unique_session_id);

Expand Down
6 changes: 6 additions & 0 deletions lib/dml/sqlsrv_native_moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dbop
throw new dml_connection_exception($dberr);
}

// Disable logging until we are fully setup.
$this->query_log_prevent();

// Allow quoted identifiers
$sql = "SET QUOTED_IDENTIFIER ON";
$this->query_start($sql, null, SQL_QUERY_AUX);
Expand Down Expand Up @@ -246,6 +249,9 @@ public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dbop
// Fetch/offset is supported staring from SQL Server 2012.
$this->supportsoffsetfetch = $serverinfo['version'] > '11';

// We can enable logging now.
$this->query_log_allow();

// Connection established and configured, going to instantiate the temptables controller
$this->temptables = new sqlsrv_native_moodle_temptables($this);

Expand Down

0 comments on commit c728b45

Please sign in to comment.