php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #64338
Patch pdo_dblib.patch revision 2013-03-04 16:00 UTC by mah at everybody dot org
revision 2013-03-02 15:30 UTC by mah at everybody dot org

Patch pdo_dblib.patch for MSSQL related Bug #64338

Patch version 2013-03-04 16:00 UTC

Return to Bug #64338 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: mah@everybody.org

Use the DBSETLDBNAME macro to set the dbname in the db-lib LOGINREC.
That sets the dbname in the login packet, obviating the need for "USE
dbname" and allowing pdo_dblib to work with Azure's 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) {
@@ -315,11 +315,8 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
 	DBSETOPT(H->link, DBTEXTSIZE, "2147483647");
 
 	/* allow double quoted indentifiers */
-	DBSETOPT(H->link, DBQUOTEDIDENT, 1);
+	DBSETOPT(H->link, DBQUOTEDIDENT, "1");
 
-	if (vars[3].optval && FAIL == dbuse(H->link, vars[3].optval)) {
-		goto cleanup;
-	}
 
 	ret = 1;
 	dbh->max_escaped_char_length = 2;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC