ID:               17719
 Comment by:       titangem at hotmail dot com
 Reported By:      p-h-p-2 at g-u-s-t-l dot at
 Status:           No Feedback
 Bug Type:         ODBC related
 Operating System: W98,W2K,XP
 PHP Version:      4.2.2
 New Comment:

I believe that I am experiencing this same bug with PHP 4.3.0 on WinXP
Pro. I get garbage when retrieving some (it only seems to occur with
large records) ntext fields from a MSSQL Server 2K DB through ODBC. I'm
not using the MSSQL library because I need Unicode support which will
never be implemented (according to this:
http://www.phpbuilder.com/mail/php-windows/2003031/0193.php).

I need to convert the database to mySQL, which is not possible with all
the garbage I'm getting from some fields. I have to import hundreds of
thousands of records, and I need to be sure that the data hasn't been
damaged.

Do you have any further suggestions not mentioned in this thread?

Thanks,
Jozef


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

[2002-11-21 17:08:27] [EMAIL PROTECTED]

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-11-10 18:41:06] [EMAIL PROTECTED]

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-02 15:35:44] p-h-p-2 at g-u-s-t-l dot 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] [EMAIL PROTECTED]

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 at g-u-s-t-l dot 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

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

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

Reply via email to