#17719 [Opn->Fbk]: Code Garbage in Longtext results
| From: | sniper@php.net | Date: | Wed, 02 Oct 2002 11:13:30 +0000 |
| Subject: | #17719 [Opn->Fbk]: Code Garbage in Longtext results | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-21241@lists.php.net to get a copy of this message | ||
ID: 17719
Updated by: sniper@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-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.
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
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