>
> Is it possible to write something like this:
> soci::session session( connectionString );
> std::string name;
> while ( session << "select name from table", soci::into( name ))
> std::cout << name << std::endl;
>
> The only way I know of how to iterate over all rows of a result is to
> either use soci::rowset or use soci::into with vectors. I'd like to keep
> calling fetch() or something like that and use soci::into instead. Is
> this possible somehow?
>
>
> ------------------------------------------------------------------------------
>
> You can use prepared statements, and the execute() (once) and fetch()
(iterative) methods:
----------------------------------------
soci::session session (connectionString);
std::list<std::string> nameList;
// Temporary variable (to store the current row)
std::string currentName;
// Preparation of the SQL request
soci::statement selectStatement =
(ioSociSession.prepare << "select name from table", soci::into
(currentName));
// Execute once
selectStatement.execute();
// Iterate as long as there is data
while (selectStatement.fetch()) {
nameList.push_back (currentName);
}
// Use the list of retrieved data
// [...]
----------------------------------------
But I may have missed something?
Best Regards
Denis
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users