php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21042 Fails to return MS Access MEMO fields
Submitted: 2002-12-16 06:10 UTC Modified: 2002-12-18 13:52 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: vinerd at norwich-union dot com Assigned:
Status: Not a bug Package: ODBC related
PHP Version: 4.3.0RC3 OS: Windows NT 4.0
Private report: No CVE-ID: None
 [2002-12-16 06:10 UTC] vinerd at norwich-union dot com
Trying to read MS Access MEMO fields (these are large (>255 chrs) text fields) fails under 4.3.0RC3 in an Eval'd string whereas they work fine under 4.2.3.

The error message returned is:

Warning: SQL error: [Microsoft][ODBC Microsoft Access 97 Driver]Invalid cursor position; no keyset defined , SQL state S1109 in SQLGetData in c:\InetPub\php\classes\member.php(91) : eval()'d code on line 1

Below is an example of code that causes the problem. The $xFields var is a CSV list of fields in a table. If only the details field is a MEMO type then only this will fail. All other types of field (string or numeric) do not appear to have a problem. The error line will point to the line containing the 'eval' function call.

################CODE##################

$xFields = "ref,name,details";

function coreLoad ($cur)
{
  global $xFields;

  $flds = explode (",", $xFields);

  for ($i = 0; $i < sizeof ($flds); $i++)
  {
    $str = '$this->' . $flds [$i] . ' = odbc_result ($cur, ' . ($i + 1) . ');';

    eval ($str);
  }
}

################END OF CODE##############

The connection to the MS Access database is through a standard ODBC connection via the Windows Control Panel. No other modules have been compiled into PHP either in 4.2.3 or 4.3.0RC3.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-18 13:52 UTC] kalowsky@php.net
please read the options on using odbc_connect() and setting cursors for more information on how to work around this.

Technically a MEMO field is not a valid field for ODBC v2, and as such is not supported by PHP.  The truth is you can hack around it using the cursor settings in the odbc_connect.  Good luck.

Not a bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 11:01:31 2024 UTC