A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/dbapi__simple__common_8cpp_source.html below:

NCBI C++ ToolKit: src/sample/app/dbapi/dbapi_simple_common.cpp Source File

65 #define NCBI_USE_ERRCODE_X DbapiSimpleSproc 255  string

proc_name(

"dbapi_simple_sproc"

);

260

cstmt->SetParam(

CVariant

(5),

"@max_id"

);

261

cstmt->SetParam(

CVariant

(5.1f),

"@max_fl"

);

265

cout <<

"\nExecuting stored procedure \""

<< proc_name <<

"\":"

<< endl;

272

cout <<

"\nStored procedure returned status: "

<< cstmt->GetReturnStatus() << endl;

275

cout <<

" Errors:"

<< endl;

276

cout <<

" "

<< msgs << endl;

280

cout <<

"*** Caught exception; see logfile \""

<<

m_LogFileName

<<

"\"."

<< endl;

300  string sql

(

"SELECT [title] FROM [Journal]"

);

303

cout <<

"\nExecuting static SQL \""

<<

sql

<<

"\":"

<< endl;

311

cout <<

"*** Caught exception; see logfile \""

<<

m_LogFileName

<<

"\"."

<< endl;

337  string sql

(

" SELECT [id], [last], [first], [salary], [hiredate]" 338  " FROM [Employee] WHERE [last] LIKE @last" 339  " AND [salary] > @salary" 340  " AND [hiredate] > @hire"

);

344

cstmt->SetParam(

CVariant

(user_last),

"@last"

);

345

cstmt->SetParam(

CVariant

(user_salary),

"@salary"

);

346

cstmt->SetParam(

CVariant

(user_hire),

"@hire"

);

349

cout <<

"\nExecuting parameterized SQL \""

<<

sql

<<

"\":"

<< endl;

350

cstmt->SendSql(

sql

);

356

cout <<

"*** Caught exception; see logfile \""

<<

m_LogFileName

<<

"\"."

<< endl;

395  string sql

(

" SELECT [id], [last], [first], [salary], [hiredate]" 396  " FROM [Employee] WHERE [last] LIKE "

+ user_last +

397  " AND [salary] > "

+ user_salary +

398  " AND [hiredate] > "

+ user_hire);

401

cout <<

"\nExecuting dynamic SQL \""

<<

sql

<<

"\":"

<< endl;

409

cout <<

"*** Caught exception; see logfile \""

<<

m_LogFileName

<<

"\"."

<< endl;

432  string sql

(

" SELECT [id], [last], [first], [salary], [hiredate]" 433  " FROM [Employee] WHERE [last] LIKE '"

+ user_input +

"'"

);

444

cout <<

"*** Caught exception; see logfile \""

<<

m_LogFileName

<<

"\"."

<< endl;

455  while

(

stmt

->HasMoreResults()) {

461

unique_ptr<IResultSet> rs(

stmt

->GetResultSet());

464  if

(!

stmt

->HasRows()) {

469  switch

(rs->GetResultType()) {

472

cout <<

"\nStatus results:"

<< endl;

474

cout <<

" Status: "

<< rs->GetVariant(1).GetInt4() << endl;

479

cout <<

"\nParameter results:"

<< endl;

481

cout <<

" Parameter: "

<< rs->GetVariant(1).GetInt4() << endl;

486

cout <<

"\nRow results:"

<< endl;

492

cout <<

" "

<< rsMeta->

GetName

(

i

);

503

cout <<

" "

<< rs->GetVariant(

i

).GetString();

507

cout <<

" ---------------"

<< endl;

508

cout <<

" Row count: "

<<

stmt

->GetRowCount() << endl;

CErrHandler - custom error handler.

CErrHandler(const string &type, CNcbiOfstream *log_stream)

virtual bool HandleIt(CDB_Exception *ex)

Handle the exceptions resulting from a native API call, one-by-one.

CNcbiOstream * m_LogStream

NCBI_DEFINE_ERRCODE_X(DbapiSimpleSproc, 2500, 1)

#define DBLB_INSTALL_DEFAULT()

Easy-to-use macro to install the default DBAPI service mapper.

@ eTakeOwnership

An object can take ownership of another.

virtual string GetName(const CDBParamVariant &param) const =0

Get name of column.

virtual IStatement * CreateStatement()=0

Get statement object for regular SQL queries.

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 unsigned int GetTotalColumns(void) const =0

Get total number of columns in resultset.

virtual IStatement * GetStatement()=0

Get statement object for regular SQL queries.

virtual string GetErrorInfo()=0

Returns all server messages as a single string.

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 SetLogStream(ostream *out)=0

Set the output stream for server messages.

virtual IConnection * CreateConnection(EOwnership ownership=eNoOwnership)=0

void DBAPI_RegisterDriver_FTDS(void)

IDataSource * CreateDs(const string &driver_name, const map< string, string > *attr=0, const string &tag=kEmptyStr)

static CDriverManager & GetInstance()

const char * SeverityString(void) const

virtual void PushDefConnMsgHandler(CDB_UserHandler *h, EOwnership ownership=eNoOwnership)=0

Add `per-connection' err.message handler "h" to the stack of default handlers which are inherited by ...

virtual bool SetLoginTimeout(unsigned int nof_secs=0)=0

Set login timeout.

virtual void PushCntxMsgHandler(CDB_UserHandler *h, EOwnership ownership=eNoOwnership)=0

Add message handler "h" to process 'context-wide' (not bound to any particular connection) error mess...

virtual bool SetTimeout(unsigned int nof_secs=0)=0

Set connection timeout.

#define ERR_POST_X(err_subcode, message)

Error posting with default error code and given error subcode.

@ eDiag_Error

Error message.

void Critical(CExceptionArgs_Base &args)

void Warning(CExceptionArgs_Base &args)

void Fatal(CExceptionArgs_Base &args)

void Info(CExceptionArgs_Base &args)

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

void DemoDynamicSql(void)

void DemoSqlInjection(void)

void DemoStoredProc(void)

CNcbiOfstream m_Logstream

void DemoParamerizedSql(void)

void RetrieveData(IStatement *stmt)

IO_PREFIX::ofstream CNcbiOfstream

Portable alias for ofstream.

IO_PREFIX::ostream CNcbiOstream

Portable alias for ostream.

static CStringUTF8 SQLEncode(const CStringUTF8 &str, ESqlEncode flag)

SQL-encode string.

static CStringUTF8 AsUTF8(const CTempString &src, EEncoding encoding, EValidate validate=eNoValidate)

Convert into UTF8 from a C/C++ string.

static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)

Convert UInt to string.

static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)

Convert string to unsigned int.

@ eEncoding_ISO8859_1

Note: From the point of view of the C++.

@ eSqlEnc_TagNonASCII

Produce N'...' when input's not pure ASCII.

string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const

Transform time to string.

where both of them are integers Note

#define GetArgs

Avoid preprocessor name clash with the NCBI C Toolkit.

Defines NCBI C++ diagnostic APIs, classes, and macros.


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