|
看到pdo_driver.php有这么一段代码:
PHP复制代码
function __construct ($params)
{
parent ::__construct ($params);
// clause and character used for LIKE escape sequences
if (strpos($this->hostname, 'mysql') !== FALSE)
{
$this->_like_escape_str = '';
$this->_like_escape_chr = '';
//Prior to this version, the charset can't be set in the dsn
if(is_php ('5.3.6'))
{
$this->hostname .= ";charset={$this->char_set}";
}
//Set the charset with the connection options
$this->options['PDO::MYSQL_ATTR_INIT_COMMAND'] = "SET NAMES {$this->char_set}";
}
else if (strpos($this->hostname, 'odbc') !== FALSE)
{
$this->_like_escape_str = " {escape '%s'} ";
$this->_like_escape_chr = '!';
}
else
{
$this->_like_escape_str = " ESCAPE '%s' ";
$this->_like_escape_chr = '!';
}
$this->hostname .= ";dbname=".$this->database;
$this->trans_enabled = FALSE;
$this->_random_keyword = ' RND('.time().')'; // database specific random keyword
}
复制代码
PHP复制代码 $this->trans_enabled = FALSE; 复制代码
这不是关掉事务的控制功能了吗?PDO不支持事务操作?
PHP复制代码
function trans_begin($test_mode = FALSE)
{
if ( ! $this->trans_enabled)
{
return TRUE;
}
// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 0)
{
return TRUE;
}
// Reset the transaction failure flag.
// If the $test_mode flag is set to TRUE transactions will be rolled back
// even if the queries produce a successful result.
$this->_trans_failure = (bool) ($test_mode === TRUE);
return $this->conn_id->beginTransaction();
}
复制代码
|
|