Hmm I see. I misunderstood your question. I probably won't have time to do anything about it in the next 2..3 weeks but I'll look into this after that.
Thanks, Aleksander On Wed, Feb 24, 2010 at 9:04 AM, <[email protected]> wrote: > > Thanks Aleksander. > > My problem is that I want to insert/retrieve binary data into a SQL table > without the need to discriminate different backends. > We want to be able to feed data into mysql and postgres (and possibly > sqlite3 as well) in a uniform way. > > I have a posgresql table like this > > create table foo ( > id INTEGER, > buffer BYTEA, > ); > > and a mysql table like this > > create table foo ( > id INTEGER, > buffer LONGBLOB, > ); > > and I want to use them without having to know if the database engine is > postgres or mysql. > <code> > To add an item I wanted to do something like > soci::session& con= ... > int id = .. > soci::blob buffer(con); > // ... buffer is filled with binary data > con.once << "INSERT INTO foo (id, buffer) VALUES (:1, :2)", > soci::use(id), > soci::use(buffer); > > soci::blob buffer2(con); > con.once << "SELECT buffer FROM foo WHERE id = " << id, > soci::into(buffer2); > <endcode> > > > But this does not work with mysql because mysql does not support Blob. > > Of course can replace the above soci::blob by a std::string and fill the > string with binary data. Then it works for mysql. > But this seems to be no option as the postgres backend can't bind that > std::string to a BYTEA, and - reading the code of the postgres backend - > the case that a std::string contains arbitrary binary data seems to be not > supported, too. > > Any ideas / hints how to solve that problem? > > Thanks in advance > Gerwin Pfab > >> Hey Gerwin, >> >> MySQL doesn't treat the BLOB or TEXT types specially, the is no >> file-like abstraction like in some other databases. The only way for >> SOCI to support a consistent API would be to add a layer of emulation, >> which could be very inefficient. That's why it's not supported. When >> using MySQL, the best way is to just insert and select BLOB and TEXT >> fields like any other fields. >> >> Thanks, >> >> Aleksander >> >> On Tue, Feb 23, 2010 at 6:55 AM, Gerwin Pfab <[email protected]> >> wrote: >> > Thank you all for that great library! >> > >> > I'm are currently using SOCI from the Git tarball 2010-01-25 >> > b2b614bc3f323bf99f0c11e680dba06a32ff89df >> > >> > This is almost perfect, but one thing would be essential for us: Support >> > for >> > soci::blob for the mysql backend. >> > >> > Are there plans to add it in the near future? >> > >> > Kind Regards >> > >> > Gerwin Pfab >> > >> > >> >> ------------------------------------------------------------------------------ >> > Download Intel® Parallel Studio Eval >> > Try the new software tools for yourself. Speed compiling, find bugs >> > proactively, and fine-tune applications for parallel performance. >> > See why Intel Parallel Studio got high marks during beta. >> > http://p.sf.net/sfu/intel-sw-dev >> > _______________________________________________ >> > Soci-users mailing list >> > [email protected] >> > https://lists.sourceforge.net/lists/listinfo/soci-users >> > >> >> >> ------------------------------------------------------------------------------ >> Download Intel® Parallel Studio Eval >> Try the new software tools for yourself. Speed compiling, find bugs >> proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Soci-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/soci-users > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Soci-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/soci-users > > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Soci-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/soci-users
