Topic: PDO MSSQL query result field limited to 255 chars (Read 614 times)
I crack Photoshop!
Posts: 3
22 credits Members referred : 0
« on: Sep 08, 2007, 12:04:17 PM »
Win XP Sp2 IIS MSSQL Server Express 2005 PHP 5.2.3
I am using PDO with the MSSQL database but I have a problem which I think must be a setting somewhere that I have missed. The FULL_DESC field in the database is a VARCHAR(5000) and appears fine when I query it throught the Server Management Studio Express. When I copy it from the table, it is the correct length (which is 3000 chars).
I want to query it and display it on my web page but it is being truncated at 255 chars.
Before I show the code I am using, I just want to say that I have tried setting mssql.textsize = 4096 & mssql.textlimit = 4096 in the php.ini file and restarting the IIS server but no difference.
I cannot help feeling a fool and feeling I have missed something obvious. Any ideas please?
obviously the connection to the db has been established before this code.
I crack Photoshop!
Posts: 3
22 credits Members referred : 0
« Reply #2 on: Sep 08, 2007, 02:19:58 PM »
I dont think it is a MSSQL problem because, as I said, the query analyser shows the full string in the database. I think it is more a PHP setting that I have forgotten or overlooked, or it might be a problem with the PDO code. However, if it is a problem with the PDO code then someone else must have found it by now.
Since PDO is an standard loadable extension to PHP. I thought someone on this PHP forum might be able to spot what I have missed.
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6439
39458 credits Members referred : 374
It's time to use PHP5!
« Reply #3 on: Sep 08, 2007, 02:30:16 PM »
I remember the last Zend conference that one of the speakers told us that PDO has some problems.
I crack Photoshop!
Posts: 3
22 credits Members referred : 0
« Reply #6 on: Sep 08, 2007, 03:00:50 PM »
I have tried that other code, and the same thing appears. Still truncated at 255 chars.
When I do a SELECT LEN(FULL_DESC) AS LNGTH.... and then echo $row['LNGTH'] it reports the correct length.
It is looking as if I will have to use the mssql statements but I was trying not to use anything too specific to MSSQL. However, the SQL statements are slightly different in some areas to mySQL so I would have to change them if I started to use mySQL anyway. It means going through all my programs and changing the code which I was hoping not to do. How does anyone else develop webapps that can use either mySQL or MSSQL - it must be full of 'if' statements!
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6439
39458 credits Members referred : 374
It's time to use PHP5!
« Reply #7 on: Sep 08, 2007, 03:57:38 PM »
there are several (better) database abstraction classes (check pear)
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 8249
42481 credits Members referred : 3
« Reply #8 on: Sep 08, 2007, 04:15:29 PM »
The different is mostly to the LIMIT statement. I think there is a db class that do the changes for you. I am not sure but the DB PEAR package has this ability.