#17719 [NoF->Opn]: Code Garbage in Longtext results
| From: | p-h-p-2 at g-u-s-t-l dot at | Date: | Wed, 02 Oct 2002 02:29:33 +0000 |
| Subject: | #17719 [NoF->Opn]: Code Garbage in Longtext results | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-21202@lists.php.net to get a copy of this message | ||
ID: 17719
User updated by: p-h-p-2@g-u-s-t-l.at
-Reported By: php@remove.gustl.net
+Reported By: p-h-p-2@g-u-s-t-l.at
-Status: No Feedback
+Status: Open
Bug Type: ODBC related
-Operating System: W98,W2K
+Operating System: W98,W2K,XP
-PHP Version: 4.2.1
+PHP Version: 4.2.2
New Comment:
Sorry about late nite feedback,
but I found something new in PHP V4.2.2:
when you set odbc_longreadlen (0, $max) - with no resource id - it
works fine, when you set it after the query with resulting resource id
- odbc_longreadlen ($res, $max) - it failes and returns 4096 bytes less
(what in my opinion is the default readlen from php.ini). see provided
example:
<?PHP
echo "big db test<br>";
$DB = '';
$DBAppUser = '';
$DBAppPass = '';
$max = 5000;
$db = odbc_connect ($DB, $DBAppUser, $DBAppPass) or die ("no
connect");
## create db
$res = odbc_exec ($db, "SET TEXTSIZE ".($max * 2));
$res = odbc_exec ($db, "DROP TABLE Test");
$res = odbc_exec (
$db,
"CREATE TABLE test (
TEST_ID int NOT NULL IDENTITY PRIMARY KEY,
TEST_TEXT ntext NULL
)");
## fill text
$text = "";
for ($i = 0; strlen ($text) <= $max; $i++)
$text .= "$i\n";
$text = substr ($text, 0, $max);
echo strlen ($text)." chars written, last $i<br>";
$res = odbc_exec ($db, "INSERT INTO Test (TEST_TEXT) VALUES
('$text')");
## read and set odbc_readlen with query result
$res = odbc_exec ($db, "SELECT TEST_TEXT FROM Test WHERE TEST_ID =
1");
# odbc_binmode ($res, 0);
odbc_longreadlen ($res, $max);
$text = odbc_result ($res, "TEST_TEXT");
echo strlen ($text)." chars received (", strlen ($text) + 4096 , "
when 4096 added)<br>";
echo $text, "<br>";
## read and set odbc_readlen with without result
# odbc_binmode (0, 0);
odbc_longreadlen (0, $max);
$res = odbc_exec ($db, "SELECT TEST_TEXT, TEST_ID FROM Test WHERE
TEST_ID = 1");
$text = odbc_result ($res, "TEST_TEXT");
echo strlen ($text)." chars received (", strlen ($text) + $max , "
when $max added)<br>";
echo $text, "<br>";
echo "done";
?>
hope this gives you a clue
gustav graf
remove -'s from email to reply directly
Previous Comments:
------------------------------------------------------------------------
[2002-09-21 01:52:36] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
------------------------------------------------------------------------
[2002-08-16 09:54:44] kalowsky@php.net
First of type NTEXT is not a valid ODBC v2 type. It is valid in later
versions of ODBC but we don't support them yet. I'm waiting for some
manuals to show before I finish my work on it.
Second one thing to try that a few people have reported success with it
running a sql query with this information in it: "SET TEXTSIZE <some
really large number here>" See if that works for you.
Also there have been a few bug fixes in the latest CVS. Feel free to
try it as well, although I didn't touch any of the longreadlen code.
------------------------------------------------------------------------
[2002-08-16 07:10:11] php@remove.gustl.net
what kind of feedback do you need?
------------------------------------------------------------------------
[2002-08-13 19:55:45] kalowsky@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
------------------------------------------------------------------------
[2002-06-24 18:54:15] paul@distributed.net
4.1.2 seems to provide the correct output from the page.
current cvs version seems to corrupt output.
dank, i could probably give you remote access or get a debugger loaded
on it tomorrow.
Paul
------------------------------------------------------------------------
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/17719
--
Edit this bug report at http://bugs.php.net/?id=17719&edit=1