Re: Returning an unknown number of types/values

From: André Pönitz (poenitz_at_gmx.net)
Date: 01/13/04


Date: Tue, 13 Jan 2004 09:09:57 +0000 (UTC)

Tony Burrows <tony@tonyburrows.com> wrote:
> Hi
> I'm trying to write a function which queries SQL tables. The function
> gets each row as an array of char*, whatever the actual types. I can also
> determine the actual types. What I need to do is convert each individual
> string into its proper type (easy) and then get the function to return
> each row, with the proper types rather than char*, also to return all the
> rows at once.
>
> I really don't know where to start. I thought of using a vector or list,
> which would work for the collection of rows, but how to handle each row?
> I don't know until runtime what the actual types will be, or how many
> values there will be. Almost certainly a row will have several data types.
>
> I did think of just a collection of pointers, but I don't see how to pick
> the right types out on return.
>
> Any suggestions would be very helpful.

Have a look at boost::any

Andre'



Relevant Pages

  • Returning an unknown number of types/values
    ... I'm trying to write a function which queries SQL tables. ... gets each row as an array of char*, ... string into its proper type and then get the function to return ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Pointer
    ... require in input a pointer char: ... unsafe public static extern int OpenFile; ... What is it pointing to exactly, is it pointing to a "Unicode character" array or is it pointing to a "Single byte character" array or is it pointing to something else? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Problem with va_ macros and arrays of arrays
    ... > the arrays passed to a ... > specific char, somewhat similar to what the standard function ... that with an array of struct, or possibly a pointer to a dynamic array ... > As I'm still a beginner in C without a copy of the standard I ...
    (comp.lang.c)
  • Re: Pointer
    ... require in input a pointer char: ... unsafe public static extern int OpenFile; ... What is it pointing to exactly, is it pointing to a "Unicode character" array or is it ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Returning pointer to array problem II
    ... Iam trying to make program were I enter string and serach char. ... and funktion prints out witch position char is found this is done if funktion serach_char. ... so far all good what I want do next is: return, from funktion, pointer value to array were positions is stored. ...
    (comp.lang.c)