Lists of lists over COM, how?
Alex Martelli
Alex.Martelli at think3.com
Tue Dec 14 07:28:39 EST 1999
Martin writes:
> I'd like to return a set of database records to Python in a single
> variable
> from a COM object in C++ and had hoped I could use a two-dimensional
> VARIANT
> array for this. Looking through the SafeArray* functions in the WIN API
> they
> only allow arrays of a single basic type. I had hoped that a list of lists
>
Yep, but the basic type can be VARIANT -- and, inside a VARIANT,
among other things, you can stuff other (so-called SAFE-:-)ARRAYs,
so you can do complicated stuff if you wish:-). But, in fact...:
> with mixed data types would correspond to some variant array (since there
> are both numbers and strings in these records). Anyone knows?
>
A VARIANT can easily hold either a string (BSTR) or number (any of
several types thereof), so a SAFEARRAY of VARIANT is fine to hold
such heterogeneous info as a database record.
Alex
More information about the Python-list
mailing list