[odb-users] String Query
Boris Kolpackov
boris at codesynthesis.com
Wed Jun 12 10:07:54 EDT 2013
Hi Tarik,
Tarik BENZ <tenchu.tarik at hotmail.fr> writes:
> I thing the best way to do what I want is to create a SQL Procedure.
Again, without knowing *what* you are trying to achieve it is hard
for me to say whether it is the best way. But my guess would probably
be that it is not.
> Is it possible to call a procedure with ODB?
Yes, you can use native views (Section 9.5 in the manual) to call stored
procedures. Something along these lines (SQL Server example):
// Assume my_stored_proc accepts two parameters (string and number) and
// its result set contains two columns (string and number).
//
#pragma db view query("EXEC my_stored_proc (?)")
struct my_stored_proc
{
std::string str;
unsigned long num;
};
typedef odb::query<my_stored_proc> query;
db.query<my_stored_proc> (query::_val ("abc") + "," + query::_val (123));
Boris
More information about the odb-users
mailing list