ID: 41539 Updated by: [EMAIL PROTECTED] Reported By: phpbug dot 41539 at sub dot noloop dot net -Status: Assigned +Status: Closed Bug Type: MSSQL related Operating System: * PHP Version: 5.2.5 Assigned To: fmk New Comment:
Apparently this wasn't bug in PHP but freetds. Open separate report about the dblib with win32. Previous Comments: ------------------------------------------------------------------------ [2007-11-15 15:33:27] frode at coretrek dot com The previous comment was a bit imprecise. I compiled FreeTDS from CVS tag BRANCH0_64 as of today, not from freetds-0.64.tar.gz+post64.diff.gz. ------------------------------------------------------------------------ [2007-11-15 15:31:16] frode at coretrek dot com I compiled (freetds 0.64 + post64.diff.gz) and then recompiled my (unmodified) php 5.2.5 using "--with-mssql=/path/to/the/freetds/installation", and whatever you did in post64.diff.gz seems to fix the problem. The test case in my original submission now prints: array(3) { ["id"]=> int(1) ["txt"]=> string(0) "" ["txtmax"]=> string(0) "" } array(3) { ["id"]=> int(2) ["txt"]=> NULL ["txtmax"]=> NULL } as expected. Thank you very much! Is there a timeline/ETA for the next stable release of FreeTDS (0.65)? Also, if any php developers are reading this: It would be great if the win32 binary distribution of PHP could be compiled and linked with FreeTDS instead of the Microsoft DBLIB libraries :) ------------------------------------------------------------------------ [2007-11-15 14:11:43] freddy77 at gmail dot com I'm a FreeTDS developer. There was a problem with (n)text and (n)varchar(max), not with (n)varchar (these types are blobs). For empty blobs pointer from dbdata was NULL. I fixed the problem in CVS HEAD and 0.64 branch. You can find cumulative post 0.64 patch at http://freetds.sourceforge.net/post64.diff.gz, change is at http://freetds.cvs.sourceforge.net/freetds/freetds/src/dblib/dblib.c?r1=1.244.2.3&r2=1.244.2.4 (similar change for CVS head). bye freddy77 ------------------------------------------------------------------------ [2007-06-19 05:58:41] frode at coretrek dot com I don't get it - the patch you posted is partly already in 5.2.3, i.e. it's already there for php_mssql_get_column_content_with_type. But not in php_mssql_get_column_content_without_type. But that's not the real issue here: As I mentioned in the original submission, bug 39213 fixed the problem for most datatypes but doesn't help for the datatype NVARCHAR(MAX). That's because FreeTDS does not return NULL for dbdata() on an NVARCHAR(MAX). Please, take another look at my second comment to this bug, where I posted an ugly work-around that requires the use of FreeTDS' underlying libTDS, which seems to be the only API that can tell the difference between a NULL and a "" in BLOBs (which is what the NVARCHAR(MAX) datatype basically is); the difference is that the size is -1 for NULL values, and 0 for "" values, but the dblib API converts -1 to 0 in dbdatlen(). Thanks again for looking at this bug a second time :) ------------------------------------------------------------------------ [2007-06-18 20:27:16] erudd at netfor dot com Isn't this a dup of #39213. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/41539 -- Edit this bug report at http://bugs.php.net/?id=41539&edit=1