Hello,
one of the non-trivial issues with SOCI for me right now is the missing
support for binary strings. For PostgreSQL (which is what I primarily
care about), this is bytea. Oracle has varbinary. SQLite has blob. No
idea about the rest, but they likely have something as well.

While it is relatively easy to handle soci::into(s) for bytea columns
automatically, the input side is a real problem. A PoC for just the
correct encoding can be found at
  https://github.com/jsonn/soci/tree/pg_bytea
This would automatically switch std::string parameters to the bytea
encoding, if they contain NUL characters. Sadly, that's not enough. For
proper support, binary and character strings have to be distinguished as
the latter must confirm to the database encoding and the former can be
arbitrary input. std::string is the natural encoding for both, so this
is difficult.

Python's DB API v2 solved this problem by requiring Binary() wrappers. I
think this would be appropiate as well here and slight careful coding
would mean no overhead in terms of copying for C++11. Downside is that
the way prepared statements are handled for PostgreSQL doesn't work this
way. At the time of prepare, the types of the arguments are not yet
known. Comments and ideas?

Joerg

------------------------------------------------------------------------------
_______________________________________________
soci-devel mailing list
soci-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/soci-devel

Reply via email to