List:MySQL ODBC« Previous MessageNext Message »
From:Michael Widenius Date:June 6 1999 10:21pm
Subject:Re: unixODBC - SQL_BEST_ROWID
View as plain text  
>>>>> "Peter" == Peter Harvey <pharvey@stripped> writes:

>> I have checked the source code of SQLSpecialColumns but couldn't find
>> anything wrong;  I will try to later today test it troughly.

Peter> Ok. I have a two column table with no primary key or indexs.
> SQLSpecialColumns()
Peter> returns both columns to me when I ask for SQL_BEST_ROWID. My thinking is that
> it
Peter> should return an empty result set because there is no way to uniquely id a row?
Peter> The spec says that the result columns can be used to id no rows or exactly one
Peter> row.

Peter> Peter Harvey

Yes;  In the case of no primary keys, MyODBC returns all columns.

I have played with the idea of allowing one to use the following
syntax to update the table in this case:

UPDATE TABLE foo set col1='new value' where col1='constant' and
col2='constant' .. LIMIT 1

This will VERY nicely solve the problems of updating any row, even if
you don't have a primary key!

(DELETE already allows the use of LIMIT).

I just checked the ODBC documentation and it seams that you are right; 
In the case of no keys MyODBC should return an empty set (even if the
above solution would be quite nice !).

unixODBC - SQL_BEST_ROWIDPeter Harvey6 Jun
  • unixODBC - SQL_BEST_ROWIDMichael Widenius6 Jun
  • Re: unixODBC - SQL_BEST_ROWIDPeter Harvey7 Jun
    • Re: unixODBC - SQL_BEST_ROWIDMichael Widenius7 Jun