From:             costas at meezon dot com
Operating system: Windows XP Prof
PHP version:      5.1.4
PHP Bug Type:     PDO related
Bug description:  Fails to get values of fields following a MEMO type field in 
MS Access

Description:
------------
I have an MS Access database and use PDO/ODBC. There are 2 MEMO type
columns (notes and notes2) in one table 'tblNotes'. 

tblNotes structure
-------------------
LastName - text,
notes - memo,
addr - text,
notes2 - memo
zip - text 

I added 2 rows and manually populated all the columns with data. The notes
and notes2 have just a couple of characters each.

Problem:
---------
When I use 'SELECT * from tblNotes' all rows are retrieved, but the values
for all non-MEMO type columns (which follow MEMO columns) are null.  This
means addr and zip are NULL but LastName is correct.

If I explicitly name the columns in the SELECT I get the same result (E.g.
SELECT LastName, notes, addr, notes2, zip from tblNotes order by LastName).
This means addr and zip are NULL but LastName is correct.

Workaround:
------------
If I move the notes and notes2 columns to the end, then all the values are
retrieved (E.g. SELECT LastName, addr, zip, notes, notes2 from tblNotes
order by LastName)

This is OK if you have just a few columns. Otherwise you have to type them
all in. 

I am not sure if this is a PDO problem or ODBC.

Reproduce code:
---------------
<?php
$tbl='tblNotes';

$user='';
$pass='';
$conn = "DSN=mailing;Driver=Microsoft Access Driver";
try {
    $dbh = new PDO("odbc:$conn", $user, $pass);
    $cursor=$dbh->query("SELECT * from $tbl order by LastName");
    foreach ($cursor as $row) {
        $row=array_change_key_case($row, CASE_UPPER);
        echo $row['LASTNAME'] . '|';
        echo $row['NOTES'] . '|';
        echo $row['ADDR'] . '|';
        echo $row['NOTES2'] . '|';
        echo $row['ZIP'] . '|';
        echo "\n";
    }
    echo "\n";

    $cursor1=$dbh->query("SELECT LastName, notes, addr, notes2, zip from
$tbl order by LastName");
    foreach ($cursor1 as $row) {
        $row=array_change_key_case($row, CASE_UPPER);
        echo $row['LASTNAME'] . '|';
        echo $row['NOTES'] . '|';
        echo $row['ADDR'] . '|';
        echo $row['NOTES2'] . '|';
        echo $row['ZIP'] . '|';
        echo "\n";
    }
    echo "\n";
    
    $cursor2=$dbh->query("SELECT LastName, addr, zip, notes, notes2 from
$tbl order by LastName");
    foreach ($cursor2 as $row) {
        $row=array_change_key_case($row, CASE_UPPER);
        echo $row['LASTNAME'] . '|';
        echo $row['NOTES'] . '|';
        echo $row['ADDR'] . '|';
        echo $row['NOTES2'] . '|';
        echo $row['ZIP'] . '|';
        echo "\n";
    }

} catch (PDOException $e) {

echo $e->getMessage();

}
$dbh = null;
?>

Expected result:
----------------
For $cursor -- wrong result
doe|mm||nn||
smith|xx||yy||

For $cursor1 -- wrong result
doe|mm||nn||
smith|xx||yy||

For $cursor2  --- Correct result
doe|mm|120 main street|nn|10006|
smith|xx|320 bway|yy|10007|

Actual result:
--------------
See expected results above.

-- 
Edit bug report at http://bugs.php.net/?id=38458&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38458&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38458&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38458&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38458&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=38458&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38458&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38458&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38458&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38458&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38458&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=38458&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=38458&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38458&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38458&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38458&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38458&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38458&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38458&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38458&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38458&r=mysqlcfg

Reply via email to