RE: [PHP-DB] Can PHP read View in stead of Table?
| From: | Andrew Hill | Date: | Thu, 22 Feb 2001 14:14:48 +0000 |
| Subject: | RE: [PHP-DB] Can PHP read View in stead of Table? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-6863@lists.php.net to get a copy of this message | ||
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
>
>