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" <[EMAIL PROTECTED]> on 22.02.2001 10:14 PM
Please respond to [EMAIL PROTECTED]
To: WC Ip/ITSD/HKSARG@ITSD, [EMAIL PROTECTED]
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:[EMAIL PROTECTED]]
> Sent: Wednesday, February 21, 2001 11:22 PM
> To: [EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>







-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to