149
149
explicit connection_c(drizzle_c& drizzle)
151
b_= drizzle_con_create(drizzle);
155
throw "drizzle_con_create() failed";
151
drizzle_con_create(drizzle, *this);
157
152
read_conf_files();
162
drizzle_con_free(b_);
157
drizzle_con_free(*this);
165
160
operator drizzle_con_st*()
170
165
const char* error()
172
return drizzle_con_error(b_);
167
return drizzle_con_error(*this);
175
170
void set_tcp(const char* host, in_port_t port)
177
drizzle_con_set_tcp(b_, host, port);
172
drizzle_con_set_tcp(*this, host, port);
180
175
void set_auth(const char* user, const char* password)
182
drizzle_con_set_auth(b_, user, password);
177
drizzle_con_set_auth(*this, user, password);
185
180
void set_db(const char* db)
187
drizzle_con_set_db(b_, db);
182
drizzle_con_set_db(*this, db);
190
185
drizzle_return_t query(result_c& result, const char* str, size_t str_size)
192
187
drizzle_return_t ret;
194
188
drizzle_query(*this, result, str, str_size, &ret);
198
190
ret = drizzle_result_buffer(result);
260
247
query_c& p_name(const std::string& v)
262
249
std::vector<char> r(2 * v.size() + 2);
263
r.resize(drizzle_escape_string(&r.front() + 1, r.size(), v.data(), v.size()) + 2);
250
r.resize(drizzle_escape_string(&r.front() + 1, v.data(), v.size()) + 2);
266
253
p_raw(&r.front(), r.size());
287
274
query_c& p(const std::string& v)
289
276
std::vector<char> r(2 * v.size() + 2);
290
r.resize(drizzle_escape_string(&r.front() + 1, r.size(), v.data(), v.size()) + 2);
277
r.resize(drizzle_escape_string(&r.front() + 1, v.data(), v.size()) + 2);
291
278
r.front() = '\'';
293
280
p_raw(&r.front(), r.size());