[odb-users] Storing Images in SQL Server 2008
    Boris Kolpackov 
    boris at codesynthesis.com
       
    Tue Jul  2 03:38:33 EDT 2013
    
    
  
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