ID:               25544
 Comment by:       php at electricsurfer dot com
 Reported By:      snick at getart dot ru
 Status:           Bogus
 Bug Type:         MSSQL related
 Operating System: Windows 2003 Server
 PHP Version:      4.3.2
 Assigned To:      abies
 New Comment:

There's an easy workaround:
SELECT CAST(F AS TEXT) AS F FROM ...
No other changes !


Previous Comments:
------------------------------------------------------------------------

[2003-09-16 05:35:29] [EMAIL PROTECTED]

Ilia, 

this is probably what you meant in the first place, but I'll elaborate
a little more:

MS SQL support on Win32 is implemented using the DbLib C API by
Microsoft, which has this limitation. Use TEXT fields instead.

------------------------------------------------------------------------

[2003-09-16 03:55:28] [EMAIL PROTECTED]

Don't think so ...
He's using Microsoft SQL Server, which has VARCHAR fields of up to 8000
characters (or bytes, not sure)

I'll have a look at this ...

------------------------------------------------------------------------

[2003-09-15 18:30:56] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

You're dealing with VARCHAR maximum length limitation of 255
characters. This is not a PHP bug.

------------------------------------------------------------------------

[2003-09-15 09:37:12] snick at getart dot ru

Description:
------------
Then I try to read value of VARCHAR field I get only 255 characters,
but VARCHAR is 8000 bytes long.

MSSQL v. 7.0
ntwdblib.dll v. 2000.80.194.0
PHP v. 4.3.2
Apache v. 2.0.43 / IIS 6

Reproduce code:
---------------
$myVar = str_repeat("*", 500);
mssql_query("DELETE FROM myTable");
mssql_query("INSERT INTO myTable (myField) VALUES ('".$myVar."')");
$query = "SELECT LEN(myField), myField FROM myTable";
list($realLength, $myVar) = mssql_fetch_row(mssql_query($query));
echo "DB length: ".$realLength."; PHP length: ".strlen($myVar);

Expected result:
----------------
$myVar must be equal $realLength

Actual result:
--------------
strlen($myVar) == 255 (always)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=25544&edit=1

Reply via email to