Req #81314 [NEW]: Add possibility to add MySQL Connection Attributes (incl. custom ones)

From: Date: Fri, 30 Jul 2021 16:00:03 +0000
Subject: Req #81314 [NEW]: Add possibility to add MySQL Connection Attributes (incl. custom ones)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235488@lists.php.net to get a copy of this message
From: andygrunwald at gmail dot com Operating system: - PHP version: 8.0.9 Package: MySQLi related Bug Type: Feature/Change Request Bug description:Add possibility to add MySQL Connection Attributes (incl. custom ones) Description: ------------ MySQL offers to set Connection Attributes: See https://dev.mysql.com/doc/refman/8.0/en/performance-schema-connection-attribute-tables.html Next to the reserved connection attributes (_client_name, ...), many applications set custom attributes, like program_name: - mysqld: https://github.com/mysql/mysql-server/blob/3e90d07c3578e4da39dc1bce73559bbdf655c28c/sql/migrate_keyring.cc#L230 - ProxySQL: https://github.com/sysown/proxysql/pull/672/files - mysqlcheck: https://github.com/mysql/mysql-server/blob/3e90d07c3578e4da39dc1bce73559bbdf655c28c/client/check/mysqlcheck.cc#L502 - mysqladmin: https://github.com/mysql/mysql-server/blob/beb865a960b9a8a16cf999c323e46c5b0c67f21f/client/mysqladmin.cc#L469 - and many more Many programming languages, enable this feature via the DSN like Python (https://dev.mysql.com/doc/dev/connector-python/8.0/tutorials/connection_attributes.html) or via setter functions like Java (http://mysqlblog.fivefarmers.com/2013/03/26/connection-attributes-in-mysql-5-6/). PHP (mysqli or PDO) doesn't offer any kind of possibility to set a custom connection attribute like program_name . With mysqli_options you can set options, but non of them are connection attributes, see https://www.php.net/manual/en/mysqli.options.php. The mysqli constructor doesn't support DSNs, see https://www.php.net/manual/en/mysqli.construct.php The PDO constructor does provide DSNs, see https://www.php.net/manual/de/pdo.construct.php. But I can't see any possibilities for custom connection attributes from the user space. mysqlnd does set already the _client_name attribute. See https://github.com/php/php-src/blob/132d49942460678908d47dc46b13a67b5e331677/ext/mysqlnd/mysqlnd_connection.c#L816 The goal of this feature request should be: Create a way to set custom connection attributes during the connection to a MySQL server. -- Edit bug report at https://bugs.php.net/bug.php?id=81314&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81314&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81314&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81314&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81314&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81314&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81314&r=support Expected behavior: https://bugs.php.net/fix.php?id=81314&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81314&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81314&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81314&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81314&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81314&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81314&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81314&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81314&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81314&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81314&r=mysqlcfg

« previous php.bugs (#235488) next »