[odb-users] Retrieve data from function with native view
Tarik BENZ
tenchu.tarik at hotmail.fr
Fri Jun 14 07:20:00 EDT 2013
I Solved my problem!
Thank you
Tarik
> From: tenchu.tarik at hotmail.fr
> To: odb-users at codesynthesis.com
> Date: Fri, 14 Jun 2013 12:59:10 +0200
> Subject: [odb-users] Retrieve data from function with native view
>
> Hello
>
> I have a sql server function that returns this :
>
> RETURNS @eligibleElementsTable TABLE
> ([participantCode] varchar(20),
> [lastName] varchar(512),
> [firstName] varchar(512),
> [subAccountCode] varchar(20),
> [participantTypeCode] varchar(20),
> [periodTypeCode] varchar(20),
> [value] float,
> [radiationTypeCode] varchar(20),
> [radiationTypeDescription] varchar(512),
> [componentTypeCode] varchar(20),
> [componentTypeDescription] varchar(512),
> [delayMax] int,
> [reset] int,
> [periodPreparationTime] int,
> [accountCode] varchar(20),
> [serviceCode] varchar(20))
>
> And to call this function I have a native view :
>
> #pragma db view query("select * from GetElements(?)")
> struct Preparation_View
> {
> #pragma db type ("VARCHAR(20)")
> std::string participantCode;
> odb::nullable<std::string> lastName;
> odb::nullable<std::string> firstName;
> #pragma db type ("VARCHAR(20)")
> std::string subAccountCode;
> #pragma db type ("VARCHAR(20)")
> std::string participantTypeCode;
> #pragma db type ("VARCHAR(20)")
> std::string periodTypeCode;
> float value;
> #pragma db type ("VARCHAR(20)")
> std::string radiationTypeCode;
> std::string radiationTypeDescription;
> #pragma db type ("VARCHAR(20)")
> std::string componentTypeCode;
> std::string componentTypeDescription;
> odb::nullable<int> delayMax;
> int reset;
> odb::nullable<int> periodPreparationTime;
> #pragma db type ("VARCHAR(20)")
> std::string accountCode;
> #pragma db type ("VARCHAR(20)")
> std::string serviceCode;
> };
>
> My problem is that it doesn't work because the query
> returns null when it should return something.
> Someone has an idea on what I am doing wrong?
>
> Tarik
>
More information about the odb-users
mailing list