Hi,

Yes, I have a array of strings in my field. If tntdb cannot do that, 
I'll use array_to_string (in my query) for join all values with a comma 
separator. After, I'll use boost::algorithm::split to fill a vector.

Jean-Marc.

Le 23/02/2015 18:23, Tommi Mäkitalo a écrit :
> Am 23.02.2015 um 15:26 schrieb Julian Wiesener:
>> Hi,
>>
>>> I have a column in a table (postgresql) which has type character
>>> varying[]. Is it possible to read this column type with tntndb.
>> the tntdb Interface for character varying[] is getString() you just need
>> to know at which position in the results the desired String is, the
>> equalent to your perl code is more or less:
>>
>> tntdb::Statement q = conn.prepare("SELECT foo, teams, bar FROM baz");
>> // add bindings for where clause here
>> tntdb::Result res q.select()
>> for(tntdb::Result::const_iterator it = res.begin()
>>           it != res.end(); ++it)
>>           if(!it[1].isNull())
>>                   WHATEVR( it[1].getString() );
>>
>> It's [1] because "teams" is the second SELECT parameter.
>>
>>
>>
>> Kind Regards,
>> Julian
> Hi,
>
> As far as I understand the problem is a little different. You have
> really a array of strings in one single field? That is not really
> supported by tntdb since it is not standard SQL. I don't know if any
> other database support such a feature.
>
> I prefer not to use getString nor tntdb::Result. I suggest to do
> something like:
>
> tntdb::Statement q = conn.prepare("SELECT foo, teams, bar FROM baz");
> // add bindings for where clause here
> std::string teams;
> for(tntdb::Statement::const_iterator it = q.begin(); it != q.end(); ++it)
> {
>     if (it->get(teams))
>       WHATEVR(teams);
> }
>
> The iterator over tntdb::Statement do not read the whole result into
> memory. It will use a cursor.
>
> The get method is just a matter of taste. I prefer to use the get
> method, so I do not need to remember whether to use getInt or getInteger
> or getLong or whatever for numbers but just define my variable as needed.
>
>
> Tommi
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
> _______________________________________________
> Tntnet-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tntnet-general


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to