RE: [PHP-DB] Can PHP read View in stead of Table?
| From: | WC Ip | Date: | Sat, 24 Feb 2001 03:48:49 +0000 |
| Subject: | RE: [PHP-DB] Can PHP read View in stead of Table? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-6920@lists.php.net to get a copy of this message | ||
Dear Andrew,
I have followed your instruction to comment out the #define statement.
PHP/Apache can recompile smoothly but PHP still need key to search the table so
that I cannot access View. Moreover, I found that when I propose SQL statement
using "group by", error printed : "SQL error: [OpenLink][ODBC][Driver]Syntax
error or access, SQL state 37000 in SQLExecDirect". It seems that PHP_ODBC
function does not support "group by" statement. Do you have any suggestions?
Thanks for your help!
Peter
From: "Andrew Hill" <ahill@openlinksw.com> on 22.02.2001 10:14 PM
Please respond to ahill@openlinksw.com
To: WC Ip/ITSD/HKSARG@ITSD, php-db@lists.php.net
cc:
Subject: RE: [PHP-DB] Can PHP read View in stead of Table?
Peter.
It is not a bug in OpenLink's driver but in PHP - odbc_connect is setting a
cursor by default when you connect.
This is usually fine, but a cursor needs a primary key. If no primary key
exists, there will be a problem.
This of course will always be a problem with views, as running a cursor
against a view makes very little sense.
There is a workaround to prevent odbc_connect from automatically selecting a
cursor type when connecting - edit php_odbc.h and comment out:
#define HAVE_SQL_EXTENDED_FETCH 1
and recompile your php/apache setup.
Hope this helps!
Best regards,
Andrew
--------------------------------------
Andrew Hill - OpenLink Software
Director Technology Evangelism
eBusiness Infrastructure Technology
http://www.openlinksw.com
> -----Original Message-----
> From: WC Ip [mailto:pwcip@itsd.gov.hk]
> Sent: Wednesday, February 21, 2001 11:22 PM
> To: php-db@lists.php.net
> Subject: [PHP-DB] Can PHP read View in stead of Table?
>
>
>
>
> Dear all,
>
> I have install PHP on Linux and use Openlink ODBC Driver to link to MS SQL
> server on Windows NT. Just now I can read data from Table on SQL server.
> However, when I make View on the same database, I can't use PHP
> to extract data
> from this View. When I do query on the View, error message shown:
>
> Warning: SQL error: [OpenLink][ODBC][Driver]No key columns found for table
> referenced
> by keyset driven cursor., SQL state IM909 in SQLExecDirect in
> /usr/local/apache_1.3.12/htdocs/internet.php on line 42
>
> The possible problem may due to primary key of table. As testing,
> I found the
> table
> with primary i can access easily. However, when i remove primary
> key from the
> same
> table, error has shown and cannot show data.
>
> May I solve this problem or this is the bugs of openlink ODBC driver?
>
> Thanks for your help!!!
>
> Peter
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>