|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-08-24 10:06 UTC] rockyjl at gmai dot com
Description: ------------ in Bug #48539 [28 Jun 2:10am UTC] felipe@php.net This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Fixed in 5.2 and HEAD. 5.3 in soon. Thanks. But the bug still often happen in PHP 5.2.11RC1 ... Could you tell me which version(win32 zip) can work in the environment of win2003 x64 + apache 2.2.11 + sql2005,and the pdo_mssql can connect DB successfully ?? Reproduce code: --------------- function db() { try { $db = new PDO(DB_DSN, DB_User, DB_Password); return $db; } catch (PDOException $e) { die($e->getMessage()); } } Expected result: ---------------- connect DB Successful Actual result: -------------- SQLSTATE[] (null) (severity 0) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 23:00:01 2025 UTC |
I don't how to NMAKE source... Anyone can help me NMake the php_pdo_mssql.dll and php_pdo.dll with this Index: ext/pdo_dblib/dblib_driver.c =================================================================== --- ext/pdo_dblib/dblib_driver.c (revisão 288156) +++ ext/pdo_dblib/dblib_driver.c (cópia de trabalho) @@ -231,9 +231,7 @@ } #if PHP_DBLIB_IS_MSSQL - if (DBSETOPT(H->link, DBTEXTLIMIT, "2147483647") == FAIL) { - goto cleanup; - } + DBSETOPT(H->link, DBTEXTSIZE, "2147483647"); #endif if (vars[3].optval && FAIL == dbuse(H->link, vars[3].optval)) { thank you so much !My Modification: static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_DC) { pdo_dblib_db_handle *H; int i, ret = 0; char *location = " L="; struct pdo_data_src_parser vars[] = { { "charset", NULL, 0 }, { "appname", "PHP " PDO_DBLIB_FLAVOUR, 0 }, { "host", "127.0.0.1", 0 }, { "dbname", NULL, 0 }, { "secure", NULL, 0 }, /* DBSETLSECURE */ /* TODO: DBSETLVERSION ? */ }; php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, 5); H = pecalloc(1, sizeof(*H), dbh->is_persistent); H->login = dblogin(); H->err.sqlstate = dbh->error_code; if (!H->login) { strcat(location, "login"); goto cleanup; } if (dbh->username) { DBSETLUSER(H->login, dbh->username); } if (dbh->password) { DBSETLPWD(H->login, dbh->password); } #if !PHP_DBLIB_IS_MSSQL if (vars[0].optval) { DBSETLCHARSET(H->login, vars[0].optval); } #endif DBSETLAPP(H->login, vars[1].optval); #if PHP_DBLIB_IS_MSSQL dbprocerrhandle(H->login, (EHANDLEFUNC) error_handler); dbprocmsghandle(H->login, (MHANDLEFUNC) msg_handler); #endif H->link = dbopen(H->login, vars[2].optval); if (H->link == NULL) { strcat(location, "link"); goto cleanup; } /* dblib do not return more than this length from text/image */ DBSETOPT(H->link, DBTEXTLIMIT, "2147483647"); /* limit text/image from network */ DBSETOPT(H->link, DBTEXTSIZE, "2147483647"); if (vars[3].optval && FAIL == dbuse(H->link, vars[3].optval)) { strcat(location, "optval"); goto cleanup; } ret = 1; dbh->max_escaped_char_length = 2; dbh->alloc_own_columns = 1; cleanup: for (i = 0; i < sizeof(vars)/sizeof(vars[0]); i++) { if (vars[i].freeme) { efree(vars[i].optval); } } dbh->methods = &dblib_methods; dbh->driver_data = H; if (!ret) { zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] %s (severity %d) %s", //I want to findout the bug location ! DBLIB_G(err).sqlstate, DBLIB_G(err).dberrstr, DBLIB_G(err).severity, location); } return ret; } The PDO MSSQL work is correct, the bug never happen and never throws any PDOException after Complie php_pdo_mssql.dll ... I think my modification STOP all PDOException throw ... Anyone can tell me what is the problem ?The same error occurs using Ubuntu 0910 with Zend Framework: require_once('Zend/Db.php'); $db = Zend_Db::factory('Pdo_Mssql', array( 'host' => 'sqlsrv', 'username' => 'php', 'password' => 'secret', 'dbname' => 'myDatabase', 'pdoType' => 'dblib' )); $result = $db->fetchAll(SELECT * FROM MyTable"); var_dump($result); Zend_Db_Adapter_Exception: SQLSTATE[] (null) (severity 0) in /usr/share/php/libzend-framework-php/Zend/Db/Adapter/Pdo/Abstract.php on line 144Still experiencing this error. Tweaking freetds.conf: [global] # TDS protocol version # Microsoft compatible we hope tds version = 7.0 Had no effect. PHP 5.3.5 (cli) (built: Jan 27 2011 11:42:56) on macports.