[Gambas-devel] More Database Driver Changes
Benoit Minisini
gambas at ...1...
Sat May 22 10:56:51 CEST 2004
On Wednesday 19 May 2004 13:08, Nigel Gerrard wrote:
> Benoit,
>
> > Sorry, but I really don't understand what you did about this "multitable
> > fields" thing and it is really necessary.
> >
> > I thought that the old db component was already able to access these
>
> fields by
>
> > using rData["Table.Field"].
> >
> > What's the point exactly ?
>
> Does this work in the current driver ( I have upgraded my postgresql to
> 7.4.1 and there are
> some changes that are needed to the driver to make things work...see my
> changelog...so I
> can no longer test the standard implementation)
> ...
Hi, Nigel!
I finally understood the problem :-)
Let's suppose we have a table named "Table" with two fields "id" and "name".
If we make the following request: "SELECT * FROM Table AS a, Table AS b", we
get a result object with 4 fields named "id", "name", and yet "id" and
"name". We do not have the needed unicity of names. This is the problem you
pointed.
If your solution works, I find it a bit non-optimized. For example, you must
not do heavy things in field_index(), like getting the postgresql version, of
checking if we have many different tables in mysql.
And if you do "SELECT * FROM Table AS a, Table AS b", what the different
database libraries tells you: that all fields come from the table "Table", or
that some comes from "a" and others from "b". I hope the second case occurs,
otherwise...
Could you try to optimize what I talked about ? It would be cool :-) If this
needs slightly modifying the driver interface, tell me. It should not be a
problem.
You added a optional Type parameter to Table.Create and used an hack for that.
Modifying the driver interface is needed there. And did you add a equivalent
property to get the table type too ?
I find Table$Field == Table.Field really being unnecessary. As rData!FieldName
and rData["FieldName"] compile to exactly the same code, the user could
always use rData["Table.Field"] if needed. And the '$' character inside an
indentifier may become forbidden in the future!
You included "../CResult.h" in all drivers. This is a bad idea. We must modify
the driver interface if you need something from CResult.h. Please explain me
exactly what you need!
I hope you are not overcame with my remarks :-)
After all previous things corrected, I think we could start thinking about a
better db component interface. And I you have really a lot of time, talking
about an ODBC driver :-)
Regards,
--
Benoit Minisini
mailto:gambas at ...1...
More information about the Devel
mailing list