Another question on this.  I am implementing an API for users where I 
try to hide all of the libpqxx back-end connection work.  So they 
essentially either call load(stuff) and get(stuff) when wanting to 
push/get data from the database.  For the purposes of setting up a 
lostream, what is the best way to implement this?  Should I create an 
ilostream pointer and pass them the pointer?  I tried doing this but, it 
seems you can't assign one ilostream object to another (perhaps for 
obvious reasons that are not obvious to me).  And maybe I shouldn't even 
try to do this, but I was just trying to make the database interface as 
simple as possible for user applications.  Thoughts??

ie.

pqxx::ilostream & DBInterface::getBlobStream(int loId)
{
    std::string me = "getBlob";
    pqxx::work w(*_conn,me);
    static pqxx::ilostream loStream(w, loId);
    return loStream;  //really shouldn't return local var, but just 
testing for now
}

....

calling app
...
   pqxx::ilostream s = db->getBlob(conn, 137396407));    <== causes 
compiler error  

Thanks.


Jeroen T. Vermeulen wrote:
> On Thu, September 6, 2007 05:44, Shannon Allen wrote:
>   
>> Update:
>>
>> Getting closer.  I can now get the size of the lostream and it matches
>> the size of the file before I put it into the BLOB.  The problem I'm
>> having now is when I go to write the lostream back out to a file, in
>> Linux whenever I do a cmp originalfile newfile, it says that they are
>> different ("differ: byte 2590721, line 35").  But the sizes match
>> exactly.  Anyone have any idea??
>>     
>
> Hmm...  Unwanted encoding conversion maybe?  This stuff has long been
> flushed out of my mental cache, but maybe the LO stream classes need to
> add an ios::binary option somewhere.  :-/
>
>
> Jeroen
>
>   

_______________________________________________
Libpqxx-general mailing list
Libpqxx-general@gborg.postgresql.org
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general

Reply via email to