8 #define SOCI_FIREBIRD_SOURCE 19 if (statement_.boundByName_)
22 "Binding for use elements must be either by position or by name.");
25 position_ = position-1;
32 statement_.uses_.push_back(static_cast<void*>(
this));
34 XSQLVAR *var = statement_.sqlda2p_->sqlvar+position_;
38 var->sqlind = &indISCHolder_;
40 statement_.boundByPos_ =
true;
46 if (statement_.boundByPos_)
49 "Binding for use elements must be either by position or by name.");
52 std::map <std::string, int> :: iterator idx =
53 statement_.names_.find(name);
55 if (idx == statement_.names_.end())
57 throw soci_error(
"Missing use element for bind by name (" + name +
")");
60 position_ = idx->second;
65 statement_.uses_.push_back(static_cast<void*>(
this));
67 XSQLVAR *var = statement_.sqlda2p_->sqlvar+position_;
71 var->sqlind = &indISCHolder_;
73 statement_.boundByName_ =
true;
84 T* getUseVectorValue(
void *v, std::size_t index)
87 static_cast<std::vector<T> *
>(v);
89 std::vector<T> &v_ = *src;
108 throw soci_error(
"Use element used with non-supported indicator type.");
112 XSQLVAR * var = statement_.sqlda2p_->sqlvar+position_;
119 setTextParam(getUseVectorValue<char>(data_, row), 1, buf_, var);
123 static_cast<void*
>(getUseVectorValue<short>(data_, row)),
128 static_cast<void*
>(getUseVectorValue<int>(data_, row)),
133 static_cast<void*
>(getUseVectorValue<long long>(data_, row)),
138 static_cast<void*
>(getUseVectorValue<double>(data_, row)),
145 std::string *tmp = getUseVectorValue<std::string>(data_, row);
151 getUseVectorValue<std::tm>(data_, row), buf_);
157 throw soci_error(
"Use element used with non-supported type.");
168 sz = getVectorSize<char> (data_);
171 sz = getVectorSize<short> (data_);
174 sz = getVectorSize<int> (data_);
177 sz = getVectorSize<long long> (data_);
180 sz = getVectorSize<double> (data_);
183 sz = getVectorSize<std::string> (data_);
186 sz = getVectorSize<std::tm> (data_);
190 throw soci_error(
"Use vector element used with non-supported type.");
203 std::vector<void*>::iterator it =
204 std::find(statement_.uses_.begin(), statement_.uses_.end(),
this);
205 if (it != statement_.uses_.end())
206 statement_.uses_.erase(it);
void tmEncode(short type, std::tm *src, void *dst)
void setTextParam(char const *s, std::size_t size, char *buf_, XSQLVAR *var)
virtual void pre_use(indicator const *ind)
char * allocBuffer(XSQLVAR *var)
virtual void bind_by_name(std::string const &name, void *data, details::exchange_type type)
virtual void bind_by_pos(int &position, void *data, details::exchange_type type)
virtual void exchangeData(std::size_t row)
virtual std::size_t size()