9 #define SOCI_MYSQL_SOURCE 20 #pragma warning(disable:4355) 33 position_ = position++;
37 std::string
const &name,
void *data,
exchange_type type,
bool )
46 if (ind != NULL && *ind ==
i_null)
49 std::strcpy(buf_,
"NULL");
58 char buf[] = { *
static_cast<char*
>(data_),
'\0' };
59 buf_ =
quote(statement_.session_.conn_, buf, 1);
64 std::string *s =
static_cast<std::string *
>(data_);
65 buf_ =
quote(statement_.session_.conn_,
66 s->c_str(), s->size());
71 std::size_t
const bufSize
72 = std::numeric_limits<short>::digits10 + 3;
73 buf_ =
new char[bufSize];
74 snprintf(buf_, bufSize,
"%d",
75 static_cast<int>(*static_cast<short*>(data_)));
80 std::size_t
const bufSize
81 = std::numeric_limits<int>::digits10 + 3;
82 buf_ =
new char[bufSize];
83 snprintf(buf_, bufSize,
"%d", *static_cast<int*>(data_));
88 std::size_t
const bufSize
89 = std::numeric_limits<long long>::digits10 + 3;
90 buf_ =
new char[bufSize];
91 snprintf(buf_, bufSize,
"%" LL_FMT_FLAGS "d", *static_cast<long long *>(data_));
96 std::size_t
const bufSize
97 = std::numeric_limits<unsigned long long>::digits10 + 3;
98 buf_ =
new char[bufSize];
100 *static_cast<unsigned long long *>(data_));
108 "Use element used with infinity or NaN, which are " 109 "not supported by the MySQL server.");
112 std::size_t
const bufSize = 100;
113 buf_ =
new char[bufSize];
115 snprintf(buf_, bufSize,
"%.20g",
116 *static_cast<double*>(data_));
121 std::size_t
const bufSize = 22;
122 buf_ =
new char[bufSize];
124 std::tm *t =
static_cast<std::tm *
>(data_);
125 snprintf(buf_, bufSize,
126 "\'%d-%02d-%02d %02d:%02d:%02d\'",
127 t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
128 t->tm_hour, t->tm_min, t->tm_sec);
132 throw soci_error(
"Use element used with non-supported type.");
139 statement_.useByPosBuffers_[position_] = &buf_;
144 statement_.useByNameBuffers_[name_] = &buf_;
bool is_infinity_or_nan(T x)
virtual void post_use(bool gotData, indicator *ind)
virtual void bind_by_name(std::string const &name, void *data, details::exchange_type type, bool readOnly)
virtual void bind_by_pos(int &position, void *data, details::exchange_type type, bool readOnly)
char * quote(MYSQL *conn, const char *s, int len)
virtual void pre_use(indicator const *ind)