Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Bug #9410 fread() truncates after execute()
Submitted: 2006-11-21 19:59 UTC
From: blair dot chesnut at duke dot edu Assigned: davidc
Status: Bogus Package: MDB2_Driver_mssql (version 2.3.0)
PHP Version: 5.1.2 OS: Linux
Roadmaps: (Not assigned)    

 [2006-11-21 19:59 UTC] blair dot chesnut at duke dot edu (Blair Chesnut)
Description: ------------ After executing $db->excute() with parameterized query, output from fread() is truncated to 8192 bytes. Works fine with no placeholder/parameter. MDB2 2.3.0 MDB2_Driver_mssql 1.1.0 Test script: --------------- <?php require_once "MDB2.php"; $fh = fopen('bigfile.txt', 'r'); $contents = fread($fh, filesize('bigfile.txt')); print "Contents = " . strlen($contents) . "\n"; $dsn = "mssql://user:passwd@server/db"; $dbh = MDB2::factory($dsn); $query = "select * from sysobjects where name like ?"; $sth = $dbh->prepare($query); $res = $sth->execute('A%'); $fh = fopen('bigfile.txt', 'r'); $contents = fread($fh, filesize('bigfile.txt')); print "Contents = " . strlen($contents) . "\n"; ?> Expected result: ---------------- Contents = 10000 Contents = 10000 Actual result: -------------- Contents = 10000 Contents = 8192


 [2006-12-25 19:16 UTC] lsmith (Lukas Smith)
Those two versions are probably just out of sync with each other. Please try MDB2 2.1.0 .. or update the mssql driver from CVS.
 [2007-01-03 14:38 UTC] davidc (David Coallier)
Blair, have you tried CVS ? If it's fixed, i'll make the release within the next few days. Thanks
 [2007-01-03 15:29 UTC] blair dot chesnut at duke dot edu
David, what exactly should I get from cvs? Would you post the cvs commands?
 [2007-01-03 21:34 UTC] davidc (David Coallier)
Try downloading the files from cvs there: the mssql.php and in all directories the mssql.php files and replace them with your include_path MDB2/Driver files. You should see the pattern pretty easily once you get the files. Let me know if you need more help getting the files and if by changing those, it fixed your problem. Thanks :-)
 [2007-01-16 03:24 UTC] davidc (David Coallier)
Actually Blair, you can try to just do pear upgrade MDB2_Driver_mssql-1.1.2 And then let me know if this version fixes your problems. Thanks, David
 [2007-01-19 15:24 UTC] blair dot chesnut at duke dot edu
Thanks, David. Installed MDB2_Driver_mssql-1.1.2, but still have the same problem. Perhaps it's FreeTDS. Is there a way to run a placeholder query using PHP's mssql functions?
 [2007-01-22 05:09 UTC] davidc (David Coallier)
Yep, just look at the MDB2 documentation for prepare and you should get a good idea. I will mark this bug as bogus as it seems to be something unrelated and I cannot reproduce. If you can make it work with custom placeholders, just let me know too please :) Thanks