[std.database]
Steve Teale
steve.teale at britseyeview.com
Mon Oct 10 05:01:39 PDT 2011
>
> You can glean all needed information from the resultset after having
> issued the query.
>
>> It's probably true to say that the syntax/semantics of the interface
>> will suck slightly more in the Variant case than in the struct case.
>
> That's a given. The suckiness won't come, however, in the form of
> additional trips to the database.
>
>
> Andrei
Maybe in some cases. But at least with MySQL you have to bind before you
fetch, and you don't have the meta-data about the columns until after the
fetch, so you have to insert a call to mysql_stmt_result_metadata() to
set up the Variant types before you bind.
I also discovered after some time wasted this morning that the MySQL
struct used for date/time is too big for Variant. I had to define a
MyVariant taking that struct into consideration. Is Variant supposed to
throw if you initialize an instance with a struct that is bigger than
maxSize? It didn't - I just got mysterious segfaults when fetch tried to
store the result via a null buffer pointer.
Anyway, that's working now.
>From the comments we're getting, it looks like we need to head toward a
generic std.sql (or std.database) that provides basic functionality for
most databases. This would be implemented over more capable modules for
individual databases that covered the differentiating features as well as
what would be needed for the generic case. Kind of between your options 2
and 3.
Steve
More information about the Digitalmars-d
mailing list