diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2006-03-17 00:15:28 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2006-03-17 00:15:28 +0000 |
commit | 16ff5e55920a21039b41939e16cd31b1afecb20f (patch) | |
tree | 4aa202574be968e912f4e98f71d065be3680752a /ext/pdo_mysql | |
parent | 86780519d412c3488ae84f3e5fc94bd840d1853f (diff) | |
download | php-git-16ff5e55920a21039b41939e16cd31b1afecb20f.tar.gz |
MFB51:
Allow PDO_MYSQL_ATTR_DIRECT_QUERY to be set via constructor
Allow getAttribute() to fetch MySQL specific attributes.
Eliminate unnecessary auto-commit call on connect.
Diffstat (limited to 'ext/pdo_mysql')
-rwxr-xr-x | ext/pdo_mysql/mysql_driver.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index 5114ca573f..0af165e625 100755 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -353,6 +353,14 @@ static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_value ZVAL_LONG(return_value, H->buffered); return 1; + case PDO_MYSQL_ATTR_DIRECT_QUERY: + ZVAL_LONG(return_value, H->emulate_prepare); + return 1; + + case PDO_MYSQL_ATTR_MAX_BUFFER_SIZE: + ZVAL_LONG(return_value, H->max_buffer_size); + return 1; + default: return 0; } @@ -431,7 +439,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ char *init_cmd = NULL, *default_file = NULL, *default_group = NULL; H->buffered = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, 0 TSRMLS_CC); - + H->emulate_prepare = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_DIRECT_QUERY, 0 TSRMLS_CC); H->max_buffer_size = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_MAX_BUFFER_SIZE, 1024 * 1024 TSRMLS_CC); if (mysql_options(H->server, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout)) { @@ -488,7 +496,9 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ goto cleanup; } - mysql_handle_autocommit(dbh TSRMLS_CC); + if (!dbh->auto_commit) { + mysql_handle_autocommit(dbh TSRMLS_CC); + } H->attached = 1; |