Permalink
Browse files

MySQL: Set session variables in a single statement. Fixes #4103

  • Loading branch information...
1 parent ffc447e commit f0944e8586ef2f8230042d822a3781c4835c3a75 @cbandy cbandy committed Jul 12, 2011
Showing with 6 additions and 5 deletions.
  1. +6 −5 classes/kohana/database/mysql.php
@@ -83,13 +83,14 @@ public function connect()
if ( ! empty($this->_config['connection']['variables']))
{
// Set session variables
- foreach ($this->_config['connection']['variables'] as $variable => $value)
+ $variables = array();
+
+ foreach ($this->_config['connection']['variables'] as $var => $val)
{
- mysql_query(
- 'SET SESSION '.$variable.' = '.$this->quote($value),
- $this->_connection
- );
+ $variables[] = 'SESSION '.$var.' = '.$this->quote($val);
}
+
+ mysql_query('SET '.implode(', ', $variables), $this->_connection);
}
}

0 comments on commit f0944e8

Please sign in to comment.