[odb-users] String Query

Tarik BENZ tenchu.tarik at hotmail.fr
Wed Jun 12 10:15:35 EDT 2013


1. I have a period type (1 = day, 2 = week, 3 = month)
2. I have a period number ( 1, 2 , 3 ...)
-> If my period type is 2 and my period number is 3, I will have a period of 3 weeks (2 * 3)

3. I have a reference date (January 1st 2013)

What I want to do is :
 The user will select a period ( ex : beginning = Mars 5th 2013, end =  April 13th 2013).
I want to know if with the period type, period number and the reference date, we will be in this selected period.

Tarik

> Date: Wed, 12 Jun 2013 16:07:54 +0200
> From: boris at codesynthesis.com
> To: tenchu.tarik at hotmail.fr
> CC: odb-users at codesynthesis.com
> Subject: Re: [odb-users] String Query
> 
> 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