At 2:24 PM +0100 12/2/04, Maximilian Tyrtania wrote:
I think there is a problem with rs.field in the following scenario:
SQL="Select T1.SomeField,T2.SomeField from T1,T2"
Rs=db.select(SQL)
Now both rs.field("T1.SomeField") and rs.field("T2.SomeField") are nil
whereas rs.field("SomeField") is not. We currently have to resort to using
rs.idxfield (which is faster anyway). Still, I'd like to see table names be
honored by rs.field.
RS.Field uses the column name of the returned result. The column
names are up to the database engine unless you specify them using the
AS clause. All database engines I know of will use the source field
name as the column name, at least in unambiguous cases. In a case
like this, it's ambiguous, and your guess about what the resulting
column name should be apparently doesn't match that of the database
designers.
But no need to rely on such guesses; just specify the column names
you want, e.g. SELECT T1.SomeField AS Foo, T2.SomeField AS Bar from
T1,T2
Now you should be able to access rs.Field("Foo") and rs.Field("Bar") just fine.
Best,
- Joe
--
REAL World 2005 - The REALbasic User Conference
March 23-25, 2005, Austin, Texas
<http://www.realsoftware.com/realworld>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|