[php-maint] Bug#702079: php5-sybase: mssql connector doesn't work with Azure SQL

Mark A. Hershberger mah at everybody.org
Sat Mar 2 15:15:57 UTC 2013


Package: php5-sybase
Version: 5.5.0~alpha5-1
Severity: important

The SQL database available on Azure apparently does not have the same
connection semantics as SQL Server.  “use DATABASE” is not possible — it
returns an error saying that you should open a new connection if you
want a new database.

This is confusing when you are using the DBLIB connector because it is
the DBLIB connection code that does the “use”, not the developer's PHP
code.

The FreeTDS people recognized this a while back:

    About a year ago we added the DBSETLDBNAME macro as a way to set the
    dbname in the db-lib LOGINREC.  That sets the dbname in the login
    packet, obviating the need for "USE dbname".

    http://lists.ibiblio.org/pipermail/freetds/2012q4/028168.html

The attached patch makes use of DBSETLDBNAME and eliminates the USE.

-- System Information:
Debian Release: 7.0
  APT prefers stable
  APT policy: (700, 'stable'), (650, 'unstable'), (650, 'testing'), (550, 'experimental'), (500, 'testing-updates'), (500, 'stable-updates')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages php5-sybase depends on:
ii  dpkg                                   1.16.9
ii  libapache2-mod-php5 [phpapi-20121212]  5.5.0~alpha5-1
ii  libc6                                  2.17-0experimental2
ii  libsybdb5                              0.91-2
ii  php5-cli [phpapi-20121212]             5.5.0~alpha5-1
ii  php5-common                            5.5.0~alpha5-1
ii  ucf                                    3.0025+nmu3

php5-sybase recommends no packages.

php5-sybase suggests no packages.

-- no debconf information

diff --git a/debian/changelog b/debian/changelog
index c4261fc..2eb3e89 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+php5 (5.5.0~alpha5-2) experimental; urgency=low
+
+  * Allow pdo_dblib to connect to Azure SQL by putting the dbname in the
+    login packet.
+
+ -- Mark A. Hershberger <mah at everybody.org>  Sat, 02 Mar 2013 10:09:55 -0500
+
 php5 (5.5.0~alpha5-1) experimental; urgency=low
 
   * Imported Upstream version 5.5.0~alpha5
diff --git a/debian/patches/pdo_dblib_driver.patch b/debian/patches/pdo_dblib_driver.patch
new file mode 100644
index 0000000..7538d0d
--- /dev/null
+++ b/debian/patches/pdo_dblib_driver.patch
@@ -0,0 +1,24 @@
+This allows the pdo_dblib driver to access Azure SQL
+
+--- a/ext/pdo_dblib/dblib_driver.c
++++ b/ext/pdo_dblib/dblib_driver.c
+@@ -288,6 +288,9 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
+ 	if (dbh->password) {
+ 		DBSETLPWD(H->login, dbh->password);
+ 	}
++	if (vars[3].optval) {
++		DBSETLDBNAME(H->login, vars[3].optval);
++	}
+ 	
+ #if !PHP_DBLIB_IS_MSSQL
+ 	if (vars[0].optval) {
+@@ -317,9 +320,6 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
+ 	/* allow double quoted indentifiers */
+ 	DBSETOPT(H->link, DBQUOTEDIDENT, NULL);
+ 
+-	if (vars[3].optval && FAIL == dbuse(H->link, vars[3].optval)) {
+-		goto cleanup;
+-	}
+ 
+ 	ret = 1;
+ 	dbh->max_escaped_char_length = 2;
diff --git a/debian/patches/series b/debian/patches/series
index cd94e1a..f65eff2 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -52,3 +52,4 @@ php-5.4.0-dlopen.patch
 php-fpm-m68k.patch
 expose_all_built_and_installed_apis.patch
 use_updated_install-pear-nozlib.phar.patch
+pdo_dblib_driver.patch



More information about the pkg-php-maint mailing list