Bug #52658 [Opn]: odbc_fetch_row doesn't fetch memo field
| From: | rasmus@php.net | Date: | Wed, 15 Feb 2012 17:55:44 +0000 |
| Subject: | Bug #52658 [Opn]: odbc_fetch_row doesn't fetch memo field | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-167546@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=52658&edit=1
ID: 52658
Updated by: rasmus@php.net
Reported by: cyoung at gcs dot neric dot org
Summary: odbc_fetch_row doesn't fetch memo field
Status: Open
Type: Bug
Package: ODBC related
Operating System: Windows Sever 2008
PHP Version: 5.3.3
Block user comment: N
Private report: N
New Comment:
Right, so in your case you probably should stick to stuff from proprietary
software vendors. Our goal has never been to dislodge anybody. Our goal is to
build a tool that works for us. If you want to use it as well, go for it, if not,
no problem.
Previous Comments:
------------------------------------------------------------------------
[2012-02-15 17:42:33] phil at mair dot com
"You need to understand that Open Source isn't simply a new vendor that replaces
your old proprietary software vendor. Open Source is a collaborative effort of
interested parties"
... I think you hit the nail on the head.
"Open Source .. a collaborative effort of interested parties" = group of
enthusiasts who meander through developments doing whatever interests them.
"proprietary software vendor" = a commercial organisation focused on delivering
a stable, viable product.
I'm not being funny, but for years we have WANTED to encourage our clients to
move to open source, but unfortunately we can't because its 'random'. From
time-to-time an organisation has taken the plunge, and us 3rd party suppliers
catch the cold.
And you are right ... "Sitting on the sidelines yelling aimlessly has absolutely
no effect in this scenario" ... but I'm not in the business of writing
platforms, I never claimed to be, and I don't aspire to it. What I do want to
do is write solutions based on solid foundations. Open Source is still failing
to deliver 20 years after it's initial promise cos "enthusiasm" alone won't
bring it home.
I don't want to sound negative, and I do understand the huge effort and
commitment undertaken ... but I call it as I see it.
------------------------------------------------------------------------
[2012-02-15 17:01:02] rasmus@php.net
If MS was actually dominant this bug would have been fixed. Only half-serious
with that statement. ODBC gets very little use and thus very little attention. It
is a fringe extension. A minor bug in a fringe extension can go unfixed for a
very long time unless someone comes along and contributes a clean patch for it.
You need to understand that Open Source isn't simply a new vendor that replaces
your old proprietary software vendor. Open Source is a collaborative effort of
interested parties. Sitting on the sidelines yelling aimlessly has absolutely no
effect in this scenario.
------------------------------------------------------------------------
[2012-02-15 10:34:51] phil at mair dot com
This is unbelievable - Open Source is trying to dislodge MS from it's dominant
role. You can't seriously expect to succeed in this objective if a MAJOR BUG ...
and this is major to anyone trying to develop and support cross-platform
applications ... like this is still "Status Open" and relying on patches 18 months
after it was first flagged !!
Get real people !
------------------------------------------------------------------------
[2010-08-22 19:47:34] cyoung at gcs dot neric dot org
I was able to find a way to fix this "problem" I was having when using odbc_fetch_row with
memo fields. When I connected to the database I used the optional cursor_type parameter.
$cnx = odbc_connect('$databaseName', 'user', 'pass',
SQL_CUR_USE_ODBC);
This seemed to allow odbc_fetch_row to retrieve the memo field successfully. I was getting the
error below before inserting the cursor type into odbc_connect.
PHP Warning: odbc_result() [<a
href='function.odbc-result'>function.odbc-result</a>]: SQL error:
[Microsoft][ODBC Microsoft Access Driver]Invalid cursor position; no keyset defined , SQL state
S1109 in SQLGetData
------------------------------------------------------------------------
[2010-08-20 17:38:42] cyoung at gcs dot neric dot org
Description:
------------
odbc_fetch_row doesn't retrieve a memo field from MS access db. It does however retrieve all
the other fields in the same row successfully. Without the use of odbc_fetch_row, odbc_result
retrieves the memo field exactly as expected. This obviously poses a problem only when trying to
retrieve more than one row in a database, which is usually the case more than not.
Test script:
---------------
while(odbc_fetch_row($result)) {
$newsID = odbc_result($result, "newsID");
$newsTitle = odbc_result($result, "newsTitle");
$titleLink = odbc_result($result, "titleLink");
$brief = trim(odbc_result($result, "brief"));
$link = $titleLink.$newsID;
$newsBrief = substr($brief, 0, 75);
echo "<div id=\"newsLink\" class=\"newsTitle\"><a
href=\"$link\" onclick=\"window.open('$link', 'GCSNews',
'width=500, height=400, menubar=no, toolbar=no, resizable=no, top=100, left=200'); return
false;\">$newsTitle</a></div>";
echo "<div class=\"newsBrief\">$newsBrief...</div>";
}
Expected result:
----------------
I expected the memo field "brief" to be fetched, trimmed, and then a substring of the
first 75 characters to be stored in $newBrief and print out followed by ...
Actual result:
--------------
...
when trouble shooting, just echoing $brief showed nothing in the browser. $brief is an empty string
when used in conjunction with odbc_fetch_row.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=52658&edit=1