On Monday 18 January 2010 04:20:51 Maciej Sobczak wrote:
> > Is it possible to
> > support second form?
>
> I'm not sure if it would be possible with the other backends (in
> particular with Oracle), but at least with PostgreSQL the idea seems to
> be reasonable, as insertion would simply work on the oid value.
The attached diff looks fine? I could insert and retrieve the blob and its
contents correctly.
--
Shridhar
diff -bBur soci-3.0.0/src/backends/postgresql/standard-into-type.cpp soci-3.0.0.changed/src/backends/postgresql/standard-into-type.cpp
--- soci-3.0.0/src/backends/postgresql/standard-into-type.cpp 2008-07-02 19:31:46.000000000 +0530
+++ soci-3.0.0.changed/src/backends/postgresql/standard-into-type.cpp 2010-01-17 23:40:32.789475817 +0530
@@ -179,6 +179,7 @@
}
bbe->fd_ = fd;
+ bbe->oid_ = oid;
}
break;
diff -bBur soci-3.0.0/src/backends/postgresql/standard-use-type.cpp soci-3.0.0.changed/src/backends/postgresql/standard-use-type.cpp
--- soci-3.0.0/src/backends/postgresql/standard-use-type.cpp 2008-05-26 02:04:28.000000000 +0530
+++ soci-3.0.0.changed/src/backends/postgresql/standard-use-type.cpp 2010-01-17 23:40:36.369476157 +0530
@@ -8,6 +8,7 @@
#define SOCI_POSTGRESQL_SOURCE
#include "soci-postgresql.h"
#include "rowid.h"
+#include "blob.h"
#include <libpq/libpq-fs.h> // libpq
#include <cctype>
#include <cstdio>
@@ -160,6 +161,14 @@
snprintf(buf_, bufSize, "%lu", rbe->value_);
}
break;
+ case x_blob:
+ {
+ blob * b = static_cast<blob *>(data_);
+ postgresql_blob_backend *bbe = static_cast<postgresql_blob_backend *>(b->get_backend());
+ buf_ = new char[32];
+ sprintf(buf_,"%lu",bbe->oid_);
+ }
+ break;
default:
throw soci_error("Use element used with non-supported type.");
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users