mirror of
https://github.com/php/php-src.git
synced 2025-01-25 13:14:22 +08:00
Add PDO::MYSQL_ATTR_COMPRESS connection flag
This commit is contained in:
parent
208e1b8a22
commit
d4f7133441
@ -623,6 +623,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||
long local_infile = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_LOCAL_INFILE, 0 TSRMLS_CC);
|
||||
#ifndef PDO_USE_MYSQLND
|
||||
char *init_cmd = NULL, *default_file = NULL, *default_group = NULL;
|
||||
long compress = 0;
|
||||
#endif
|
||||
H->buffered = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, 1 TSRMLS_CC);
|
||||
|
||||
@ -692,6 +693,14 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||
}
|
||||
efree(default_group);
|
||||
}
|
||||
|
||||
compress = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_COMPRESS, 0 TSRMLS_CC);
|
||||
if (compress) {
|
||||
if (mysql_options(H->server, MYSQL_OPT_COMPRESS, 0)) {
|
||||
pdo_mysql_error(dbh);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,7 @@ static PHP_MINIT_FUNCTION(pdo_mysql)
|
||||
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_INIT_COMMAND", (long)PDO_MYSQL_ATTR_INIT_COMMAND);
|
||||
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_READ_DEFAULT_FILE", (long)PDO_MYSQL_ATTR_READ_DEFAULT_FILE);
|
||||
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_READ_DEFAULT_GROUP", (long)PDO_MYSQL_ATTR_READ_DEFAULT_GROUP);
|
||||
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_COMPRESS", (long)PDO_MYSQL_ATTR_COMPRESS);
|
||||
#endif
|
||||
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_DIRECT_QUERY", (long)PDO_MYSQL_ATTR_DIRECT_QUERY);
|
||||
|
||||
|
@ -158,6 +158,7 @@ enum {
|
||||
PDO_MYSQL_ATTR_READ_DEFAULT_FILE,
|
||||
PDO_MYSQL_ATTR_READ_DEFAULT_GROUP,
|
||||
PDO_MYSQL_ATTR_MAX_BUFFER_SIZE,
|
||||
PDO_MYSQL_ATTR_COMPRESS,
|
||||
#endif
|
||||
PDO_MYSQL_ATTR_DIRECT_QUERY,
|
||||
};
|
||||
|
@ -19,7 +19,7 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
|
||||
$expected['MYSQL_ATTR_INIT_COMMAND'] = true;
|
||||
$expected['MYSQL_ATTR_READ_DEFAULT_FILE'] = true;
|
||||
$expected['MYSQL_ATTR_READ_DEFAULT_GROUP'] = true;
|
||||
|
||||
$expected['MYSQL_ATTR_COMPRESS'] = true;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -75,4 +75,4 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
|
||||
|
||||
print "done!";
|
||||
--EXPECT--
|
||||
done!
|
||||
done!
|
||||
|
Loading…
Reference in New Issue
Block a user