#17719 [Opn->Fbk]: Code Garbage in Longtext results
| From: | iliaa@php.net | Date: | Mon, 11 Nov 2002 00:41:06 +0000 |
| Subject: | #17719 [Opn->Fbk]: Code Garbage in Longtext results | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-24504@lists.php.net to get a copy of this message | ||
ID: 17719
Updated by: iliaa@php.net
Reported By: p-h-p-2@g-u-s-t-l.at
-Status: Open
+Status: Feedback
Bug Type: ODBC related
Operating System: W98,W2K,XP
PHP Version: 4.2.2
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2002-10-02 15:35:44] p-h-p-2@g-u-s-t-l.at
same with win32-latest,
maybe odbc returns a strange odbc-type, so this is handled as a
non-long type and binded to the result in odbc_exec and then not read
completely afterwards in odbc_result () with some kind of
missinterpresting and missallocating some memory? This would explain
the different results when calling odbc_longreadlen () without or with
the query result.
------------------------------------------------------------------------
[2002-10-02 06:13:30] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-latest.zip
------------------------------------------------------------------------
[2002-10-01 21:29:33] p-h-p-2@g-u-s-t-l.at
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
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
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