message.message, severity)
227 #define SDBAPI_TRANSACTION(obj) DBAPI_TRANSACTION(obj) 273 unsigned char AsByte(
void)
const;
307 bool AsBool(
void)
const;
322 constvector<unsigned char>&
AsVector(
void)
const;
325 bool IsNull(
void)
const;
444 unsigned int GetRowNo(
void)
const;
502 const string&
value,
528 #if !NCBI_INT8_IS_LONG 547 unsigned char value,
730CRowIterator
begin(
void)
const;
738CRowIterator
end(
void)
const;
874 #if !NCBI_INT8_IS_LONG 925 virtual string x_Decrypt(
const string& ciphertext,
const string&
key);
1142 static bool Init(
void);
1195list<string>* servers =
NULL,
1196 string* error_message =
NULL);
1213TNewBlobStoreFlags
flags 1214= TNewBlobStoreFlags(0),
1215 size_timage_limit = 1 << 24);
1265 void Close(
void);
1313 const string& column_name,
1314 const string& search_conditions,
1332TNewBlobStoreFlags
flags 1333= TNewBlobStoreFlags(0),
1334 size_timage_limit = 1 << 24);
1356 const string& key_col_name,
1357 const string& num_col_name,
1358 constvector<string> blob_col_names,
1359TNewBlobStoreFlags
flags 1360= TNewBlobStoreFlags(0),
1361 size_timage_limit = 1 << 24);
1392 x_Init(
info, message, prev_exception, severity);
1440 #if !NCBI_INT8_IS_LONG 1460 if(url_string.empty()) {
1478: m_Url(param.m_Url), m_ParamMap(param.m_ParamMap)
1510 case ePort:
return "port";
1522 return "allow_temp_overflow";
1524 return "continue_after_raiserror";
1526 return "conn_pool_max_conn_use";
1568 boolfound =
false;
1572 "Password and password_file URL parameters" 1573 " are mutually exclusive.");
1593 boolfound_dummy =
false;
1726 returnoperator++();
Helper class to allow safe initialization from higher-layer objects.
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).
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.
friend CBulkInsert & EndRow(CBulkInsert &bi)
Manipulator ending row in the bulk-insert object.
void Complete()
Complete bulk insert.
void Bind(int col, ESDB_Type type)
Bind column for bulk insert.
friend CBulkInsert & NullValue(CBulkInsert &bi)
Manipulator putting null value into the bulk-insert row.
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)
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.
CSDB_ConnectionParam & GetConnectionParam(void)
Get connection parameters.
void x_ConnectAsNeeded(const char *operation)
CDatabase(void)
Empty constructor of database object.
friend CAutoTrans::CSubject DBAPI_MakeTrans(CDatabase &db)
(S)DBAPI_TRANSACTION glue for CDatabase.
Incapsulate compile time information such as __FILE__, __LINE__, NCBI_MODULE, current function.
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.
CRef< CQueryFieldImpl > m_Impl
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.
input_iterator_tag iterator_category
unsigned int GetTotalColumns(void) const
Get number of columns in the current result set.
bool operator!=(const CRowIterator &ri) const
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).
@ eEnableLog
Enables log.
@ 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 ...
CRowIterator const_iterator
friend CAutoTrans::CSubject DBAPI_MakeTrans(CQuery &query)
(S)DBAPI_TRANSACTION glue for CQuery.
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 & SetOutputParameter(CTempString name, ESDB_Type type)
Declare an output-only parameter.
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)
@ 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(const string &url_string=kEmptyStr)
Get database connection parameters from a string and from the application configuration.
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.
const CUrlArgs & GetArgs(void) const
Access to additional (e.g.
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.
ESetFlags
Flags affecting parameter setting.
@ fAsDefault
The specified value is merely a default, which Set should ignore if a non-empty setting for that para...
CUrl m_Url
URL storing all parameters set in code.
void x_FillBoolParam(CDBConnParamsBase *params, const string &name, EParam id) const
map< EParam, string > TParamMap
Map of any parameters set in the configuration file, which override those set in code.
string ComposeUrl(TComposeUrlFlags flags=0) const
Compose database connection URL string out of this class.
EWithOverrides
Whether to report values from configuration files, or just those set in code (which have a lower prio...
static bool x_IsKnownArg(const string &name)
EComposeUrlFlags
Flags affecting URL composition.
@ eThrowIfIncomplete
Obscure passwords.
@ 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)
CSDB_ConnectionParam & operator=(const CSDB_ConnectionParam ¶m)
Assignment.
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.
NCBI_EXCEPTION_DEFAULT(CSDB_DeadlockException, CSDB_Exception)
Database password decryptor.
virtual string x_GetKey(const CTempString &key_id)
virtual string x_Decrypt(const string &ciphertext, const string &key)
string Decrypt(const string &ciphertext, const CTempString &key_id)
Exception class used throughout the API.
const string & GetExtraMsg(void) const
Returns any additional context (typically, the relevant SQL statement or database operation).
virtual const char * GetErrCodeString(void) const override
Translate from the error code value to its string representation.
const char * GetDBErrCodeString(void) const
Returns any underlying DBAPI error code string, or else "eInvalid".
const string & GetDatabaseName(void) const
const string & GetServerName(void) const
CDB_Exception::TErrCode GetDBErrCode(void) const
Returns any underlying DBAPI error code, or else CException::eInvalid.
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.
CSDB_Exception(const CDiagCompileInfo &info, const CException *prev_exception, const CExceptionArgs< EErrCode > &args, const CDB_Exception::SMessageInContext &message)
const string & GetUserName(void) const
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.
const CDB_Exception * GetDBException(void) const
Returns any underlying DBAPI exception, or else NULL.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
CTimeout â Timeout interval.
container_type::const_iterator const_iterator
const_iterator end() const
const_iterator find(const key_type &key) const
Defines the database API innterfaces for a variety of DBMS.
static const char table_name[]
static const column_t columns[]
ETriState
Enumeration to represent a tristate value.
ERetriable
Can the action be retried?
@ eTriState_Unknown
The value is indeterminate.
@ eRetriable_No
It makes no sense to retry the action.
virtual const char * GetErrCodeString(void) const override
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Error
Error message.
TErrCode GetErrCode(void) const
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
TSeverity GetSeverity(void) const
virtual void x_InitErrCode(CException::EErrCode err_code)
Helper method for initializing error code.
EErrCode
Error types that an application can generate.
EDiagSev GetSeverity(void) const
Get exception severity.
#define NCBI_EXCEPTION_DEFAULT_IMPLEMENTATION(exception_class, base_class)
Helper macro for default exception implementation.
virtual void x_InitArgs(const CExceptionArgs_Base &args)
Process additional arguments.
const CException * GetPredecessor(void) const
Get "previous" exception from the backlog.
@ eInvalid
To be used ONLY as a return value; please, NEVER throw an exception with this code.
int32_t Int4
4-byte (32-bit) signed integer
int64_t Int8
8-byte (64-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
basic_string< TCharUCS2 > TStringUCS2
Type for string in UCS-2 encoding.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
const char *const kEmptyCStr
Empty "C" string (points to a '\0').
@ eDefault
Default timeout (to be interpreted by the client code)
const string & GetHost(void) const
void SetUser(const string &value)
const CUrlArgs & GetArgs(void) const
Get const list of arguments.
void SetPath(const string &value)
const string & GetPassword(void) const
const string & GetOriginalArgsString(void) const
Get the original (unparsed and undecoded) query string.
bool IsSetValue(const string &name) const
Check if an argument with the given name exists.
const TArgs & GetArgs(void) const
Get the const list of arguments.
const string & GetPath(void) const
void SetQueryString(const string &query, NStr::EUrlEncode encode)
Parse query string, call AddArgument() to store each value.
const string & GetPort(void) const
void SetPort(const string &value)
const string & GetValue(const string &name, bool *is_found=0) const
Get value for the given name.
void SetUrl(const string &url, const IUrlEncoder *encoder=0)
Parse the URL.
const string & GetUser(void) const
void SetValue(const string &name, const string &value)
Set new value for the first argument with the given name or add a new argument.
void SetHost(const string &value)
void SetIsGeneric(bool value)
void SetPassword(const string &value)
void SetScheme(const string &value)
operation
Bit operations.
Definition of all error codes used in dbapi libraries (dbapi_driver.lib and others).
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
Defines: CTimeFormat - storage class for time format.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
Reader-writer based streams.
ENewBlobStoreFlags
Flags for NewBlobStore methods.
@ 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.
DECLARE_SAFE_FLAGS_TYPE(ENewBlobStoreFlags, TNewBlobStoreFlags)
CBulkInsert & EndRow(CBulkInsert &bi)
Manipulator ending row in the bulk-insert object.
CBulkInsert & NullValue(CBulkInsert &bi)
Manipulator putting null value into the bulk-insert row.
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)
DECLARE_SAFE_FLAGS(ENewBlobStoreFlags)
ESP_ParamType
Stored procedure and statement parameter types.
@ eSP_InOut
Parameter can be returned from stored procedure.
@ eSP_In
Parameter is only passed to server, no return is expected.
CAutoTrans::CSubject DBAPI_MakeTrans(CDatabase &db)
(S)DBAPI_TRANSACTION glue for CDatabase.
static CS_CONTEXT * context
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