Thanks, this is nice with got_data()

Phil


Am 28.12.2012 um 12:45 schrieb Sebastian Lauwers:

> Hi Philipp,
> 
> This is the code I use, maybe it will help:
> 
> try {
>    soci::indicator ind;
>    this->sql << "select `id` from `" << this->table_prefix << table << "` "
>        "where name = :name limit 1;", soci::into(id, ind),
>        soci::use(name);
> 
>    if (not sql.got_data() || ind != soci::i_ok) {
>        // not found
>    }
> }
> 
> catch (//exception handling
> 
> this->sql is a soci::session.
> 
> -S.
> 
> On 28 December 2012 12:43, Philipp Kraus <[email protected]> wrote:
>> Hello,
>> 
>> I'm using something like:
>> soci::statement l_stm = (l_sess.prepare << "select id, name from table", 
>> soci::use(l_id), soci::use(l_name));
>> 
>> The result of the select can be only one record, so I need only the 
>> information if a result record exists eg
>> if (!l_stm.result_exists)
>>    throw exception("record not exists");
>> 
>> How can I do this?
>> 
>> Thanks
>> 
>> Phil
>> 
>> 
>> ------------------------------------------------------------------------------
>> Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
>> much more. Get web development skills now with LearnDevNow -
>> 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
>> SALE $99.99 this month only -- learn more at:
>> http://p.sf.net/sfu/learnmore_122812
>> _______________________________________________
>> soci-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/soci-users
> 
> ------------------------------------------------------------------------------
> Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
> much more. Get web development skills now with LearnDevNow -
> 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122812
> _______________________________________________
> soci-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/soci-users


------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to