Datetime& Datetime::operator= (const Datetime& src) { log_debug("assign oracle::Datetime"); conn = src.conn; if (src.datetime) { if (datetime == 0 || !release) { // we have no handle or don't own it - create new one log_debug("allocate new descriptor"); ociDescriptorAlloc(); } log_debug("do assing"); ociAssign(src.datetime); } else if (datetime) { if (release) { // free log_debug("release old descriptor"); ociDescriptorFree(); } datetime = 0; } log_debug("assign end"); return *this; }
Datetime::Datetime(Connection* conn_, const tntdb::Date& s) : conn(conn_), datetime(0), release(true) { log_debug("create oracle::Datetime from tntdb::Date"); ociDescriptorAlloc(); ociConstruct(s.getYear(), s.getMonth(), s.getDay(), 0, 0, 0, 0); }
Datetime::Datetime(Connection* conn_, const tntdb::Time& s) : conn(conn_), datetime(0), release(true) { log_debug("create oracle::Datetime from tntdb::Time"); ociDescriptorAlloc(); ociConstruct(0, 0, 0, s.getHour(), s.getMinute(), s.getSecond(), s.getMillis()); }
Datetime::Datetime(const Datetime& src) : conn(src.conn), datetime(0), release(true) { log_debug("copy oracle::Datetime"); if (src.datetime) { ociDescriptorAlloc(); ociAssign(src.datetime); } }
void Blob::setData(Connection* conn_, const char* data, ub4 count) { conn = conn_; if (lob == 0) ociDescriptorAlloc(); log_debug("OCILobWrite"); sword ret = OCILobWrite(conn->getSvcCtxHandle(), conn->getErrorHandle(), lob, &count, 0, const_cast<char*>(data), count, OCI_ONE_PIECE, 0, 0, 0, 0); conn->checkError(ret, "OCILobWrite"); }
Blob::Blob(Connection* conn_, const char* data, ub4 count) : conn(conn_), lob(0), release(true) { log_debug("create oracle::Blob from data; size=" << count); ociDescriptorAlloc(); log_debug("OCILobWrite"); sword ret = OCILobWrite(conn->getSvcCtxHandle(), conn->getErrorHandle(), lob, &count, 0, const_cast<char*>(data), count, OCI_ONE_PIECE, 0, 0, 0, 0); conn->checkError(ret, "OCILobWrite"); }