8 #define SOCI_POSTGRESQL_SOURCE 13 #include <libpq/libpq-fs.h> 21 #ifdef SOCI_POSTGRESQL_NOPARAMS 22 #ifndef SOCI_POSTGRESQL_NOBINDBYNAME 23 #define SOCI_POSTGRESQL_NOBINDBYNAME 24 #endif // SOCI_POSTGRESQL_NOBINDBYNAME 25 #endif // SOCI_POSTGRESQL_NOPARAMS 28 #pragma warning(disable:4355 4996) 29 #define snprintf _snprintf 43 position_ = position++;
47 std::string
const & name,
void * data,
exchange_type type,
bool )
59 if (ind != NULL && *ind ==
i_null)
71 buf_[0] = *
static_cast<char *
>(data_);
77 std::string * s =
static_cast<std::string *
>(data_);
78 buf_ =
new char[s->size() + 1];
79 std::strcpy(buf_, s->c_str());
84 std::size_t
const bufSize
85 = std::numeric_limits<short>::digits10 + 3;
86 buf_ =
new char[bufSize];
87 snprintf(buf_, bufSize,
"%d",
88 static_cast<int>(*static_cast<short *>(data_)));
93 std::size_t
const bufSize
94 = std::numeric_limits<int>::digits10 + 3;
95 buf_ =
new char[bufSize];
96 snprintf(buf_, bufSize,
"%d",
97 *static_cast<int *>(data_));
102 std::size_t
const bufSize
103 = std::numeric_limits<long long>::digits10 + 3;
104 buf_ =
new char[bufSize];
106 *static_cast<long long *>(data_));
111 std::size_t
const bufSize
112 = std::numeric_limits<unsigned long long>::digits10 + 2;
113 buf_ =
new char[bufSize];
115 *static_cast<unsigned long long *>(data_));
122 std::size_t
const bufSize = 100;
123 buf_ =
new char[bufSize];
125 snprintf(buf_, bufSize,
"%.20g",
126 *static_cast<double *>(data_));
131 std::size_t
const bufSize = 20;
132 buf_ =
new char[bufSize];
134 std::tm * t =
static_cast<std::tm *
>(data_);
135 snprintf(buf_, bufSize,
"%d-%02d-%02d %02d:%02d:%02d",
136 t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
137 t->tm_hour, t->tm_min, t->tm_sec);
149 std::size_t
const bufSize
150 = std::numeric_limits<unsigned long>::digits10 + 2;
151 buf_ =
new char[bufSize];
153 snprintf(buf_, bufSize,
"%lu", rbe->
value_);
158 blob * b =
static_cast<blob *
>(data_);
162 std::size_t
const bufSize
163 = std::numeric_limits<unsigned long>::digits10 + 2;
164 buf_ =
new char[bufSize];
165 snprintf(buf_, bufSize,
"%lu", bbe->
oid_);
170 throw soci_error(
"Use element used with non-supported type.");
177 statement_.useByPosBuffers_[position_] = &buf_;
182 statement_.useByNameBuffers_[name_] = &buf_;
details::rowid_backend * get_backend()
virtual void bind_by_name(std::string const &name, void *data, details::exchange_type type, bool readOnly)
virtual void pre_use(indicator const *ind)
details::blob_backend * get_backend()
virtual void post_use(bool gotData, indicator *ind)
virtual void bind_by_pos(int &position, void *data, details::exchange_type type, bool readOnly)