Skip to content

Commit

Permalink
Make PDO_MYSQL_ATTR_DIRECT_QUERY a proper alias (#16935)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-tekiela authored Dec 26, 2024
1 parent 63e4e08 commit f055447
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 14 deletions.
4 changes: 0 additions & 4 deletions ext/pdo_mysql/mysql_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ static bool pdo_mysql_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val)
((pdo_mysql_db_handle *)dbh->driver_data)->buffered = bval;
PDO_DBG_RETURN(true);

case PDO_MYSQL_ATTR_DIRECT_QUERY:
case PDO_ATTR_EMULATE_PREPARES:
if (!pdo_get_bool_param(&bval, val)) {
PDO_DBG_RETURN(false);
Expand Down Expand Up @@ -555,7 +554,6 @@ static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_
break;

case PDO_ATTR_EMULATE_PREPARES:
case PDO_MYSQL_ATTR_DIRECT_QUERY:
ZVAL_BOOL(return_value, H->emulate_prepare);
break;

Expand Down Expand Up @@ -761,8 +759,6 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
zend_string *ssl_key = NULL, *ssl_cert = NULL, *ssl_ca = NULL, *ssl_capath = NULL, *ssl_cipher = NULL;
H->buffered = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, 1);

H->emulate_prepare = pdo_attr_lval(driver_options,
PDO_MYSQL_ATTR_DIRECT_QUERY, H->emulate_prepare);
H->emulate_prepare = pdo_attr_lval(driver_options,
PDO_ATTR_EMULATE_PREPARES, H->emulate_prepare);

Expand Down
2 changes: 1 addition & 1 deletion ext/pdo_mysql/pdo_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static PHP_MINIT_FUNCTION(pdo_mysql)
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_READ_DEFAULT_GROUP", (zend_long)PDO_MYSQL_ATTR_READ_DEFAULT_GROUP);
#endif
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_COMPRESS", (zend_long)PDO_MYSQL_ATTR_COMPRESS);
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_DIRECT_QUERY", (zend_long)PDO_MYSQL_ATTR_DIRECT_QUERY);
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_DIRECT_QUERY", (zend_long)PDO_ATTR_EMULATE_PREPARES);
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_FOUND_ROWS", (zend_long)PDO_MYSQL_ATTR_FOUND_ROWS);
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_IGNORE_SPACE", (zend_long)PDO_MYSQL_ATTR_IGNORE_SPACE);
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_KEY", (zend_long)PDO_MYSQL_ATTR_SSL_KEY);
Expand Down
2 changes: 1 addition & 1 deletion ext/pdo_mysql/pdo_mysql.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Mysql extends \PDO
/** @cvalue PDO_MYSQL_ATTR_COMPRESS */
public const int ATTR_COMPRESS = UNKNOWN;

/** @cvalue PDO_MYSQL_ATTR_DIRECT_QUERY */
/** @cvalue PDO_ATTR_EMULATE_PREPARES */
public const int ATTR_DIRECT_QUERY = UNKNOWN;

/** @cvalue PDO_MYSQL_ATTR_FOUND_ROWS */
Expand Down
4 changes: 2 additions & 2 deletions ext/pdo_mysql/pdo_mysql_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion ext/pdo_mysql/php_pdo_mysql_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ enum {
PDO_MYSQL_ATTR_MAX_BUFFER_SIZE,
#endif
PDO_MYSQL_ATTR_COMPRESS,
PDO_MYSQL_ATTR_DIRECT_QUERY,
PDO_MYSQL_ATTR_FOUND_ROWS,
PDO_MYSQL_ATTR_IGNORE_SPACE,
PDO_MYSQL_ATTR_SSL_KEY,
Expand Down
6 changes: 1 addition & 5 deletions ext/pdo_mysql/tests/bug68371.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
PDO MySQL Bug #38671 (PDO#getAttribute() cannot be called with platform-specific attribute names)
PDO MySQL Bug #68371 (PDO#getAttribute() cannot be called with platform-specific attribute names)
--EXTENSIONS--
pdo_mysql
--SKIPIF--
Expand All @@ -16,7 +16,6 @@ $pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$attrs = [
// Extensive test: default value and set+get values
PDO::ATTR_EMULATE_PREPARES => array(null, true, false),
PDO::MYSQL_ATTR_DIRECT_QUERY => array(null, false, true),
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => array(null, false, true),

// Just test the default
Expand Down Expand Up @@ -70,9 +69,6 @@ foreach ($attrs as $a => $vals) {
bool(true)
OK
OK
bool(false)
OK
OK
bool(true)
OK
OK
Expand Down

0 comments on commit f055447

Please sign in to comment.