[odb-users] Extended types SQL Server (table and/or xml type)
Boris Kolpackov
boris at codesynthesis.com
Mon Apr 27 13:24:13 EDT 2015
Hi Fredrik,
Fredrik Strand <fredrik.strand at qliro.com> writes:
> However, I can't really see how it will be used when using stored
> procedures. At the moment I'm calling a stored procedure as stated
> in the documentation under 21.7 SQL Server Stored Procedures:
>
> #pragma db view query("EXEC....")
> object
>
> Db.query<object>(query:_val(value))....
>
>
> In this case I'm just using a std::string as value and it automagically
> maps to an nvarchar in the procedure. Since I can't specify the actual
> type in the call how do I specify that it's an XML argument that I want
> to send/use?
For this to work automagically, as you put it, you will need to
represent XML as a separate C++ type (it can be as simple as
a struct containing a string). You will then need to provide
the conversion expression as is done for point and variant
types in the 'mssql/custom' test. Note that you will also
need to provide the value_traits specialization. It can be
a simple implementation that forwards to the std::string's
one.
Boris
More information about the odb-users
mailing list