[std.database]
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Oct 10 08:09:34 PDT 2011
On 10/10/11 7:01 AM, Steve Teale wrote:
>>
>> 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'm confused. Isn't binding setting values to parameters prior to
executing a query? That's a different thing from getting the row of a
resultset.
So, you first prepare, bind, and execute a query. Then you call
mysql_stmt_result_metadata() to get the number of columns in the
resultset and their individual types. At that point you get to allocate
the Variant[] row appropriately. After that you're ready to iterate rows.
> I also discovered after some time wasted this morning that the MySQL
> struct used for date/time is too big for Variant.
That's a bug in std.variant. Large structs should be supported
automatically by using an indirection and dynamic allocation.
Andrei
More information about the Digitalmars-d
mailing list