[odb-users] Storing Images in SQL Server 2008
Tarik BENZ
tenchu.tarik at hotmail.fr
Tue Jul 2 07:07:26 EDT 2013
Hi Boris,
Thank you it works!
> Date: Tue, 2 Jul 2013 09:38:33 +0200
> From: boris at codesynthesis.com
> To: tenchu.tarik at hotmail.fr
> CC: odb-users at codesynthesis.com
> Subject: Re: [odb-users] Storing Images in SQL Server 2008
>
> Hi Tarik,
>
> Tarik BENZ <tenchu.tarik at hotmail.fr> writes:
>
> > void setPicture(const std::vector<unsigned char> picture)
> > {
> > this->picture = picture;
> > }
> >
> > #pragma db type("IMAGE")
> > #pragma db get(getPicture) set(setPicture)
> > std::vector<unsigned char> picture;
> >
> > BUT I have a compilation error :
> >
> > 1> Participant.hxx:234:13: error: accessor returning a value cannot be used for a data member of SQL Server long data type
> > 1> Participant.hxx:234:13: info: accessor returning a const reference is required
> > 1> Participant.hxx:235:29: info: data member is defined here
>
> I think the ODB compiler is pretty clear about what you need to do to
> fix this:
>
> const std::vector<unsigned char>&
> getPicture() const
> {
> return picture;
> }
>
> std::vector<unsigned char>&
> setPicture()
> {
> return picture;
> }
>
> For more information on this limitation in SQL Server, see Section 19.5.7,
> "Long Data and By-Value Accessors/Modifiers"
>
> Boris
More information about the odb-users
mailing list