8 #define soci_ORACLE_SOURCE 21 #pragma warning(disable:4355) 29 : session_(session), stmtp_(NULL), boundByName_(false), boundByPos_(false),
37 reinterpret_cast<dvoid**>(&
stmtp_),
38 OCI_HTYPE_STMT, 0, 0);
39 if (res != OCI_SUCCESS)
41 throw soci_error(
"Cannot allocate statement handle");
50 OCIHandleFree(
stmtp_, OCI_HTYPE_STMT);
61 sb4 stmtLen =
static_cast<sb4
>(query.size());
62 sword res = OCIStmtPrepare(
stmtp_,
64 reinterpret_cast<text*>(const_cast<char*>(query.c_str())),
65 stmtLen, OCI_V7_SYNTAX, OCI_DEFAULT);
66 if (res != OCI_SUCCESS)
75 static_cast<ub4>(number), 0, 0, 0, OCI_DEFAULT);
77 if (res == OCI_SUCCESS || res == OCI_SUCCESS_WITH_INFO)
82 else if (res == OCI_NO_DATA)
102 static_cast<ub4>(number), OCI_FETCH_NEXT, OCI_DEFAULT);
104 if (res == OCI_SUCCESS || res == OCI_SUCCESS_WITH_INFO)
108 else if (res == OCI_NO_DATA)
123 sword res = OCIAttrGet(static_cast<dvoid*>(
stmtp_),
124 OCI_HTYPE_STMT, &row_count,
127 if (res != OCI_SUCCESS)
138 sword res = OCIAttrGet(static_cast<dvoid*>(
stmtp_),
139 OCI_HTYPE_STMT, static_cast<dvoid*>(&rows),
142 if (res != OCI_SUCCESS)
151 std::string
const &query)
153 std::string newQuery(
"begin ");
155 newQuery +=
"; end;";
162 1, 0, 0, 0, OCI_DESCRIBE_ONLY);
163 if (res != OCI_SUCCESS)
169 res = OCIAttrGet(static_cast<dvoid*>(
stmtp_),
170 static_cast<ub4>(OCI_HTYPE_STMT), static_cast<dvoid*>(&cols),
173 if (res != OCI_SUCCESS)
182 std::string &columnName)
198 sword res = OCIParamGet(reinterpret_cast<dvoid*>(
stmtp_),
199 static_cast<ub4>(OCI_HTYPE_STMT),
201 reinterpret_cast<dvoid**>(&colhd),
202 static_cast<ub4>(colNum));
203 if (res != OCI_SUCCESS)
209 res = OCIAttrGet(reinterpret_cast<dvoid*>(colhd),
210 static_cast<ub4>(OCI_DTYPE_PARAM),
211 reinterpret_cast<dvoid**>(&dbname),
212 reinterpret_cast<ub4*>(&nameLength),
213 static_cast<ub4>(OCI_ATTR_NAME),
215 if (res != OCI_SUCCESS)
221 res = OCIAttrGet(reinterpret_cast<dvoid*>(colhd),
222 static_cast<ub4>(OCI_DTYPE_PARAM),
223 reinterpret_cast<dvoid*>(&dbtype),
225 static_cast<ub4>(OCI_ATTR_DATA_TYPE),
227 if (res != OCI_SUCCESS)
233 res = OCIAttrGet(reinterpret_cast<dvoid*>(colhd),
234 static_cast<ub4>(OCI_DTYPE_PARAM),
235 reinterpret_cast<dvoid*>(&dbsize),
237 static_cast<ub4>(OCI_ATTR_DATA_SIZE),
239 if (res != OCI_SUCCESS)
245 res = OCIAttrGet(reinterpret_cast<dvoid*>(colhd),
246 static_cast<ub4>(OCI_DTYPE_PARAM),
247 reinterpret_cast<dvoid*>(&dbprec),
249 static_cast<ub4>(OCI_ATTR_PRECISION),
251 if (res != OCI_SUCCESS)
257 res = OCIAttrGet(reinterpret_cast<dvoid*>(colhd),
258 static_cast<ub4>(OCI_DTYPE_PARAM),
259 reinterpret_cast<dvoid*>(&dbscale),
261 static_cast<ub4>(OCI_ATTR_SCALE),
263 if (res != OCI_SUCCESS)
268 columnName.assign(dbname, dbname + nameLength);
269 size =
static_cast<int>(dbsize);
270 precision =
static_cast<int>(dbprec);
271 scale =
static_cast<int>(dbscale);
287 else if (precision <= std::numeric_limits<int>::digits10)
313 if (res != OCI_SUCCESS)
320 res = OCIParamGet(reinterpret_cast<dvoid*>(
stmtp_),
321 static_cast<ub4>(OCI_HTYPE_STMT),
323 reinterpret_cast<dvoid**>(&colhd),
324 static_cast<ub4>(position));
325 if (res != OCI_SUCCESS)
331 res = OCIAttrGet(reinterpret_cast<dvoid*>(colhd),
332 static_cast<ub4>(OCI_DTYPE_PARAM),
333 reinterpret_cast<dvoid*>(&colSize),
335 static_cast<ub4>(OCI_ATTR_DATA_SIZE),
337 if (res != OCI_SUCCESS)
342 return static_cast<std::size_t
>(colSize);
virtual exec_fetch_result execute(int number)
virtual void describe_column(int colNum, data_type &dtype, std::string &columnName)
virtual std::string rewrite_for_procedure_call(std::string const &query)
virtual int get_number_of_rows()
oracle_statement_backend(oracle_session_backend &session)
virtual exec_fetch_result fetch(int number)
virtual long long get_affected_rows()
oracle_session_backend & session_
void throw_oracle_soci_error(sword res, OCIError *errhp)
std::size_t column_size(int position)
virtual void prepare(std::string const &query, details::statement_type eType)
virtual int prepare_for_describe()
bool get_option_decimals_as_strings()