); \
60} catch (CDB_Exception& ex) { \
61NCBI_RETHROW(ex, CSDB_Exception, eLowLevel, ""); \
64 #define SDBAPI_THROW(code, msg) \ 65 NCBI_THROW(CSDB_Exception, code, \ 66 CDB_Exception::SMessageInContext(msg, x_GetContext())) 75 case eClosed:
return "eClosed";
248 "Conversion between "+
string(one_type) +
" and " 250+
" is not supported");
253 #ifdef NCBI_COMPILER_WORKSHOP 254 #define CONVERTVALUE_STATIC 256 #define CONVERTVALUE_STATIC static 276 stringstr_val = from_val.
AsString();
278to_var.
Append(str_val.data(), str_val.size());
291to_var =
Int8(from_val);
303to_var.
Append(str_val.data(), str_val.size());
316to_var =
Int8(from_val);
319to_var =
Int4(from_val);
331to_var.
Append(str_val.data(), str_val.size());
344to_var =
Int8(from_val);
347to_var =
Int4(from_val);
350to_var =
Int2(from_val);
362to_var.
Append(str_val.data(), str_val.size());
375to_var =
Int8(from_val);
378to_var =
Int4(from_val);
381to_var =
Int2(from_val);
384to_var =
Uint1(from_val);
396to_var.
Append(str_val.data(), str_val.size());
409to_var =
Int8(from_val);
412to_var =
Int4(from_val);
415to_var =
Int2(from_val);
418to_var =
Uint1(from_val);
421to_var =
bool(from_val);
433to_var.
Append(str_val.data(), str_val.size());
446to_var = float(from_val);
449to_var = double(from_val);
461to_var.
Append(str_val.data(), str_val.size());
474to_var = double(from_val);
486to_var.
Append(str_val.data(), str_val.size());
511to_var.
Append(from_val);
516to_var.
Append(from_val.data(), from_val.size());
525to_var = NStr::StringToNumeric<Int2>(from_val);
528to_var = NStr::StringToNumeric<Uint1>(from_val);
539to_var =
CTime(from_val);
564 s_ConvertValue(
string(
reinterpret_cast<const char*
>(from_val.data()),
571to_var.
Append(from_val);
576to_var.
Append(
reinterpret_cast<const char*
>(from_val.data()),
593 #undef CONVERTVALUE_STATIC 598 switch(from_var.
GetType()) {
628 switch(from_var.
GetType()) {
654 switch(from_var.
GetType()) {
656temp_val = from_var.
GetInt8();
681 "Value for Int4 is out of bounds: " 684to_val =
Int4(temp_val);
691 switch(from_var.
GetType()) {
694temp_val = from_var.
GetInt8();
718 "Value for short is out of bounds: " 721to_val = short(temp_val);
728 switch(from_var.
GetType()) {
732temp_val = from_var.
GetInt8();
738to_val =
static_cast<unsigned char>(from_var.
GetBit());
755 "Value for unsigned char is out of bounds: " 758to_val =
static_cast<unsigned char>(temp_val);
765 switch(from_var.
GetType()) {
770temp_val = from_var.
GetInt8();
773to_val = from_var.
GetBit();
786 if(temp_val != 0 && temp_val != 1)
789 "Value for bool is out of bounds: " 792to_val = temp_val == 1;
798 switch(from_var.
GetType()) {
817 switch(from_var.
GetType()) {
837 switch(from_var.
GetType()) {
879 "fNBS_ZLib and fNBS_BZLib are mutually incompatible; " 880 "please specify at most one compression algorithm.");
932|| driver_name ==
"ftds100" 933|| driver_name ==
"ftds14") {
936 ERR_POST_X(15,
"Unsupported driver name "<< driver_name
978 if(plaintext.
get() ==
NULL) {
980 "Password decryption failed.");
994 #ifdef HAVE_LIBNCBICRYPT 996 key= NCBICRYPT_FindBuiltinKey(
string(key_id).c_str());;
1001 "Unknown password decryption key ID "+
string(key_id));
1039 "Connection parameters miss at least one essential part" 1040 " (host, user, password, or database [as \"path\"]): " 1065 if( !it->value.empty() ) {
1085 static const char*
kDefault=
"default";
1093 #define COPY_PARAM_EX(en, gn, fn) \ 1094 if (conf_params.Is##gn##Set()) \ 1095 m_ParamMap[e##en] = conf_params.fn 1096 #define COPY_PARAM(en, fn) COPY_PARAM_EX(en, en, fn) 1097 #define COPY_BOOL_PARAM(en, gn, fn) \ 1098 if (conf_params.Is##gn##Set()) \ 1099 m_ParamMap[e##en] = conf_params.fn.empty() ? "default"\
1100: NStr::StringToBool(conf_params.fn) ? "true" : "false"
1101 #define COPY_NUM_PARAM(en, gn, fn) \ 1102 if (conf_params.Is##gn##Set()) \ 1103 m_ParamMap[e##en] = conf_params.fn.empty() ? kDefault : conf_params.fn 1112 COPY_PARAM_EX(PasswordKeyID, PasswordKey, password_key_id);
1123pool_allow_temp_overflow);
1125continue_after_raiserror);
1126 COPY_NUM_PARAM(ConnPoolMaxConnUse, PoolMaxConnUse, pool_max_conn_use);
1127 COPY_BOOL_PARAM(LogMinorMessages, LogMinorMessages, log_minor_messages);
1129 #undef COPY_PARAM_EX 1131 #undef COPY_BOOL_PARAM 1132 #undef COPY_NUM_PARAM 1134 if( !conf_params.
args.empty() ) {
1149 " password_file parameters are mutually exclusive.");
1168password = it->second;
1171 if(pwfile.empty()) {
1178 "Unable to open password file "+ pwfile +
": "+
1187 if( !key_id.empty() ) {
1190password = decryptor->Decrypt(password, key_id);
1191 ITERATE(
string, pit, password) {
1192 if( !
isprint((
unsigned char)*pit) ) {
1195 "Invalid character in supposedly decrypted" 1214 if( !port.empty() ) {
1222 if(params->
GetParam(
"is_pooled") ==
"true") {
1226 if( !explicit_pool_name.empty() ) {
1227params->
SetParam(
"pool_name", explicit_pool_name);
1233params->
SetParam(
"pool_max_conn_use",
1249 typedefvector<CUrlArgs*> TAllArgs;
1253unique_ptr<CUrlArgs> conf_args;
1257conf_args.reset(
new CUrlArgs(it->second));
1258all_args.push_back(conf_args.get());
1262 ITERATE(TAllArgs, ait, all_args) {
1265 const string& param_name = uit->name;
1266 const string& param_value = uit->value;
1268params->
SetParam(param_name, param_value);
1273params->
SetParam(
"do_not_read_conf",
"true");
1278 const string& name,
EParam id)
const 1281 if( !
value.empty() &&
value!=
"default") {
1292 if(code_value == reg_value) {
1301conf_map[it->name] = it->value;
1305TConfMap::const_iterator cmit = conf_map.find(uait->name);
1306 if(cmit != conf_map.end()) {
1311 ERR_POST_X(18,
Info<<
"Using privately configured service alias " 1312<< code_value <<
" -> "<< reg_value);
1315code_value =
"(redacted)";
1316reg_value =
"(redacted)";
1319<<
" parameter value "<< code_value <<
" for " 1320<<
m_Url.
GetHost() <<
" in favor of configured value " 1334list<string> sections;
1336 ITERATE(list<string>, it, sections) {
1337 const string& name = *it;
1338 if(name.size() <= 10
1347 if(lower_params.
GetParam(
"is_pooled") ==
"true") {
1348 result&=
ctx->SatisfyPoolMinimum(lower_params);
1370 "CSDBAPI::UseDriver called with SDBAPI already in use.");
1481list<string>* servers
,
1482 string* error_message
)
1484 if(dbservice.empty()) {
1486 "Mirrored database service name cannot be empty");
1489 boolfirst_execution =
false;
1490 SMirrorInfo& mir_info = (*s_MirrorsData)[dbservice];
1493first_execution =
true;
1502first_execution =
true;
1505 if(conn_params.
GetParam(
"single_server") !=
"true") {
1507 "UpdateMirror cannot be used when configuration file " 1508 "doesn't have exclusive_server=true (for "+ dbservice
1515 "UpdateMirror cannot work with non-standard " 1516 "connection factory");
1522error_message->clear();
1527 boolneed_reread_servers =
false;
1528 boolservers_reread =
false;
1529 boolhas_master =
false;
1530 intcnt_switches = 0;
1533 if(serv_list.empty()) {
1534list<string> servers;
1536 ITERATE(list<string>, it, servers) {
1538serv_list.back()->server_name = *it;
1541servers_reread =
true;
1543 else if(need_reread_servers) {
1544list<string> new_serv_info;
1545factory->
GetServersList(db_name, service_name, &new_serv_info);
1547 boolfound =
false;
1548 ITERATE(list<string>, it, new_serv_info) {
1549 if(*it == (*old_it)->server_name) {
1555serv_list.erase(old_it);
1558 ITERATE(list<string>, new_it, new_serv_info) {
1559 boolfound =
false;
1561 if((*old_it)->server_name == *new_it) {
1568serv_list.back()->server_name = *new_it;
1572servers_reread =
true;
1574 if(serv_list.empty()) {
1576 ERR_POST_X(3,
"No servers for service '"<< service_name
1577<<
"' are available");
1578 if(error_message) {
1579*error_message =
"No servers for service '"+ service_name
1580+
"' are available";
1585 for(TMirrorServList::iterator it = serv_list.end(); it != serv_list.begin(); )
1589 const string& server_name = (*it)->server_name;
1591 if(!
conn.get()) {
1594 if(!
conn->IsAlive()) {
1596 ERR_POST_X(7,
"Connection to server '"<< server_name
1597<<
"' for service '"<< service_name
1603serv_params.
SetParam(
"is_pooled",
"false");
1604serv_params.
SetParam(
"do_not_dispatch",
"true");
1607 conn->Connect(serv_params);
1609 ERR_POST_X(8,
"Connection to server '"<< server_name
1610<<
"' for service '"<< service_name
1611<<
"' is restored.");
1619 ERR_POST_X(9,
"Cannot establish connection to server '" 1620<< server_name <<
"' for service '" 1621<< service_name <<
"'.");
1625need_reread_servers =
true;
1628 boolsuccess =
false;
1629 if(
conn->IsAlive()) {
1632 stmt->ExecuteUpdate(
"use "+ db_name);
1641 if(!success && server_name == mir_info.
master) {
1643 stringpool_name = conn_params.
GetParam(
"pool_name");
1645 ERR_POST_X(4,
"The master for database '"<< db_name <<
1646 "' (service '"<< service_name <<
1647 "') has become inaccessible. Because of this "<<
1648invalidated_count <<
1649 " active connections got invalidated in the pool '"<<
1650pool_name <<
"'.");
1651mir_info.
master.clear();
1652need_reread_servers =
true;
1654 else if(success && server_name != mir_info.
master) {
1656 stringpool_name = conn_params.
GetParam(
"pool_name");
1657 size_tinvalidated_count =
1660 conn->GetCDB_Connection()->Host(),
1661 conn->GetCDB_Connection()->Port());
1662 stringmsg_start =
"The master for database '"+ db_name +
1663 "' (for service '"+ service_name +
1664 "') switched to '"+ server_name +
"' from ";
1665 stringmsg_end =
". Because of this "+
1667 " active connections got invalidated in the pool '"+
1670 if(mir_info.
master.empty()) {
1672 ERR_POST_X(5, Message << msg_start <<
"NONE"<< msg_end);
1676mir_info.
master<<
"'"<< msg_end);
1681mir_info.
master= server_name;
1682serv_list.push_front(*it);
1683TMirrorServList::iterator it_del = it++;
1684serv_list.erase(it_del);
1685need_reread_servers =
true;
1687 if(++cnt_switches == 10) {
1690 "Mirror database switches too frequently or " 1691 "it isn't mirrored: "+ service_name);
1694 else if(success && server_name == mir_info.
master) {
1699 while(need_reread_servers && !servers_reread);
1701 if(first_execution && !has_master) {
1703 stringpool_name = conn_params.
GetParam(
"pool_name");
1705 ERR_POST_X(10,
"The master for database '"<< db_name <<
1706 "' (service '"<< service_name <<
1707 "') is not accessible. Because of this "<<
1708invalidated_count <<
1709 " active connections got invalidated in the pool '"<<
1710pool_name <<
"'.");
1715servers->push_back((*it)->server_name);
1720*error_message =
"All database instances are inaccessible";
1728TNewBlobStoreFlags
flags,
1734 " variant of NewBlobStore that inspects column types" 1748 if(ex ==
nullptr) {
1760 const string& message)
1762 if(severity < 10 || (severity == 10 && msgnum == 0)) {
1763 if(severity == 0 || (severity == 10 && msgnum == 0)) {
1771&& (severity == 16 || (severity == 10 && msgnum > 0))) {
1784(severity, msgnum, message);
1792m_DefaultTimeout(0),
1793m_HasCustomTimeout(
false),
1794m_ContinueAfterRaiserror
1846 unsigned intsec, nanosec;
1847timeout.
GetNano(&sec, &nanosec);
1891 conn->Connect(lower_params);
1899: m_IsOpen(
false), m_EverConnected(
false)
1905: m_Conn(other.m_Conn),
1906m_IsOpen(other.m_IsOpen),
1907m_EverConnected(other.m_EverConnected)
2050}
else if(check_method ==
eNoCheck) {
2056 if( !
conn->IsAlive() ) {
2067 query.RequireRowCount(1);
2069 bool ok= (
row!=
query.end() &&
row.GetTotalColumns() == 1
2070&&
row[1].AsInt4() == 1);
2071 query.VerifyDone();
2073}
catch(exception&) {
2089 #define CONNECT_AS_NEEDED() x_ConnectAsNeeded(NCBI_CURRENT_FUNCTION) 2107 const string& search_conditions,
2114 switch(column_type) {
2126unique_ptr<I_BlobDescriptor> desc
2128desc_type, has_legacy_type));
2136TNewBlobStoreFlags
flags,
2142 " variant of NewBlobStore that inspects column types" 2153 const string& key_col_name,
2154 const string& num_col_name,
2155 constvector<string> blob_col_names,
2156TNewBlobStoreFlags
flags,
2163&blob_col_names[0], blob_col_names.size(),
2177+
" when not connected.");
2186 "Cannot obtain driver version before connecting");
2203: m_DBImpl(db_impl),
2205m_Autoflush(autoflush),
2208m_WriteStarted(
false),
2237 "Cannot write into completed CBulkInsert");
2244 "Cannot write into CBulkInsert when CDatabase was closed");
2246 if(col != 0 && col >
int(
m_Cols.size())) {
2248 "Too many values were written to CBulkInsert: " 2281 "Cannot bind columns when already started to insert");
2283 if(col - 1 !=
int(
m_Cols.size())) {
2285 "Cannot bind columns in CBulkInsert randomly");
2300 "Not enough values were written to CBulkInsert: " 2324unique_ptr<IBulkInsert> bi(
m_BI);
2338 for(
unsigned int i= 0;
i<
m_Cols.size(); ++
i) {
2477 #if !NCBI_INT8_IS_LONG 2481 #if SIZEOF_LONG == 8 2553: m_Basis(new
CParamQFB(v, q->x_GetContext(), param_type))
2563: m_Basis(qf.m_Basis.release())
2584: m_Impl(
f.m_Impl)
2622: m_Fields(
r.m_Fields), m_MetaData(
r.m_MetaData)
2632 if(col == 0 || col > m_Fields.size()) {
2635 "No such column in the result set: " 2642x_CheckColumnNumber(col);
2643 returnm_Fields[col - 1];
2649= m_MetaData->col_nums.find(col);
2650 if(it == m_MetaData->col_nums.end()) {
2653 "No such column in the result set: "+ col +
". " 2656 returnm_Fields[it->second - 1];
2662 returnm_Fields.size();
2667x_CheckColumnNumber(col);
2668 returnm_MetaData->col_names[col - 1];
2673x_CheckColumnNumber(col);
2674 returnm_MetaData->col_types[col - 1];
2681m_MetaData->exception_context.Reset(&q.
x_GetContext());
2686m_Fields.reserve(cols_cnt);
2687 for(
unsigned int i= 1;
i<= cols_cnt; ++
i) {
2689m_MetaData->col_nums[meta->
GetName(
i)] =
i;
2690m_MetaData->col_names.emplace_back(meta->
GetName(
i));
2698: m_DBImpl(db_impl),
2702m_IgnoreBounds(
true),
2703m_HasExplicitMode(
false),
2704m_RSBeginned(
false),
2705m_RSFinished(
true),
2706m_Executed(
false),
2707m_ReportedWrongRowCount(
false),
2709m_RowUnderConstruction(
false),
2740oss << (
m_IsSP?
"RPC: ":
"SQL: ");
2744oss <<
"; input parameter(s): ";
2748oss << it->first <<
" = ";
2752oss <<
value->GetData()->GetLogString();
2766 "CQuery is not operational because CDatabase was closed");
2772 "CQuery is closed or never executed");
2792it->second.x_Detach();
2793 static_cast<CParamQFB&
>(*it->second.m_Impl->m_Basis)
2794.SetParamType(param_type);
2802 const_cast<CVariant&
>(*it->second.m_Impl->GetValue()));
2819it->second.x_Detach();
2820 static_cast<CParamQFB&
>(*it->second.m_Impl->m_Basis)
2821.SetParamType(param_type);
2841it->second.x_Detach();
2866 "Parameter '"+
string(name) +
"' doesn't exist. " 2868}
else if(
static_cast<const CParamQFB&
>(*it->second.m_Impl->m_Basis)
2873 "CQuery::GetParameter called with some results still" 2888it->second.x_Detach();
2898p.second.x_Detach();
2939 "Problem while closing DB query " 2940 "(result was at row number "<< orig_row_no <<
2941 " and is now at row number "<<
m_CurRowNo<<
").");
2985 "No statement to execute.");
3025=
static_cast<const CParamQFB&
>(*it->second.m_Impl->m_Basis);
3084 "CQuery::GetRowCount called with some results still" 3097 "CQuery::GetStatus called with some results still" 3124 "Too many rows returned (limited to " 3130 "Not enough rows returned (" 3182 while(
stmt->HasMoreResults()) {
3196 for(
unsigned int i= 1;
i<= col_cnt; ++
i) {
3207<<
"Multiple SDBAPI result sets found, but" 3208 " neither SingleSet nor MultiSet explicitly" 3209 " requested. Now defaulting to SingleSet. " 3261 if( !has_more_rs ) {
3267 "All result sets in CQuery were already iterated through. " 3289 boolhas_more =
true;
3297 while(has_more && rs !=
m_CurRS) {
3357 "RequireRowCount must follow Execute or ExecuteSP," 3358 " which reset any requirements.");
3360 if(min_rows > max_rows) {
3362 "Inconsistent row-count constraints: " 3367 _TRACE(
"RequireRowCount("<< min_rows <<
", "<< max_rows <<
')');
3380 boolmissed_results =
false;
3410 if(missed_results) {
3439nc_self.
m_Row= saved_row;
3482: m_DBImpl(db_impl),
3511: m_Impl(
bm.m_Impl)
3564: m_Query(ri.m_Query),
3582 returnm_Query->x_GetContext();
3588 returnm_Query->GetResultSetNo();
3594 returnm_Query->GetRowNo();
3600 returnm_Query->GetTotalColumns();
3606 returnm_Query->GetColumnName(col);
3612 returnm_Query->GetColumnType(col);
3620 else if(m_IsEnd ^ ri.
m_IsEnd) {
3621 returnm_Query->IsFinished();
3630 if(m_IsEnd || m_Query->IsFinished()) {
3632 "Cannot increase end() iterator");
3641 returnm_Query->GetRow()[col];
3647 returnm_Query->GetRow()[col];
3652 returnm_Query->GetRow();
3658unique_ptr<IQueryFieldBasis> new_basis
3661m_Basis.reset(new_basis.release());
3667unique_ptr<IQueryFieldBasis> new_basis
3670m_Basis.reset(new_basis.release());
3684 returnm_Basis->x_GetContext();
3690 returnm_Basis->GetValue();
3704 unsigned char value= 0;
3752 bool value=
false;
3765 constvector<unsigned char>&
3769 string(
"Method is unsupported for this type of data: ")
3773 constvector<unsigned char>&
3776 const CVariant& var_val = *GetValue();
3781 const unsigned char*
data 3782=
reinterpret_cast<const unsigned char*
>(
value.data());
3784m_Vector.insert(m_Vector.begin(),
data,
data+
value.size());
3788 constvector<unsigned char>&
3791 return m_Impl->AsVector();
3798 string(
"Method is unsupported for this type of data: ")
3805 const CVariant& var_val = *GetValue();
3806m_ValueForStream = var_val.
GetString();
3815 return m_Impl->AsIStream();
3821 return m_Impl->GetValue()->IsNull();
3827 "Method requires a live field");
3833 const CVariant& var_val = *GetValue();
3839blob_size,
flags,
false),
3850 string(
"Method is unsupported for this type of data: ")
3857m_OStream.reset(m_Basis->GetOStream(blob_size,
flags));
3871 returnGetOStream(blob_size,
3879 "Method requires a live field");
3884 const CVariant& var_val = *GetValue();
3894 string(
"Method is unsupported for this type of data: ")
3900 returnm_Basis->GetBookmark();
3906 return m_Impl->GetBookmark();
3934 const string&
value,
3944 const char*
value,
3984 unsigned char value,
4108 "Exactly one row requested while RequireRowCount() set " 4113 "Exactly one row requested while RequireRowCount() set " 4120 "Expected exactly one row, but none are available");
4127 "Expected exactly one row, but more than one are available");
Helper class to allow safe initialization from higher-layer objects.
unique_ptr< I_BlobDescriptor > m_Descr
CRef< CDatabaseImpl > m_DBImpl
unique_ptr< CWStream > m_OStream
CNcbiOstream & GetOStream(size_t blob_size, TBlobOStreamFlags flags)
CBlobBookmarkImpl(CDatabaseImpl *db_impl, I_BlobDescriptor *descr)
Object used to store bookmarks to blobs to be changed later.
CBlobBookmark & operator=(const CBlobBookmark &bm)
CNcbiOstream & GetOStream(size_t blob_size, TBlobOStreamFlags flags=0) const
Get Blob output stream.
CRef< CBlobBookmarkImpl > m_Impl
Bookmark implementation object.
CBlobBookmark(void)
Empty constructor of bookmark object.
EBlobType
Blob type (if known).
void x_CheckCanWrite(int col)
CRef< CDB_Exception::SContext > m_Context
void Bind(int col, ESDB_Type type)
void AddOrderHint(CTempString columns)
void x_CheckWriteStarted(void)
CBulkInsertImpl(CDatabaseImpl *db_impl, const string &tableName, int autoflush)
const CDB_Exception::SContext & x_GetContext(void) const
void WriteVal(const T &val)
void SetHints(CTempString hints)
CRef< CDatabaseImpl > m_DBImpl
void AddHint(IBulkInsert::EHints hint, unsigned int value)
vector< CVariant > m_Cols
Object used to perform bulk-inserting operations to database.
CBulkInsert & operator<<(const string &val)
Put values of different type into bulk-insert row.
EHints
Type of hint that can be set for bulk insert.
void AddHint(EHints hint)
Add hint to the bulk insert.
void Complete()
Complete bulk insert.
void Bind(int col, ESDB_Type type)
Bind column for bulk insert.
void AddOrderHint(CTempString columns)
Add "ORDER" hint.
EHintsWithValue
Type of hint that requires some value to be provided with it.
void SetHints(CTempString hints)
Set hints by one call. Resets everything that was set by Add*Hint().
CRef< CBulkInsertImpl > m_Impl
Bulk-insert implementation object.
CBulkInsert(void)
Empty constructor of bulk-insert object.
CBulkInsert & operator=(const CBulkInsert &bi)
void SetTimeout(const CTimeout &timeout)
CRef< CDB_Exception::SContext > m_Context
virtual ~CConnHolder(void)
bool m_ContinueAfterRaiserror
list< string > m_PrintOutput
CRef< CSDB_UserHandler > m_Handler
IConnection * GetConn(void) const
CConnHolder(IConnection *conn, const CSDB_ConnectionParam ¶ms)
const CDB_Exception::SContext & GetContext(void) const
const list< string > & GetPrintOutput(void) const
Helper hook-up class that installs default logging/registry/locking (but only if they have not yet be...
void SetEncoding(EEncoding encoding)
void SetPassword(const string &passwd)
void SetDriverName(const string &name)
void SetParam(const string &key, const string &value)
void SetServerName(const string &name)
void SetDatabaseName(const string &name)
void SetUserName(const string &name)
void GetServersList(const string &validator_name, const string &service_name, list< string > *serv_list)
void WorkWithSingleServer(const string &validator_name, const string &service_name, const string &server)
CDataSourceInitializer(void)
void Connect(const CSDB_ConnectionParam ¶ms)
CRef< CConnHolder > m_Conn
const list< string > & GetPrintOutput(void) const
IConnection * GetConnection(void)
const CDB_Exception::SContext & GetContext(void) const
bool EverConnected() const
void SetTimeout(const CTimeout &timeout)
Database connection object.
void Close(void)
Close database object.
CDatabase & operator=(const CDatabase &db)
void Connect(void)
Explicitly (re)connect to the database server.
CSDBAPI::EDriver GetDriverVersion(void) const
Get the driver version.
CQuery NewQuery(void)
Get new CQuery object for this database.
CDatabase Clone(void)
Clone database object.
CBlobBookmark NewBookmark(const string &table_name, const string &column_name, const string &search_conditions, CBlobBookmark::EBlobType column_type=CBlobBookmark::eUnknown, ETriState has_legacy_type=eTriState_Unknown)
Get new CBlobBookmark object.
CBulkInsert NewBulkInsert(const string &table_name, int autoflush)
Get new CBulkInsert object.
EConnectionCheckMethod
How thoroughly IsConnected should actually check the connection.
CRef< CDatabaseImpl > m_Impl
Database implementation object.
CBlobStoreStatic * NewBlobStore(const string &table_name, TNewBlobStoreFlags flags=TNewBlobStoreFlags(0), size_t image_limit=1<< 24)
Get new CBlobStoreStatic object (to be owned by caller).
bool IsConnected(EConnectionCheckMethod check_method=eNoCheck)
Check if database object was already connected to database server.
CSDB_ConnectionParam m_Params
Database parameters.
void x_ConnectAsNeeded(const char *operation)
CDatabase(void)
Empty constructor of database object.
CRef< IDBConnectionFactory > GetConnectionFactory(void) const
Retrieve a connection factory.
static CDbapiConnMgr & Instance(void)
Get access to the class instance.
Incapsulate compile time information such as __FILE__, __LINE__, NCBI_MODULE, current function.
const CVariant * GetValue(void) const override
static CNcbiApplication * Instance(void)
Singleton method.
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
ESP_ParamType GetParamType(void) const
CRef< CQueryFieldImpl > Detach(void) override
const vector< unsigned char > & AsVector(void) const override
CNcbiOstream & GetOStream(size_t blob_size, TBlobOStreamFlags flags) const override
CBlobBookmark GetBookmark(void) const override
CQueryBlobImpl(CQueryImpl *q, unsigned int col_num)
CNcbiIstream & AsIStream(void) const override
const CDB_Exception::SContext & x_GetContext(void) const
virtual CNcbiOstream & GetOStream(size_t blob_size, TBlobOStreamFlags flags) const
virtual CNcbiIstream & AsIStream(void) const
const CVariant * GetValue(void) const
virtual CRef< CQueryFieldImpl > Detach(void)
virtual const vector< unsigned char > & AsVector(void) const
CQueryFieldImpl(CQueryImpl *q, unsigned int col_num)
virtual CBlobBookmark GetBookmark(void) const
unsigned int GetRowNo(CQuery::EHowMuch how_much=CQuery::eAllResultSets) const
const list< string > & GetPrintOutput(void) const
void SetSql(CTempString sql)
ICallableStatement * m_CallStmt
unsigned int GetResultSetNo(void) const
void x_InitRSFields(void)
void ClearParameter(CTempString name)
unsigned int m_MaxRowCount
unsigned int GetMaxRowCount(void) const
void x_CheckCanWork(bool need_rs=false) const
void SetNullParameter(CTempString name, ESDB_Type type, ESP_ParamType param_type)
void x_SetOutParameter(const string &name, const CVariant &value)
void SetParameter(CTempString name, const T &value, ESDB_Type type, ESP_ParamType param_type)
CRef< CDatabaseImpl > m_DBImpl
int GetStatus(void) const
void x_InitBeforeExec(void)
void Execute(const CTimeout &timeout)
void ExecuteSP(CTempString sp, const CTimeout &timeout)
unsigned int GetMinRowCount(void) const
CDatabaseImpl * GetDatabase(void) const
void SetIgnoreBounds(bool is_ignore)
bool m_ReportedWrongRowCount
CQueryImpl(CDatabaseImpl *db_impl)
unsigned int m_MinRowCount
void x_ClearAllParams(void)
unsigned int GetTotalColumns(void) const
CRef< CDB_Exception::SContext > m_Context
string GetColumnName(unsigned int col) const
const CQuery::CField & GetParameter(CTempString name)
void ClearParameters(void)
IConnection * GetConnection(void)
const CQuery::CRow & GetRow(void) const
bool HasMoreResultSets(void)
bool m_RowUnderConstruction
void x_DetachAllFields(void)
ESDB_Type GetColumnType(unsigned int col) const
unsigned int m_CurRelRowNo
void RequireRowCount(unsigned int min_rows, unsigned int max_rows)
const CQuery::CField & GetColumn(const CDBParamVariant &col) const
void x_CheckRowCount(void)
bool IsFinished(CQuery::EHowMuch how_much=CQuery::eThisResultSet) const
void VerifyDone(CQuery::EHowMuch how_much=CQuery::eThisResultSet)
const CDB_Exception::SContext & x_GetContext(void) const
int GetRowCount(void) const
const CVariant & GetFieldValue(unsigned int col_num)
Class representing value in result set or output parameter of stored procedure.
CNcbiOstream & GetOStream(size_t blob_size, TBlobOStreamFlags flags=0) const
Get a blob output stream, on top of a cloned connection.
bool IsNull(void) const
Check if value is NULL.
bool AsBool(void) const
Get value as bool.
Int8 AsInt8(void) const
Get value as 8-byte integer.
const vector< unsigned char > & AsVector(void) const
Get value as vector of bytes.
Int4 AsInt4(void) const
Get value as 4-byte integer.
CNcbiIstream & AsIStream(void) const
Get value as input stream.
unsigned char AsByte(void) const
Get value as single byte.
CTime AsDateTime(void) const
Get value as CTime.
string AsString(void) const
Get value as UTF-8 string.
short AsShort(void) const
Get value as short integer.
double AsDouble(void) const
Get value as double.
CBlobBookmark GetBookmark(void) const
Get bookmark for the blob.
float AsFloat(void) const
Get value as float.
Iterator class doing main navigation through result sets.
ESDB_Type GetColumnType(unsigned int col) const
Get type of the column with given number in the current result set.
bool operator==(const CRowIterator &ri) const
Comparison of iterators.
unsigned int GetResultSetNo(void) const
Get number of currently active result set.
unsigned int GetTotalColumns(void) const
Get number of columns in the current result set.
const CDB_Exception::SContext & x_GetContext(void) const
CRowIterator(void)
Empty constructor of iterator.
const CRow & operator*(void) const
Get the full row. (The caller is welcome to keep a copy.)
CRowIterator & operator=(const CRowIterator &ri)
bool m_IsEnd
Flag showing whether this is constant pointer to the end or pointer to some particular row.
CRowIterator & operator++(void)
Advance iterator to the next row in the result set.
unsigned int GetRowNo(void) const
Get row number currently active.
string GetColumnName(unsigned int col) const
Get name of the column with given number in the current result set.
const CField & operator[](unsigned int col) const
Get column value by its number.
CRef< CQueryImpl > m_Query
Query iterator was created for.
A full row of result data.
void x_CheckColumnNumber(unsigned int col) const
CRef< SQueryRSMetaData > m_MetaData
ESDB_Type GetColumnType(unsigned int col) const
Get type of the column with given number in the row.
vector< CField > m_Fields
unsigned int GetTotalColumns(void) const
Get number of columns in the row.
const string & GetColumnName(unsigned int col) const
Get name of the column with given number in the row.
const CField & operator[](unsigned int col) const
Get column value by its number.
void x_Reset(CQueryImpl &q, IResultSet &rs)
const CDB_Exception::SContext & x_GetContext(void) const
Object used to execute queries and stored procedures on the database server and retrieve result sets.
bool HasMoreResultSets(void)
Check if any more result sets are available for reading.
CQuery & SetSql(CTempString sql)
Set current sql statement.
int GetStatus(void) const
Get return status of stored procedure.
CQuery & MultiSet(void)
Convert this query to not merge different result sets, i.e.
CRow GetTheOnlyRow(void)
Provides the only row for the executed query.
CQuery & ClearParameters(void)
Remove all parameters from parameter list.
unsigned int GetTotalColumns(void) const
Get total number of columns in the current result set.
EAllowLog
Allow transaction log (general, to avoid using bools).
@ eDisableLog
Disables log.
CRowIterator end(void) const
Get iterator pointing to the end of the current result set or to the end of all result sets (dependin...
ESDB_Type GetColumnType(unsigned int col) const
Get type of the column with given number in the current result set All columns are numbered starting ...
EHowMuch
Whether to consider just the current result set or all result sets, in MultiSet mode.
void VerifyDone(EHowMuch how_much=eThisResultSet)
Ensure that no unread rows or parameter results remain, and that the total number of rows satisfies a...
CRef< CQueryImpl > m_Impl
Query implementation object.
void Cancel(void)
Cancel the current statement or procedure call.
CQuery & SetNullParameter(CTempString name, ESDB_Type type, ESP_ParamType param_type=eSP_In)
Assign null value to the parameter.
CRowIterator begin(void) const
Start iterating through next result set.
const CField & GetParameter(CTempString name)
Get value of the parameter.
CQuery & ClearParameter(CTempString name)
Remove parameter with given name from parameter list.
CQuery & Execute(const CTimeout &timeout=CTimeout(CTimeout::eDefault))
Explicitly execute sql statement.
const list< string > & GetPrintOutput(void) const
Get any PRINT output from the latest procedure call (or statement).
void RequireRowCount(unsigned int n)
Indicate precisely how many rows the active query should return.
CQuery(void)
Empty constructor of query object.
CQuery & SetParameter(CTempString name, const string &value, ESDB_Type type=eSDB_String, ESP_ParamType param_type=eSP_In)
Assign string value to the parameter.
unsigned int GetRowNo(EHowMuch how_much=eAllResultSets) const
Get row number currently active.
CQuery & ExecuteSP(CTempString sp, const CTimeout &timeout=CTimeout(CTimeout::eDefault))
Execute stored procedure with given name.
int GetRowCount(void) const
Get number of rows read after statement execution.
unsigned int GetResultSetNo(void) const
Get number of currently active result set.
void PurgeResults(void)
Purge all remaining result sets; fill in all remaining parameter results.
CQuery & SingleSet(void)
Convert this query to work like only one result set was returned effectively merging all result sets ...
string GetColumnName(unsigned int col) const
Get name of the column with given number in the current result set.
CQuery & operator=(const CQuery &q)
@ fLogExceptions
Exceptions logged only.
@ fOwnWriter
Own the underlying writer.
CBlobBookmark GetBookmark(void) const override
const CDB_Exception::SContext & x_GetContext(void) const override
const CVariant * GetValue(void) const override
CNcbiOstream * GetOStream(size_t blob_size, TBlobOStreamFlags flags) const override
@ eMirror_Unavailable
All databases in the mirror are unavailable.
@ eMirror_Steady
Mirror is working on the same server as before.
@ eMirror_NewMaster
Switched to a new master.
static void UseDriver(EDriver driver)
Use the specified driver for all connections.
static EMirrorStatus UpdateMirror(const string &dbservice, list< string > *servers=NULL, string *error_message=NULL)
Check for master/mirror switch.
static CBlobStoreDynamic * NewBlobStore(const CSDB_ConnectionParam ¶m, const string &table_name, TNewBlobStoreFlags flags=TNewBlobStoreFlags(0), size_t image_limit=1<< 24)
Get new CBlobStoreDynamic object (to be owned by caller).
static bool Init(void)
Initialize SDBAPI.
static void SetApplicationName(const CTempString &name)
Report the specified application name to servers.
static string GetApplicationName(void)
Check SDBAPI's application name setting.
Convenience class to initialize database connection parameters from URL-like strings and/or applicati...
CSDB_ConnectionParam & Set(EParam param, const string &value, TSetFlags flags=0)
Set one of the "essential" database connection parameters, unless overridden in a configuration file.
static CRef< CSDB_Decryptor > GetGlobalDecryptor(void)
Get the current password decryptor, if any.
@ eService
Named service, interfaces-file alias, or raw server name, per http://ncbi.github.io/cxx-toolkit/pages...
@ eConnPoolAllowTempOverflow
@ ePort
DB server's port (when not using an alias or named service)
@ eContinueAfterRaiserror
void x_FillParamMap(void)
Populate m_ParamMap according to the current server or service name.
void x_FillLowerParams(CDBConnParamsBase *params) const
Fill parameters for low-level DBAPI from what is set here and in the configuration file.
static void SetGlobalDecryptor(CRef< CSDB_Decryptor > decryptor)
Use the specified password decryptor.
CUrl m_Url
URL storing all parameters set in code.
void x_FillBoolParam(CDBConnParamsBase *params, const string &name, EParam id) const
string ComposeUrl(TComposeUrlFlags flags=0) const
Compose database connection URL string out of this class.
static bool x_IsKnownArg(const string &name)
@ fThrowIfIncomplete
Throw an exception if missing any "essential" parameters.
string x_GetPassword() const
Determine what password to use, accounting for possible encryption or indirection.
void x_ReportOverride(const CTempString &name, CTempString code_value, CTempString reg_value) const
static const char * x_GetName(EParam param)
string Get(EParam param, EWithOverrides with_overrides=eWithoutOverrides) const
Get one of the "essential" database connection parameters.
void x_InitErrCode(CException::EErrCode err_code) override
Helper method for initializing error code.
void x_Init(const CDiagCompileInfo &info, const string &message, const CException *prev_exception, EDiagSev severity) override
Helper method for initializing exception data.
Database password decryptor.
virtual string x_GetKey(const CTempString &key_id)
virtual string x_Decrypt(const string &ciphertext, const string &key)
Exception class used throughout the API.
virtual const char * GetErrCodeString(void) const override
Translate from the error code value to its string representation.
void x_Assign(const CException &src) override
Helper method for copying exception data.
void x_Init(const CDiagCompileInfo &info, const string &message, const CException *prev_exception, EDiagSev severity) override
Helper method for initializing exception data.
CConstRef< CDB_Exception::SContext > m_Context
virtual ERetriable GetRetriable(void) const override
Retrieve info about ability to retry an action caused the exception.
@ eOutOfBounds
Conversion of string to integer type exceeded limits of requested type.
@ eWrongParams
Wrong parameters provided to the method.
@ eLowLevel
Exception from low level DBAPI was re-thrown with this exception class.
@ eInconsistent
Operation logically incorrect is attempted to be made (increase past end() iterator,...
@ eStarted
CBulkInsert has already started to send data, no changes in meta-information can be made.
@ eNotExist
Field/parameter with given name/position does not exist.
@ eClosed
CDatabase/CQuery/CBulkInsert is tried to be used when no connection is opened.
@ eURLFormat
Incorrectly formated URL is used to create CSDB_ConnectionParam.
@ eUnsupported
Unsupported data type conversion is requested.
@ eNotInOrder
Columns cannot be bound to CBulkInsert randomly.
void ReportExtra(ostream &os) const override
Report "non-standard" attributes.
bool HandleIt(CDB_Exception *ex)
Handle the exceptions resulting from a native API call, one-by-one.
bool HandleMessage(int severity, int msgnum, const string &message)
Handle message resulting from a native API call.
static const TFlags kDefaults
@ fIsText
(N)TEXT or (N)VARCHAR(MAX)
@ fLogBlobs
Enable server-side logging.
@ fPreallocated
Don't create rows or clean up excess rows.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
CTimeout â Timeout interval.
CUpdMirrorServerParams(const CDBConnParams &other)
virtual string GetServerName(void) const
virtual string GetPassword(void) const
virtual EEncoding GetEncoding(void) const
virtual string GetUserName(void) const
virtual Uint4 GetHost(void) const
const CDBConnParams & m_Other
~CUpdMirrorServerParams(void)
virtual string GetParam(const string &key) const
Parameters, which are not listed above explicitly, should be retrieved via SetParam() method.
virtual CRef< IConnValidator > GetConnValidator(void) const
virtual EServerType GetServerType(void) const
virtual Uint4 GetProtocolVersion(void) const
virtual string GetDatabaseName(void) const
virtual Uint2 GetPort(void) const
Writer-based output stream.
virtual CBlobBookmark GetBookmark(void) const
virtual CNcbiOstream * GetOStream(size_t blob_size, TBlobOStreamFlags flags) const
virtual string GetDatabaseName(void) const
virtual string GetParam(const string &key) const
Parameters, which are not listed above explicitly, should be retrieved via SetParam() method.
virtual string GetServerName(void) const
size_t CloseConnsForPool(const string &pool_name, Uint4 keep_host_ip=0, Uint2 keep_port=0)
void ReadDBConfParams(const string &service_name, SDBConfParams *params)
bool SatisfyPoolMinimum(const CDBConnParams ¶ms)
container_type::const_iterator const_iterator
container_type::iterator iterator
const_iterator end() const
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
#define DBLB_INSTALL_DEFAULT()
Easy-to-use macro to install the default DBAPI service mapper.
static CS_CONNECTION * conn
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static const char table_name[]
static const column_t columns[]
ETriState
Enumeration to represent a tristate value.
void reset(element_type *p=0, EOwnership ownership=eTakeOwnership)
Reset will delete the old pointer (if owned), set content to the new value, and assume the ownership ...
ERetriable
Can the action be retried?
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define ERASE_ITERATE(Type, Var, Cont)
Non-constant version with ability to erase current element, if container permits.
element_type * get(void) const
Get pointer.
@ eRetriable_Unknown
It is unknown if the action can succeed if retried.
@ eRetriable_No
It makes no sense to retry the action.
@ eTakeOwnership
An object can take ownership of another.
@ eNoOwnership
No ownership is assumed.
virtual bool Next()=0
Get next row.
virtual string GetName(const CDBParamVariant ¶m) const =0
Get name of column.
virtual void Complete()=0
Complete batch.
virtual const CVersionInfo & GetVersionInfo() const =0
virtual void SetTimeout(size_t nof_secs)=0
Set connection timeout.
void SetApplicationName(const string &app_name)
virtual void SetParam(const CVariant &v, const CDBParamVariant ¶m)=0
Set input/output parameter.
virtual bool HasMoreResults()=0
Check for more results available.
virtual void Execute()=0
Execute stored procedure.
virtual void Close()=0
Close connecti.
virtual const IResultSetMetaData * GetMetaData(EOwnership ownership=eNoOwnership)=0
Get Metadata.
virtual void SetOutputParam(const CVariant &v, const CDBParamVariant ¶m)=0
Set output parameter, which will be returned as resultset.
virtual CDB_Connection * GetCDB_Connection()=0
Returns the internal driver connection object.
virtual void AddOrderHint(CTempString columns)=0
Add "ORDER" hint.
virtual void StoreBatch()=0
Store batch of rows.
virtual EDB_ResType GetResultType()=0
Get result type.
virtual EDB_Type GetType(const CDBParamVariant ¶m) const =0
Get data type for column in the resultset.
virtual void Bind(const CDBParamVariant ¶m, CVariant *v)=0
Bind column.
EHints
Type of hint that can be set.
virtual IStatement * GetStatement()=0
Get statement object for regular SQL queries.
virtual void PurgeResults()=0
Purge results.
virtual void ClearParamList()=0
Clear parameter list.
virtual unsigned int GetTotalColumns()=0
Get total columns.
virtual const CVariant & GetVariant(const CDBParamVariant ¶m)=0
Retrieve a CVariant class describing the data stored in a given column.
virtual I_DriverContext * GetDriverContext()=0
Returns the pointer to the general driver interface.
virtual ICallableStatement * GetCallableStatement(const string &proc)=0
Get callable statement object for stored procedures.
virtual void SetParam(const CVariant &v, const CDBParamVariant ¶m)=0
Set input parameters.
virtual void SetHints(CTempString hints)=0
Set hints by one call. Resets everything that was set by Add*Hint().
virtual void AddHint(EHints hint, unsigned int value=0)=0
Add hint with value.
virtual void Close()=0
Close statement.
virtual IBulkInsert * GetBulkInsert(const string &table_name)=0
Create bulk insert object.
virtual int GetReturnStatus()=0
Get return status from the stored procedure.
virtual void AddRow()=0
Add row to the batch.
virtual void Cancel()=0
Cancel bulk insert.
string GetApplicationName(void) const
virtual IConnection * CreateConnection(EOwnership ownership=eNoOwnership)=0
virtual void SendSql(const string &sql)=0
Sends one or more SQL statements to the SQL server.
void DBAPI_RegisterDriver_FTDS(void)
void DBAPI_RegisterDriver_FTDS14(void)
void DBAPI_RegisterDriver_FTDS100(void)
IDataSource * MakeDs(const CDBConnParams ¶ms, const string &tag=kEmptyStr)
IDataSource * CreateDs(const string &driver_name, const map< string, string > *attr=0, const string &tag=kEmptyStr)
static CDriverManager & GetInstance()
const SContext & GetContext(void) const
virtual bool HandleMessage(int severity, int msgnum, const string &message)
Handle message resulting from a native API call.
virtual bool HandleIt(CDB_Exception *ex)
Handle the exceptions resulting from a native API call, one-by-one.
void UpdateFrom(const SContext &ctx)
bool IsPositional(void) const
virtual EEncoding GetEncoding(void) const =0
virtual EServerType GetServerType(void) const =0
virtual string GetPassword(void) const =0
virtual Uint4 GetProtocolVersion(void) const =0
virtual Uint4 GetHost(void) const =0
unsigned int GetPosition(void) const
virtual Uint2 GetPort(void) const =0
virtual CRef< IConnValidator > GetConnValidator(void) const =0
virtual string GetUserName(void) const =0
const string & GetName(void) const
virtual string GetParam(const string &key) const =0
Parameters, which are not listed above explicitly, should be retrieved via SetParam() method.
virtual void PopMsgHandler(CDB_UserHandler *h)
Remove the message handler (and all above it) from the stack.
static bool IsBlobType(EDB_Type db_type)
static CTimeFormat GetTimeFormat(ESyntax syntax, ESQLType sql_type=eDateTime, TOffset offset=null)
static const char * GetTypeName(EDB_Type db_type, bool throw_on_unknown=true)
static pair< ESyntax, ESQLType > Identify(const CTempString &s)
I_BlobDescriptor & GetBlobDescriptor(void) const
double GetDouble(void) const
Uint1 GetByte(void) const
static CVariant VarBinary(const void *p, size_t len)
string GetString(void) const
size_t Append(const void *buf, size_t len)
float GetFloat(void) const
I_BlobDescriptor * ReleaseBlobDescriptor(void) const
void Truncate(size_t len=kMax_UInt)
const CTime & GetCTime(void) const
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
#define ERR_POST_X_ONCE(err_subcode, message)
Error posting only once during program execution with default error code and given error subcode.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Info
Informational message.
@ eDiag_Error
Error message.
void AddPrevious(const CException *prev_exception)
void Critical(CExceptionArgs_Base &args)
TErrCode GetErrCode(void) const
Get error code.
#define STD_CATCH_ALL_X(err_subcode, message)
Standard handling of "exception"-derived exceptions; catches non-standard exceptions and generates "u...
#define NCBI_ERRNO_CODE_WRAPPER
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define NCBI_ERRNO_STR_WRAPPER
void Warning(CExceptionArgs_Base &args)
virtual void x_Assign(const CException &src)
Helper method for copying exception data.
EErrCode
Error types that an application can generate.
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
virtual ERetriable GetRetriable(void) const
Retrieve info about ability to retry an action caused the exception.
const CException * GetPredecessor(void) const
Get "previous" exception from the backlog.
void Info(CExceptionArgs_Base &args)
bool Empty(void) const THROWS_NONE
Check if CConstRef is empty â not pointing to any object which means having a null value.
TObjectType * GetNCPointer(void) const THROWS_NONE
Get pointer,.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
void Reset(void)
Reset reference object.
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty â pointing to an object and has a non-null value.
bool ReferencedOnlyOnce(void) const THROWS_NONE
Check if object is referenced only once.
uint8_t Uint1
1-byte (8-bit) unsigned integer
int16_t Int2
2-byte (16-bit) signed integer
int32_t Int4
4-byte (32-bit) signed integer
#define NCBI_RESUME_DEPRECATION_WARNINGS
uint32_t Uint4
4-byte (32-bit) unsigned integer
#define NCBI_SUSPEND_DEPRECATION_WARNINGS
static const SAutoMax kMax_Auto
Generic stand-in for type-specific kMax_* constants from ncbi_limits.h, useful in any context with ex...
uint16_t Uint2
2-byte (16-bit) unsigned integer
int64_t Int8
8-byte (64-bit) signed integer
virtual void EnumerateSections(list< string > *sections, TFlags flags=fAllLayers) const
Enumerate section names.
virtual string GetString(const string §ion, const string &name, const string &default_value, TFlags flags=0) const
Get the parameter string value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
CNcbiIstream & NcbiGetline(CNcbiIstream &is, string &str, char delim, string::size_type *count=NULL)
Read from "is" to "str" up to the delimiter symbol "delim" (or EOF)
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static bool StringToBool(const CTempString str)
Convert string to bool.
static string Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 to string.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
char16_t TCharUCS2
Type for character in UCS-2 encoding.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
static Int8 StringToInt8(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to Int8.
static double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)
Convert string to double.
static const string BoolToString(bool value)
Convert bool to string.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static CStringUTF8 AsUTF8(const CTempString &src, EEncoding encoding, EValidate validate=eNoValidate)
Convert into UTF8 from a C/C++ string.
basic_string< TCharUCS2 > TStringUCS2
Type for string in UCS-2 encoding.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static int CompareCase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-sensitive compare of a substring with another string.
string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const
Transform time to string.
void GetNano(unsigned int *sec, unsigned int *nanosec) const
Get timeout in seconds and nanoseconds.
@ eDefault
Default timeout (to be interpreted by the client code)
const string & GetHost(void) const
const CUrlArgs & GetArgs(void) const
Get const list of arguments.
const string & GetPassword(void) const
bool HaveArgs(void) const
Check if the URL contains any arguments.
const TArgs & GetArgs(void) const
Get the const list of arguments.
const string & GetPath(void) const
const string & GetPort(void) const
const string & GetUser(void) const
void SetPassword(const string &value)
string ComposeUrl(CUrlArgs::EAmpEncoding amp_enc, const IUrlEncoder *encoder=0) const
Compose the URL.
@ eAmp_Char
Use & to separate arguments.
int GetMajor(void) const
Major version.
int GetMinor(void) const
Minor version.
operation
Bit operations.
Definition of all error codes used in dbapi libraries (dbapi_driver.lib and others).
static const string kDefault
use only n Cassandra database for the lookups</td > n</tr > n< tr > n< td > yes</td > n< td > do not use tables BIOSEQ_INFO and BLOB_PROP in the Cassandra database
const TYPE & Get(const CNamedParameterList *param)
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
CRYPT_Key CRYPT_Init(const char *key)
char * CRYPT_DecodeString(const CRYPT_Key key, const char *ciphertext)
struct SCRYPT_KeyTag * CRYPT_Key
void CRYPT_Free(CRYPT_Key key)
Static variables safety - create on demand, destroy on application termination.
std::istream & in(std::istream &in_, double &x_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static wxString GetContext(const wxString &str, int pos)
#define SDBAPI_CATCH_LOWLEVEL()
static IDataSource * s_GetDataSource(void)
static CSimpleBlobStore::TFlags s_TranslateBlobStoreFlags(TNewBlobStoreFlags flags)
#define COPY_BOOL_PARAM(en, gn, fn)
#define COPY_NUM_PARAM(en, gn, fn)
static impl::CDriverContext * s_GetDBContext(void)
DEFINE_STATIC_FAST_MUTEX(s_DecryptorMutex)
CBulkInsert & EndRow(CBulkInsert &bi)
Manipulator ending row in the bulk-insert object.
static CSafeStatic< CDB_Exception::SContext > kEmptyContext
static CSafeStatic< CRef< CSDB_Decryptor > > s_Decryptor
static void s_ConvertionNotSupported(const char *one_type, EDB_Type other_type)
#define COPY_PARAM_EX(en, gn, fn)
CBulkInsert & NullValue(CBulkInsert &bi)
Manipulator putting null value into the bulk-insert row.
#define CONVERTVALUE_STATIC
static AutoPtr< char, CDeleter< char > > s_DriverName
static bool s_DecryptorInitialized
list< AutoPtr< SMirrorServInfo > > TMirrorServList
#define CONNECT_AS_NEEDED()
static IBulkInsert::EHints s_ConvertHints(CBulkInsert::EHintsWithValue hints)
#define COPY_PARAM(en, fn)
static void s_ConvertValue(const CTime &from_val, CVariant &to_var)
static CSafeStatic< CDataSourceInitializer > ds_init
static CSafeStatic< TMirrorsDataMap > s_MirrorsData
static const char kDefaultDriverName[]
static ECompressMethod s_CheckCompressionFlags(TNewBlobStoreFlags flags)
map< string, SMirrorInfo > TMirrorsDataMap
#define SDBAPI_THROW(code, msg)
CAutoTrans::CSubject DBAPI_MakeTrans(CDatabase &db)
(S)DBAPI_TRANSACTION glue for CDatabase.
static EDB_Type s_ConvertType(ESDB_Type type)
@ fNBS_IsText
Blobs have type TEXT or [N]VARCHAR(MAX)
@ fNBS_ZLib
Use zlib (gzip) compression.
@ fNBS_BZLib
Use bzlib (bzip2) compression.
@ fNBS_Preallocated
Don't create rows or clean up any excess.
@ fNBS_LogIt
Enable transaction logs.
ESDB_Type
Database types used throughout API.
@ eSDB_BigDateTime
Like Transact-SQL DATETIME2 (MS) or BIGDATETIME (Syb)
@ eSDB_String
Like Transact-SQL VARCHAR(N)
@ eSDB_Double
Like Transact-SQL DOUBLE (64-bit floating point value)
@ eSDB_TextUCS2
Like Transact-SQL NTEXT.
@ eSDB_StringUCS2
Like Transact-SQL NVARCHAR(N)
@ eSDB_BinaryMax
Like Transact-SQL VARBINARY(MAX)
@ eSDB_StringMaxUCS2
Like Transact-SQL NVARCHAR(MAX)
@ eSDB_Text
Like Transact-SQL TEXT.
@ eSDB_DateTime
Like Transact-SQL DATETIME.
@ eSDB_Int4
Like Transact-SQL INT (signed 32-bit integer)
@ eSDB_Binary
Like Transact-SQL VARBINARY(N)
@ eSDB_Bit
Like Transact-SQL BIT.
@ eSDB_Image
Like Transact-SQL IMAGE.
@ eSDB_Float
Like Transact-SQL REAL (32-bit floating point value)
@ eSDB_Int8
Like Transact-SQL BIGINT (signed 64-bit integer)
@ eSDB_Short
Like Transact-SQL SMALLINT (signed 16-bit integer)
@ eSDB_StringMax
Like Transact-SQL VARCHAR(MAX)
@ eSDB_Byte
Like Transact-SQL BYTE (unsigned 8-bit integer)
ESP_ParamType
Stored procedure and statement parameter types.
@ eSP_InOut
Parameter can be returned from stored procedure.
#define row(bind, expected)
AutoPtr< CDBConnParamsBase > conn_params
AutoPtr< IConnection > conn
bool IsPasswordFileSet(void)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4