1 #ifndef DBAPI___DBAPI__HPP
2 #define DBAPI___DBAPI__HPP
277 size_t buf_size = 0) = 0;
282 size_t buf_size = 0);
303 size_t buf_size = 0) = 0;
309 size_t buf_size = 0);
473 size_t buf_size = 0) = 0;
478 size_t buf_size = 0);
555 virtual void SendSql(
const string& );
556 virtual void Execute(
const string& );
557 virtual void ExecuteUpdate(
const string& );
558 virtual IResultSet* ExecuteQuery(
const string& );
605 size_t buf_size = 0) = 0;
611 size_t buf_size = 0);
632 virtual IWriter* GetBlobWriter(
unsigned int col,
642 virtual void Update(
const string&
table,
const string& updateSql) = 0;
787 const string& password,
788 const string& server,
813 const string& password,
814 const string& server,
854 return GetCallableStatement(
proc);
864 return GetCursor(name,
sql, 1);
872 return GetCursor(name,
sql, batchSize);
898 return PrepareCall(
proc);
908 return CreateCursor(name,
sql, 1);
916 return CreateCursor(name,
sql, batchSize);
942 virtual size_t GetTimeout(
void)
const;
945 virtual size_t GetCancelTimeout(
void)
const;
1010 void SetApplicationName(
const string& app_name);
1011 string GetApplicationName(
void)
const;
Helper class to allow safe initialization from higher-layer objects.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
A very basic data-read interface.
A very basic data-write interface.
Abstract reader-writer interface classes.
std::ofstream out("events_result.xml")
main entry point for tests
static CS_CONNECTION * conn
static const char table_name[]
static const column_t columns[]
@ eNoOwnership
No ownership is assumed.
virtual IWriter * GetBlobWriter(unsigned int col, size_t blob_size, TBlobOStreamFlags flags=0)=0
Get Blob Writer.
virtual bool Next()=0
Get next row.
EConnMode
Which connection mode.
virtual const I_DriverContext * GetDriverContext() const =0
virtual string GetName(const CDBParamVariant ¶m) const =0
Get name of column.
virtual size_t Read(void *buf, size_t size)=0
Read unformatted data.
ICursor * GetCursor(const string &name, const string &sql)
virtual void Complete()=0
Complete batch.
virtual IResultSet * GetResultSet()=0
Get resulset.
virtual const CVersionInfo & GetVersionInfo() const =0
virtual bool Failed()=0
Check if the statement failed.
IBulkInsert * GetBulkInsert(const string &table_name, unsigned int)
virtual void SetTimeout(size_t nof_secs)=0
Set connection timeout.
IBulkInsert * CreateBulkInsert(const string &table_name, unsigned int)
virtual void DisableBind(bool b)=0
Disables column binding.
virtual void SetParam(const CVariant &v, const CDBParamVariant ¶m)=0
Set input/output parameter.
virtual CNcbiOstream & GetBlobOStream(unsigned int col, size_t blob_size, TBlobOStreamFlags flags=0, size_t buf_size=0)=0
Get output stream for BLOB updates, requires BLOB column number.
virtual void Close()=0
Close resultset.
virtual bool HasMoreResults()=0
Check for more results available.
virtual IDataSource * GetDataSource()=0
Get parent datasource object.
virtual void Execute()=0
Execute stored procedure.
virtual void Close()=0
Close connecti.
virtual IResultSet * ExecuteQuery(const string &sql)=0
Exectues SQL statement and returns the first resultset.
virtual void Execute(const string &sql)=0
Sends one or more SQL statements to the SQL server (NOTE: replaced by the SendSql())
virtual IStatement * CreateStatement()=0
Get statement object for regular SQL queries.
ICursor * CreateCursor(const string &name, const string &sql, int, int batchSize)
virtual const IResultSetMetaData * GetMetaData(EOwnership ownership=eNoOwnership)=0
Get Metadata.
virtual void Close()=0
Close.
virtual void SetOutputParam(const CVariant &v, const CDBParamVariant ¶m)=0
Set output parameter, which will be returned as resultset.
virtual void ConnectValidated(IConnValidator &validator, const string &user, const string &password, const string &server, const string &database=kEmptyStr)=0
Connect to a database using connect validator.
virtual const IResultSetMetaData & GetParamsMetaData(void)=0
Get input parameters metadata.
virtual void MsgToEx(bool v)=0
If enabled, redirects all error messages to CDB_MultiEx object (see below).
virtual CDB_Connection * GetCDB_Connection()=0
Returns the internal driver connection object.
virtual IBulkInsert * CreateBulkInsert(const string &table_name)=0
Create bulk insert 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 CNcbiIstream & GetBlobIStream(size_t buf_size=0)=0
Get Blob input stream.
virtual void SetMode(EConnMode mode)=0
Set connection mode.
virtual ICallableStatement * PrepareCall(const string &proc)=0
Get callable statement object for stored procedures.
virtual string GetErrorInfo()=0
Returns all error messages as a single string.
virtual void Update(const string &table, const string &updateSql)=0
Update statement for cursor.
virtual void ResetMode(EConnMode mode)=0
Reset connection mode.
virtual int GetRowCount()=0
Get total of rows returned.
virtual CNcbiOstream & GetBlobOStream(I_BlobDescriptor &d, size_t blob_size, TBlobOStreamFlags flags=0, size_t buf_size=0)=0
Get an ostream for writing BLOBs using previously created CDB_BlobDescriptor.
virtual EDB_Type GetType(const CDBParamVariant ¶m) const =0
Get data type for column in the resultset.
virtual bool IsAlive()=0
Check if the connection is alive.
virtual void Abort()=0
Abort connection.
virtual IReader * GetBlobReader()=0
Get a Blob Reader.
virtual IConnection * CloneConnection(EOwnership ownership=eNoOwnership)=0
Clone existing connection.
virtual void SetLoginTimeout(unsigned int i)=0
Set login timeout.
ICallableStatement * GetCallableStatement(const string &proc, int)
virtual CDB_MultiEx * GetErrorAsEx()=0
Returns all server messages as a CDB_MultiEx object.
virtual unsigned int GetTotalColumns(void) const =0
Get total number of columns in 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 string GetErrorInfo()=0
Returns all server messages as a single string.
virtual ICursor * GetCursor(const string &name, const string &sql, int batchSize)=0
Get cursor object.
virtual void ForceSingle(bool enable)=0
Force single connection mode, default false.
virtual unsigned int GetTotalColumns()=0
Get total columns.
virtual void BindBlobToVariant(bool b)=0
Bind blob to variant.
ICallableStatement * PrepareCall(const string &proc, int)
virtual const CVariant & GetVariant(const CDBParamVariant ¶m)=0
Retrieve a CVariant class describing the data stored in a given column.
virtual string GetDatabase()=0
Get current database.
virtual I_DriverContext * GetDriverContext()=0
Returns the pointer to the general driver interface.
ICursor * CreateCursor(const string &name, const string &sql)
virtual ICallableStatement * GetCallableStatement(const string &proc)=0
Get callable statement object for stored procedures.
virtual ICursor * CreateCursor(const string &name, const string &sql, int batchSize)=0
Get cursor object.
virtual int GetMaxSize(const CDBParamVariant ¶m) const =0
Get maximum size in bytes for column.
virtual void ExecuteUpdate()=0
Executes stored procedure no results returned.
virtual void ExecuteLast()=0
Executes the last command (with changed parameters, if any).
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 CDB_MultiEx * GetErrorAsEx()=0
Returns all error messages as a CDB_MultiEx object.
virtual void AddHint(EHints hint, unsigned int value=0)=0
Add hint with value.
virtual bool WasNull()=0
Determine if last column was NULL.
virtual void Cancel()=0
Cancel cursor.
ICursor * GetCursor(const string &name, const string &sql, int, int batchSize)
virtual void SetAutoClearInParams(bool flag=true)=0
Set auto-clear input parameter flag.
virtual void Close()=0
Close statement.
virtual class IConnection * GetParentConn()=0
Get the parent connection.
virtual IResultSet * Open()=0
Open cursor and get corresponding resultset.
virtual void Connect(const string &user, const string &password, const string &server, const string &database=kEmptyStr)=0
Connect to a database.
virtual IBulkInsert * GetBulkInsert(const string &table_name)=0
Create bulk insert object.
virtual void Connect(const CDBConnParams ¶ms)=0
Connect to a database.
virtual class IConnection * GetParentConn()=0
Get the parent connection.
virtual void SetDatabase(const string &name)=0
Set current database.
virtual IWriter * GetBlobWriter(I_BlobDescriptor &d, size_t blob_size, TBlobOStreamFlags flags=0)=0
Get a writer for writing BLOBs using previously created CDB_BlobDescriptor.
virtual int GetReturnStatus()=0
Get return status from the stored procedure.
virtual void Close()=0
Close cursor.
virtual bool HasRows()=0
Check if resultset has rows.
virtual void Delete(const string &table)=0
Delete statement for cursor.
virtual bool IsAutoClearInParams(void) const =0
Get auto-clear input parameter flag value.
virtual void Cancel()=0
Cancel statement.
virtual void AddRow()=0
Add row to the batch.
virtual unsigned int GetModeMask()=0
Get mode mask.
virtual void Cancel()=0
Cancel bulk insert.
virtual void SetParam(const CVariant &v, const CDBParamVariant ¶m)=0
Set input parameter.
virtual int GetColumnNo()=0
Get column number, currently available for Read()
virtual void SetCancelTimeout(size_t)
Set timeout for command cancellation and connection closing.
virtual CNcbiOstream & GetBlobOStream(IConnection *conn, size_t blob_size, TBlobOStreamFlags flags=0, size_t buf_size=0)=0
Get Blob output stream with explicit additional connection.
virtual CDBParams::EDirection GetDirection(const CDBParamVariant ¶m) const =0
Get parameter's direction (in/out/inout).
virtual void SetLogStream(ostream *out)=0
Set the output stream for server messages.
CAutoTrans::CSubject DBAPI_MakeTrans(IConnection &connection)
virtual void ExecuteUpdate(const string &sql)=0
Executes SQL statement with no results returned.
virtual IConnection * CreateConnection(EOwnership ownership=eNoOwnership)=0
virtual CNcbiOstream & GetBlobOStream(size_t blob_size, TBlobOStreamFlags flags=0, size_t buf_size=0)=0
Get Blob output stream.
virtual void SendSql(const string &sql)=0
Sends one or more SQL statements to the SQL server.
EBlobOStreamFlags
EBlobOStreamFlags –.
@ eDisableLog
Disables log.
@ fBOS_UseTransaction
Use a (sub)transaction (committed once all data's been sent successfully, rolled back for unrecoverab...
#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.
enum ENcbiOwnership EOwnership
Ownership relations between objects.
#define NCBI_DBAPI_EXPORT
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
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
string Execute(const string &cmmd, const vector< string > &args, const string &data=kEmptyStr)
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.