void sqlite_statement::prepare(const sql &s) { reset(); str(s.prepare()); // destroy statement clear(); // prepare sqlite statement int ret = sqlite3_prepare_v2(db_(), str().c_str(), str().size(), &stmt_, 0); throw_error(ret, db_(), "sqlite3_prepare_v2", str()); }
void mysql_statement::prepare(const sql &s) { reset(); str(s.prepare()); // parse sql to create result and host arrays result_size = s.result_size(); host_size = s.host_size(); if (host_size) { host_array = new MYSQL_BIND[host_size]; memset(host_array, 0, host_size * sizeof(MYSQL_BIND)); length_vector.assign(host_size, 0); } int res = mysql_stmt_prepare(stmt, str().c_str(), str().size()); if (res > 0) { throw_stmt_error(res, stmt, "mysql", str()); } }