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/python__ncbi__dbapi_8cpp_source.html below:

NCBI C++ ToolKit: src/dbapi/lang_bind/python/python_ncbi_dbapi.cpp Source File

44 #include "../../ds_impl.hpp" 48 #if defined(NCBI_OS_CYGWIN) 50 #elif !defined(NCBI_OS_MSWIN) 55 #define PYTHONPP_DEFINE_GLOBALS 1 58 #if PY_VERSION_HEX >= 0x02040000 62 #include <structmember.h> 71 #if PY_MAJOR_VERSION >= 3 72 # define PYDBAPI_MOD_RETURN return 73 # define PYDBAPI_MODINIT_FUNC(name) \ 74  PyMODINIT_FUNC NCBI_NAME2(PyInit_,name)(void) 76 # define PYDBAPI_MOD_RETURN 77 # define PYDBAPI_MODINIT_FUNC(name) PyMODINIT_FUNC NCBI_NAME2(init,name)(void) 80 #ifndef PYDBAPI_SUPPORT_DIR 81 # define PYDBAPI_SUPPORT_DIR "python_ncbi_dbapi/"

NCBI_PACKAGE_VERSION

84 #define NCBI_USE_ERRCODE_X Dbapi_Python 97 static

PyObject*

SetLogger

(PyObject *

self

, PyObject *args);

118  virtual bool Next

(

void

) = 0;

151  virtual bool Next

(

void

);

169

: m_ResType(other.GetResultType())

170

, m_ColumsNum(other.GetTotalColumns())

174  while

(other.

Next

()) {

176

TRecordSet::reference record =

m_RecordSet

.back();

178  for

(

unsigned int

col = 1; col <=

m_ColumsNum

; ++col) {

255  virtual bool Next

(

void

);

316  virtual bool HasRS

(

void

)

const

;

399  virtual bool HasRS

(

void

)

const

;

413  while

(

stmt

.HasMoreResults()) {

414  if

(

stmt

.HasRows()) {

415

unique_ptr<IResultSet> rs(

stmt

.GetResultSet());

532

: m_UserFmt(user_fmt)

600

string::size_type pos = 0;

601

string::size_type prev_pos = pos;

603  if

((pos =

m_StmtStr

.find(

'?'

, pos)) != string::npos) {

607  while

(pos != string::npos) {

608

tmp_stmt +=

m_StmtStr

.substr(prev_pos, pos - prev_pos);

621

string::size_type pos = 0;

622

string::size_type prev_pos = pos;

624  if

((pos =

m_StmtStr

.find(

'?'

, pos)) != string::npos) {

628  while

(pos != string::npos) {

629

tmp_stmt +=

m_StmtStr

.substr(prev_pos, pos - prev_pos);

644

string::size_type pos = 0;

645

string::size_type prev_pos = pos;

651  while

(pos != string::npos) {

652

tmp_stmt +=

m_StmtStr

.substr(prev_pos, pos - prev_pos);

654

prev_pos = pos + param_len;

667

string::size_type pos = 0;

668

string::size_type prev_pos = pos;

674  while

(pos != string::npos) {

675

tmp_stmt +=

m_StmtStr

.substr(prev_pos, pos - prev_pos);

677

prev_pos = pos + param_len;

688

string::size_type pos = 0;

689

string::size_type prev_pos = pos;

698  while

(pos != string::npos) {

699  string

param_name =

m_StmtStr

.substr(pos + 1, param_len - 1);

700

tmp_stmt +=

m_StmtStr

.substr(prev_pos, pos - prev_pos);

704

name_map_t::iterator it = name2num.find(param_name);

705  if

(it == name2num.end()) {

706

it = name2num.insert(

713

tmp_stmt += it->second;

715

prev_pos = pos + param_len;

726

string::size_type pos = 0;

727

string::size_type prev_pos = pos;

733  while

(pos != string::npos) {

734  string

param_name =

m_StmtStr

.substr(pos + 1, param_len - 1);

735

tmp_stmt +=

m_StmtStr

.substr(prev_pos, pos - prev_pos);

736

tmp_stmt +=

"@"

+ param_name;

737

prev_pos = pos + param_len;

750

string::size_type pos = 0;

751

string::size_type prev_pos = pos;

757  while

(pos != string::npos) {

758

tmp_stmt +=

m_StmtStr

.substr(prev_pos, pos - prev_pos);

760

prev_pos = pos + param_len;

771

string::size_type pos = 0;

772

string::size_type prev_pos = pos;

781  while

(pos != string::npos) {

782  string

param_name =

m_StmtStr

.substr(pos + 1, param_len - 1);

783

tmp_stmt +=

m_StmtStr

.substr(prev_pos, pos - prev_pos);

787

name_map_t::iterator it = name2num.find(param_name);

788  if

(it == name2num.end()) {

789

it = name2num.insert(

796

tmp_stmt += it->second;

798

prev_pos = pos + param_len;

809

string::size_type pos = 0;

810

string::size_type prev_pos = pos;

816  while

(pos != string::npos) {

817  string

param_name =

m_StmtStr

.substr(pos + 1, param_len - 1);

818

tmp_stmt +=

m_StmtStr

.substr(prev_pos, pos - prev_pos);

819

tmp_stmt +=

":"

+ param_name;

820

prev_pos = pos + param_len;

833  string

err =

"Cannot convert '"

;

835

err +=

"' parameter format to '"

;

845

string::size_type

offset

,

849

string::size_type pos = 0;

850  static const char

* num_characters =

"0123456789"

;

853  if

((pos != string::npos) && (pos + 1 != string::npos)) {

854

string::size_type tmp_pos = 0;

856

tmp_pos =

str

.find_first_not_of(num_characters, pos + 1);

857  if

(tmp_pos != string::npos) {

859

param_len = tmp_pos - pos;

860

}

else if

(

str

.find_first_of(num_characters, pos + 1) == pos + 1) {

862

param_len =

str

.size() - pos;

872

string::size_type

offset

,

876

string::size_type pos = 0;

877  static char const

* sep_characters =

" \t\n,.()-+<>="

;

880  if

((pos != string::npos) && (pos + 1 != string::npos)) {

881

string::size_type tmp_pos = 0;

883

tmp_pos =

str

.find_first_of(sep_characters, pos + 1);

884  if

(tmp_pos != string::npos) {

886

param_len = tmp_pos - pos;

887

}

else if

((

str

[pos + 1] >=

'A'

&&

str

[pos + 1] <=

'Z'

) ||

888

(

str

[pos + 1] >=

'a'

&&

str

[pos + 1] <=

'z'

)

891

param_len =

str

.size() - pos;

900

string::size_type

offset

,

904

string::size_type pos = 0;

905  static char const

* sep_characters =

" \t\n,.()-+<>="

;

908  if

((pos != string::npos) && (pos + 1 != string::npos)) {

909

string::size_type tmp_pos = 0;

911

tmp_pos =

str

.find_first_of(sep_characters, pos + 1);

912  if

(tmp_pos != string::npos) {

914

param_len = tmp_pos - pos;

915

}

else if

((

str

[pos + 1] >=

'A'

&&

str

[pos + 1] <=

'Z'

) ||

916

(

str

[pos + 1] >=

'a'

&&

str

[pos + 1] <=

'z'

)

919

param_len =

str

.size() - pos;

928 

struct DataSourceDeleter

931 

static void Delete(ncbi::IDataSource* const object)

933

CDriverManager::DeleteDs( object );

938 

class CDataSourcePool

941

CDataSourcePool(void);

942

~CDataSourcePool(void);

945

static CDataSourcePool& GetInstance(void);

948

IDataSource& GetDataSource(

949

const string& driver_name,

950

const TPluginManagerParamTree* const params = NULL);

953

typedef CPluginManager<I_DriverContext> TContextManager;

954

typedef CPluginManagerGetter<I_DriverContext> TContextManagerStore;

955

typedef map<string, AutoPtr<IDataSource, DataSourceDeleter> > TDSMap;

957

CRef<TContextManager> m_ContextManager;

958

TDSMap m_DataSourceMap;

961

CDataSourcePool::CDataSourcePool(void)

963

m_ContextManager.Reset( TContextManagerStore::Get() );

964

_ASSERT( m_ContextManager );

966

#if defined(NCBI_OS_MSWIN)

967

// Add an additional search path ...

971

CDataSourcePool::~CDataSourcePool(void)

976

DataSourceCleanup(void* ptr)

978

CDriverManager::DeleteDs( static_cast<ncbi::IDataSource *const>(ptr) );

982

CDataSourcePool::GetInstance(void)

984

static CSafeStatic<CDataSourcePool> ds_pool;

990

CDataSourcePool::GetDataSource(

991

const string& driver_name,

992

const TPluginManagerParamTree* const params)

994

TDSMap::const_iterator citer = m_DataSourceMap.find( driver_name );

996

if ( citer != m_DataSourceMap.end() ) {

997

return *citer->second;

1000

// Build a new context ...

1001

I_DriverContext* drv = NULL;

1004

drv = m_ContextManager->CreateInstance(

1006

NCBI_INTERFACE_VERSION(I_DriverContext),

1011

catch( const CPluginManagerException& e ) {

1012

throw CDatabaseError( e.what() );

1014

catch ( const exception& e ) {

1015

throw CDatabaseError( driver_name + " is not available :: " + e.what() );

1018

throw CDatabaseError( driver_name + " was unable to load due an unknown error" );

1022

IDataSource* ds = CDriverManager::CreateDs( drv );

1023

m_DataSourceMap[driver_name] = ds;

1035 #if defined(NCBI_OS_CYGWIN) 1039 #elif defined(NCBI_OS_MSWIN) 1041  const DWORD

buff_size = 1024;

1043  char

buff[buff_size];

1045  const char

* module_name =

NULL

;

1054

MEMORY_BASIC_INFORMATION mbi;

1060  if

( cur_size = GetModuleFileNameA( mh, buff, buff_size ) ) {

1061  if

( cur_size < buff_size ) {

1073  if

(::dladdr(method_ptr, &dli) != 0) {

1096 #define DB_ERR_CODE(value, type) { value, &C##type##Error::Rethrow } 1157

NCBI_NORETURN

static 1176  if

(it != sc_SybaseErrCodes.end()) {

1182  switch

(dbe->GetErrCode()) {

1192  if

(it != sc_SybaseErrCodes.end()) {

1207  const string

& driver_name,

1208  const string

& db_type,

1209  const string

& server_name,

1210  const string

& db_name,

1211  const string

& user_name,

1212  const string

& user_pswd,

1213  bool

support_standard_interface,

1216

: m_DefParams(server_name, user_name, user_pswd)

1217

, m_Params(m_DefParams)

1220

, m_DefTransaction(

NULL

)

1228  string

db_type_uc = db_type;

1231  if

( db_type_uc ==

"SYBASE"

|| db_type_uc ==

"SYB"

) {

1233

}

else if

( db_type_uc ==

"MYSQL"

) {

1235

}

else if

( db_type_uc ==

"MSSQL"

||

1236

db_type_uc ==

"MS_SQL"

||

1237

db_type_uc ==

"MS SQL"

)

1248  while

( PyDict_Next(extra_params, &

i

, &

key

, &

value

) ) {

1366

(*citer)->close(args);

1397

: m_Transaction(trans)

1398

, m_PoolSize(

size

)

1435  throw CInternalError

(

"Unable to close a transaction. There are open cursors in use."

);

1458

: m_Transaction( trans )

1459

, m_NumOfActive( 0 )

1460

, m_Started(

false

)

1461

, m_TransType( trans_type )

1496  throw CInternalError

(

"Unable to close a transaction. There are open cursors in use."

);

1561

: m_ParentConnection(

conn

)

1563

, m_SelectConnPool( this )

1564

, m_ConnectionMode( conn_mode )

1679  for

( citer = tmp_CursorList.

begin

(); citer != cend; ++citer ) {

1680

(*citer)->CloseInternal();

1731

string::size_type pos =

stmt

.find_first_not_of(

" \t\n"

);

1732  if

(pos != string::npos)

1734

string::size_type pos_end =

stmt

.find_first_of(

" \t\n"

, pos);

1735  if

(pos_end == string::npos)

1736

pos_end =

stmt

.size();

1738  bool

output_clause_possible =

false

;

1749

output_clause_possible =

true

;

1753

output_clause_possible =

true

;

1757

output_clause_possible =

true

;

1767

output_clause_possible =

true

;

1782

&& output_clause_possible) {

1786  if

(pos + 7 <

stmt

.size()

1801

: m_ParentTransaction( trans )

1803

, m_Executed(

false

)

1804

, m_ResultStatus( 0 )

1805

, m_ResultStatusAvailable(

false

)

1806

, m_UserHandler(

NULL

)

1814

: m_ParentTransaction( trans )

1816

, m_Executed(

false

)

1817

, m_ResultStatus( 0 )

1818

, m_ResultStatusAvailable(

false

)

1819

, m_UserHandler(

NULL

)

1852  while

(

m_Stmt

->HasMoreResults() ) {

1853  if

(

m_Stmt

->HasRows() ) {

1909  m_Stmt

->GetParentConn()->GetCDB_Connection()->PushMsgHandler(

handler

);

1932  m_Stmt

->ClearParamList();

1948  string

param_name = name;

1950  if

( param_name.size() > 0) {

1951  if

( param_name[0] !=

'@'

) {

1952

param_name =

"@"

+ param_name;

1972  m_Stmt

->SetParam(

value

,

static_cast<unsigned int>

(index) );

1997  catch

(

const

bad_cast&) {

1998  throw CInternalError

(

"std::bad_cast exception within 'CStmtHelper::Execute'"

);

2003  catch

(

const

exception&) {

2004  throw CInternalError

(

"std::exception exception within 'CStmtHelper::Execute'"

);

2012  return m_Stmt

->GetRowCount();

2021  throw CProgrammingError

(

"The previous call to executeXXX() did not produce any result set or no call was issued yet"

);

2031  throw CProgrammingError

(

"The previous call to executeXXX() did not produce any result set or no call was issued yet"

);

2047  throw CProgrammingError

(

"Procedure return code is not defined within this context."

);

2059  while

(

m_Stmt

->HasMoreResults() ) {

2060  if

(

m_Stmt

->HasRows() ) {

2086  unsigned int cnt

=

data

->GetTotalColumns();

2087  for

(

unsigned int i

= 1;

i

<=

cnt

; ++

i

) {

2091  switch

(

data

->GetType(

i

)) {

2131

descr.

Append

(col_list);

2143

: m_ParentTransaction( trans )

2144

, m_Executed(

false

)

2145

, m_ResultStatus( 0 )

2146

, m_ResultStatusAvailable(

false

)

2147

, m_UserHandler(

NULL

)

2155

: m_ParentTransaction( trans )

2157

, m_Executed(

false

)

2158

, m_ResultStatus( 0 )

2159

, m_ResultStatusAvailable(

false

)

2160

, m_UserHandler(

NULL

)

2232  m_Stmt

->GetParentConn()->GetCDB_Connection()->PushMsgHandler(

handler

);

2255  string

param_name = name;

2257  if

( param_name.size() > 0) {

2258  if

( param_name[0] !=

'@'

) {

2259

param_name =

"@"

+ param_name;

2268

output_param =

false

;

2270  if

(

value

.IsNull()) {

2272  m_Stmt

->SetOutputParam( temp_val, param_name );

2277

output_param =

true

;

2291  unsigned int

ind =

static_cast<unsigned int>

(index);

2294

output_param =

false

;

2296  if

(

value

.IsNull()) {

2298  m_Stmt

->SetOutputParam( temp_val, ind );

2303

output_param =

true

;

2326  if

(cache_results) {

2333  catch

(

const

bad_cast&) {

2334  throw CInternalError

(

"std::bad_cast exception within 'CCallableStmtHelper::Execute'"

);

2339  catch

(

const

exception&) {

2340  throw CInternalError

(

"std::exception exception within 'CCallableStmtHelper::Execute'"

);

2348  return m_Stmt

->GetRowCount();

2357  throw CProgrammingError

(

"The previous call to executeXXX() did not produce any result set or no call was issued yet"

);

2367  throw CProgrammingError

(

"The previous call to executeXXX() did not produce any result set or no call was issued yet"

);

2387  throw CProgrammingError

(

"Procedure return code is not defined within this context."

);

2389  return m_Stmt

->GetReturnStatus();

2396  throw CProgrammingError

(

"The previous call to executeXXX() did not produce any result set or no call was issued yet"

);

2412  throw CProgrammingError

(

"The previous call to executeXXX() did not produce any result set or no call was issued yet"

);

2429  if

(

value

.IsNull() ) {

2433  switch

(

value

.GetType() ) {

2449 #if PY_VERSION_HEX >= 0x02040000 2455 #if PY_VERSION_HEX >= 0x03070000 2460  if

( !

offset

.IsNull() ) {

2469

(PyDateTime_FromTimestamp(args.

Get

()));

2501  size_t

lob_size =

value

.GetBlobSize();

2504

tmp_str.resize(lob_size);

2505  value

.Read( (

void

*)tmp_str.data(), lob_size );

2537  for

(

int i

= 0;

i

< col_num; ++

i

) {

2555  for

(

int i

= 0;

i

< col_num; ++

i

) {

2567

unique_ptr<pythonpp::CCalable> error_handler;

2570

}

else if

(

m_Cursor

!=

nullptr

) {

2581  if

(error_handler.get() !=

nullptr

) {

2593

PyErr_Fetch(&

type

, &

value

, &traceback);

2597

PyObject_CallObject(error_handler->Get(), args.

Get

());

2599

Py_XDECREF(

value

);

2600

Py_XDECREF(traceback);

2615

: m_PythonConnection( &trans->GetParentConnection() )

2616

, m_PythonTransaction( trans )

2617

, m_ParentTransaction( trans )

2620

, m_UserHandler( this, m_PythonConnection )

2622

, m_StmtHelper( trans )

2623

, m_CallableStmtHelper( trans )

2624

, m_ErrorHandler( m_PythonConnection.GetAttr(

"errorhandler"

) )

2625

, m_AllDataFetched(

false

)

2626

, m_AllSetsFetched(

false

)

2629  if

( trans ==

NULL

) {

2685  const size_t

args_size = args.

size

();

2690

vector<size_t> out_params;

2692  if

( args_size == 0 ) {

2693  throw CProgrammingError

(

"A stored procedure name is expected as a parameter"

);

2694

}

else if

( args_size > 0 ) {

2700  throw CProgrammingError

(

"A stored procedure name is expected as a parameter"

);

2707  if

( args_size > 1 ) {

2714

out_params.push_back(0);

2732  if

(args_size > 1 && out_params.size() != 0) {

2734

output_args.

Set

(args[1]);

2742  if

( rs.

Next

() ) {

2746  for

(

int i

= 0;

i

< col_num; ++

i

) {

2752  const string

param_name = md.

GetName

(

i

+ 1);

2810

PyObject * it = PyDict_GetItemString(kwargs.

Get

(),

"output_expected"

);

2811  if

(it ==

nullptr

) {

2813

}

else if

(PyObject_IsTrue(it)) {

2828  const size_t

args_size = args.

size

();

2834  if

( args_size == 0 ) {

2835  throw CProgrammingError

(

"An SQL statement string is expected as a parameter"

);

2836

}

else if

( args_size > 0 ) {

2843  throw CProgrammingError

(

"An SQL statement string is expected as a parameter"

);

2850  if

( args_size > 1 ) {

2900  while

( PyDict_Next(dict, &

i

, &

key

, &

value

) ) {

2914  size_t

sz = seq.

size

();

2915  for

(

size_t i

= 0;

i

< sz; ++

i

) {

2929  bool

output_param =

false

;

2931  while

( PyDict_Next(dict, &

i

, &

key

, &

value

) ) {

2946

vector<size_t>* out_params)

2949  size_t

sz = seq.

size

();

2951  for

(

size_t i

= 0;

i

< sz; ++

i

) {

2955  bool

output_param =

false

;

2958

out_params->push_back(

i

);

2966 #if PY_VERSION_HEX >= 0x030a0000 2967

tzinfo = PyDateTime_DATE_GET_TZINFO(dt.

Get

());

2969

tzinfo = dt.

GetAttr

(

"tzinfo"

);

2971  if

( !PyTZInfo_Check(tzinfo.

Get

()) ) {

2978 #if PY_VERSION_HEX >= 0x03030000 2979  auto

days = PyDateTime_DELTA_GET_DAYS(

delta

.Get()),

2980

seconds = PyDateTime_DELTA_GET_SECONDS(

delta

.Get());

2985  return

days * 24 * 60 + seconds / 60;

2995 #if PY_MAJOR_VERSION < 3 3005  const string

std_str(python_str);

3007 #if PY_VERSION_HEX >= 0x02040000 3018  if

( !

offset

.IsNull() ) {

3056  const size_t

args_size = args.

size

();

3062  if

( args_size == 0 ) {

3063  throw CProgrammingError

(

"A SQL statement string is expected as a parameter"

);

3064

}

else if

( args_size > 0 ) {

3071  throw CProgrammingError

(

"A SQL statement string is expected as a parameter"

);

3075  if

( args_size > 1 ) {

3089  for

( citer = params.

begin

(); citer != cend; ++citer ) {

3114  throw CProgrammingError

(

"Sequence of parameters should be provided either as a list or as a tuple data type"

);

3117  throw CProgrammingError

(

"A sequence of parameters is expected with the 'executemany' function"

);

3138  if

( rs.

Next

() ) {

3145  if

( rs.

Next

() ) {

3165  if

( args.

size

() > 0 ) {

3169  throw CProgrammingError

(

"Invalid parameters within 'CCursor::fetchmany' function"

);

3181  for

( ;

i

< array_size && rs.

Next

(); ++

i

) {

3186  if

(

i

< array_size ) {

3195  for

( ;

i

< array_size && rs.

Next

(); ++

i

) {

3200  if

(

i

< array_size ) {

3228  while

( rs.

Next

() ) {

3238  while

( rs.

Next

() ) {

3336  throw CProgrammingError

(

"Call get_proc_return_status after you retrieve all data."

);

3342  throw CProgrammingError

(

"Call get_proc_return_status after you retrieve all data."

);

3369

: m_PythonCursor(cursor),

3425  for

(; cur_exception; cur_exception = cur_exception->

GetPredecessor

()) {

3435

srv_msg = cur_exception->

GetMsg

();

3444

PyObject *exc_ob =

NULL

;

3445

PyObject *errno_ob =

NULL

;

3446

PyObject *msg_ob =

NULL

;

3449 #if PY_MAJOR_VERSION >= 3 3450

errno_ob = PyLong_FromLong(db_errno);

3452

errno_ob = PyInt_FromLong(db_errno);

3454  if

(errno_ob ==

NULL

) {

3458 #if PY_MAJOR_VERSION >= 3 3459

msg_ob = PyUnicode_FromStringAndSize(db_msg.data(), db_msg.size());

3461

msg_ob = PyString_FromStringAndSize(db_msg.data(), db_msg.size());

3463  if

(errno_ob ==

NULL

) {

3464

Py_DECREF(errno_ob);

3471

exc_ob = PyObject_CallFunction(err_type, (

char

*)

"s"

, (

char

*)

msg

.c_str());

3472  if

(exc_ob ==

NULL

)

3474

Py_DECREF(errno_ob);

3480  if

(PyObject_SetAttrString(exc_ob, (

char

*)

"srv_errno"

, errno_ob) == -1)

3482

Py_DECREF(errno_ob);

3489

Py_DECREF(errno_ob);

3492  if

(PyObject_SetAttrString(exc_ob, (

char

*)

"srv_msg"

, msg_ob) == -1)

3503

PyErr_SetObject(err_type, exc_ob);

3512 

// Future development ...

3513

class CModuleDBAPI : public pythonpp::CExtModule<CModuleDBAPI>

3516

CModuleDBAPI(const char* name, const char* descr = 0)

3517

: pythonpp::CExtModule<CModuleDBAPI>(name, descr)

3519

PrepareForPython(this);

3523

// connect(driver_name, db_type, db_name, user_name, user_pswd)

3524

pythonpp::CObject connect(const pythonpp::CTuple& args);

3525

pythonpp::CObject Binary(const pythonpp::CTuple& args);

3526

pythonpp::CObject TimestampFromTicks(const pythonpp::CTuple& args);

3527

pythonpp::CObject TimeFromTicks(const pythonpp::CTuple& args);

3528

pythonpp::CObject DateFromTicks(const pythonpp::CTuple& args);

3529

pythonpp::CObject Timestamp(const pythonpp::CTuple& args);

3530

pythonpp::CObject Time(const pythonpp::CTuple& args);

3531

pythonpp::CObject Date(const pythonpp::CTuple& args);

3535

CModuleDBAPI::connect(const pythonpp::CTuple& args)

3546

const pythonpp::CTuple func_args(args);

3548

driver_name = pythonpp::CString(func_args[0]);

3549

db_type = pythonpp::CString(func_args[1]);

3550

server_name = pythonpp::CString(func_args[2]);

3551

db_name = pythonpp::CString(func_args[3]);

3552

user_name = pythonpp::CString(func_args[4]);

3553

user_pswd = pythonpp::CString(func_args[5]);

3554

} catch (const pythonpp::CError&) {

3555

throw CProgrammingError("Invalid parameters within 'connect' function");

3558

CConnection* conn = new CConnection( CConnParam(

3567

// Feef the object to the Python interpreter ...

3568

return pythonpp::CObject(conn, pythonpp::eTakeOwnership);

3570

catch (const CException& e) {

3571

s_ThrowDatabaseError(e);

3574

// Return a dummy object ...

3575

return pythonpp::CNone();

3578

// This function constructs an object holding a date value.

3579

// Date(year,month,day)

3581

CModuleDBAPI::Date(const pythonpp::CTuple& args)

3589

const pythonpp::CTuple func_args(args);

3591

year = pythonpp::CInt(func_args[0]);

3592

month = pythonpp::CInt(func_args[1]);

3593

day = pythonpp::CInt(func_args[2]);

3594

} catch (const pythonpp::CError&) {

3595

throw CProgrammingError("Invalid parameters within 'Date' function");

3598

// Feef the object to the Python interpreter ...

3599

return pythonpp::CDate(year, month, day);

3601

catch (const CDB_Exception& e) {

3602

s_ThrowDatabaseError(e);

3604

catch (const CException& e) {

3605

pythonpp::CError::SetString(e.what());

3608

// Return a dummy object ...

3609

return pythonpp::CNone();

3612

// This function constructs an object holding a time value.

3613

// Time(hour,minute,second)

3615

CModuleDBAPI::Time(const pythonpp::CTuple& args)

3623

const pythonpp::CTuple func_args(args);

3625

hour = pythonpp::CInt(func_args[0]);

3626

minute = pythonpp::CInt(func_args[1]);

3627

second = pythonpp::CInt(func_args[2]);

3628

} catch (const pythonpp::CError&) {

3629

throw CProgrammingError("Invalid parameters within 'Time' function");

3632

// Feef the object to the Python interpreter ...

3633

return pythonpp::CTime(hour, minute, second, 0);

3635

catch (const CDB_Exception& e) {

3636

s_ThrowDatabaseError(e);

3638

catch (const CException& e) {

3639

pythonpp::CError::SetString(e.what());

3642

// Return a dummy object ...

3643

return pythonpp::CNone();

3646

// This function constructs an object holding a time stamp

3648

// Timestamp(year,month,day,hour,minute,second)

3650

CModuleDBAPI::Timestamp(const pythonpp::CTuple& args)

3661

const pythonpp::CTuple func_args(args);

3663

year = pythonpp::CInt(func_args[0]);

3664

month = pythonpp::CInt(func_args[1]);

3665

day = pythonpp::CInt(func_args[2]);

3666

hour = pythonpp::CInt(func_args[3]);

3667

minute = pythonpp::CInt(func_args[4]);

3668

second = pythonpp::CInt(func_args[5]);

3669

} catch (const pythonpp::CError&) {

3670

throw CProgrammingError("Invalid parameters within 'Timestamp' function");

3673

// Feef the object to the Python interpreter ...

3674

return pythonpp::CDateTime(year, month, day, hour, minute, second, 0);

3676

catch (const CDB_Exception& e) {

3677

s_ThrowDatabaseError(e);

3679

catch (const CException& e) {

3680

pythonpp::CError::SetString(e.what());

3683

// Return a dummy object ...

3684

return pythonpp::CNone();

3687

// This function constructs an object holding a date value

3688

// from the given ticks value (number of seconds since the

3689

// epoch; see the documentation of the standard Python time

3690

// module for details).

3691

// DateFromTicks(ticks)

3693

CModuleDBAPI::DateFromTicks(const pythonpp::CTuple& args)

3697

catch (const CDB_Exception& e) {

3698

s_ThrowDatabaseError(e);

3700

catch (const CException& e) {

3701

pythonpp::CError::SetString(e.what());

3704

// Return a dummy object ...

3705

return pythonpp::CNone();

3708

// This function constructs an object holding a time value

3709

// from the given ticks value (number of seconds since the

3710

// epoch; see the documentation of the standard Python time

3711

// module for details).

3712

// TimeFromTicks(ticks)

3714

CModuleDBAPI::TimeFromTicks(const pythonpp::CTuple& args)

3718

catch (const CDB_Exception& e) {

3719

s_ThrowDatabaseError(e);

3721

catch (const CException& e) {

3722

pythonpp::CError::SetString(e.what());

3725

// Return a dummy object ...

3726

return pythonpp::CNone();

3729

// This function constructs an object holding a time stamp

3730

// value from the given ticks value (number of seconds since

3731

// the epoch; see the documentation of the standard Python

3732

// time module for details).

3733

// TimestampFromTicks(ticks)

3735

CModuleDBAPI::TimestampFromTicks(const pythonpp::CTuple& args)

3739

catch (const CDB_Exception& e) {

3740

s_ThrowDatabaseError(e);

3742

catch (const CException& e) {

3743

pythonpp::CError::SetString(e.what());

3746

// Return a dummy object ...

3747

return pythonpp::CNone();

3750

// This function constructs an object capable of holding a

3751

// binary (long) string value.

3754

CModuleDBAPI::Binary(const pythonpp::CTuple& args)

3761

const pythonpp::CTuple func_args(args);

3763

value = pythonpp::CString(func_args[0]);

3764

} catch (const pythonpp::CError&) {

3765

throw CProgrammingError("Invalid parameters within 'Binary' function");

3768

CBinaryType* obj = new CBinaryType(

3771

// Feef the object to the Python interpreter ...

3772

return pythonpp::CObject(obj, pythonpp::eTakeOwnership);

3774

catch (const CDB_Exception& e) {

3775

s_ThrowDatabaseError(e);

3777

catch (const CException& e) {

3778

pythonpp::CError::SetString(e.what());

3781

return pythonpp::CNone();

3891

(

"Unknown error in python_ncbi_dbapi::ReleaseGlobalLock"

);

3901 Connect

(PyObject *

self

, PyObject *args, PyObject *kwargs)

3919  static const char

*

const

kwnames[] = {

3920  "driver"

,

"type"

,

"dsn"

,

"database"

,

"user"

,

"password"

,

3921  "support_standard_interface"

,

"extra"

,

nullptr 3923

PyObject *py_driver_name;

3924

PyObject *py_db_type;

3925

PyObject *py_server_name;

3926

PyObject *py_db_name;

3927

PyObject *py_user_name;

3928

PyObject *py_user_pswd;

3929

PyObject *py_support_standard_interface =

nullptr

;

3930

PyObject *py_extra_params =

nullptr

;

3932  int

status = PyArg_ParseTupleAndKeywords

3933

(args, kwargs,

"UUUUUU|OO:connect"

, (

char

**) kwnames,

3934

&py_driver_name, &py_db_type, &py_server_name, &py_db_name,

3935

&py_user_name, &py_user_pswd, &py_support_standard_interface,

3941

driver_name = py_driver_name;

3942

db_type = py_db_type;

3943

server_name = py_server_name;

3944

db_name = py_db_name;

3945

user_name = py_user_name;

3946

user_pswd = py_user_pswd;

3947  if

(py_extra_params !=

nullptr

) {

3948

extra_params = py_extra_params;

3949  if

(py_support_standard_interface !=

nullptr

) {

3950

support_standard_interface = py_support_standard_interface;

3952

}

else if

(py_support_standard_interface !=

nullptr

) {

3956  if

(func_args.

size

() > 6

3958

extra_params = py_support_standard_interface;

3960

support_standard_interface = py_support_standard_interface;

3974

support_standard_interface,

3999 Date

(PyObject *

self

, PyObject *args)

4001 #if PY_VERSION_HEX < 0x02040000 4043 Time

(PyObject *

self

, PyObject *args)

4045 #if PY_VERSION_HEX < 0x02040000 4090 #if PY_VERSION_HEX < 0x02040000 4263  static void Declare

(

const char

* name, PyMethodDef* methods);

4267 #if PY_MAJOR_VERSION >= 3 4268  static struct

PyModuleDef m_ModuleDef;

4273 #if PY_MAJOR_VERSION >= 3 4275

PyModuleDef_HEAD_INIT,

4290 #if PY_MAJOR_VERSION >= 3 4291

m_ModuleDef.m_name = name;

4292

m_ModuleDef.m_methods = methods;

4293  m_Module

= PyModule_Create(&m_ModuleDef);

4295  m_Module

= Py_InitModule(

const_cast<char

*

>

(name), methods);

4303  "return_strs_as_unicode(bool_flag_value) " 4304  "-- set global flag indicating that all strings returned from database " 4305  "should be presented to Python as unicode strings (if value is True) or " 4306  " as regular strings in UTF-8 encoding (if value is False - the default one). " 4307  "NOTE: This is not a part of the Python Database API Specification v2.0." 4310  "release_global_lock(bool_flag_value) " 4311  "-- set global flag indicating that blocking database operations " 4312  "should run with Python's global interpreter lock released (if value " 4313  "is True) or with it held (if value is False, the default for now)." 4314  "NOTE: This is not a part of the Python Database API Specification " 4318

METH_VARARGS | METH_KEYWORDS, (

char

*)

4319  "connect([driver=]driver_name, [type=]db_type, [dsn=]server_name," 4320  " [database=]database_name, [user=]userid, [password=]password," 4321  " [[support_standard_interface=]support_standard_interface]," 4322  " [[extra=]extra]) -- connect with the specified parameters" 4325

(

char

*)

"set_logger(logger) " 4326  "-- log through the specified logger. (This module otherwise defaults " 4327  "to going directly through the root logger.) " 4328  "NOTE: This is not a part of the Python Database API Specification " 4330

{(

char

*)

"Date"

, (PyCFunction)

python::Date

, METH_VARARGS, (

char

*)

"Date"

},

4331

{(

char

*)

"Time"

, (PyCFunction)

python::Time

, METH_VARARGS, (

char

*)

"Time"

},

4332

{(

char

*)

"Timestamp"

, (PyCFunction)

python::Timestamp

, METH_VARARGS, (

char

*)

"Timestamp"

},

4333

{(

char

*)

"DateFromTicks"

, (PyCFunction)

python::DateFromTicks

, METH_VARARGS, (

char

*)

"DateFromTicks"

},

4334

{(

char

*)

"TimeFromTicks"

, (PyCFunction)

python::TimeFromTicks

, METH_VARARGS, (

char

*)

"TimeFromTicks"

},

4336

{(

char

*)

"Binary"

, (PyCFunction)

python::Binary

, METH_VARARGS, (

char

*)

"Binary"

},

4577 #if PY_VERSION_HEX >= 0x03020000 4584

: m_LoggingModule(PyImport_ImportModule(

"logging"

))

4585

, m_LoggingDict(m_LoggingModule.GetDict()), m_Logger(1)

4586

, m_LoggerClass(m_LoggingDict.GetItem(

"Logger"

))

4587

#

if

PY_VERSION_HEX >= 0x03020000

4588

, m_HasHandlers(m_LoggerClass.GetAttr(

"hasHandlers"

))

4589

, m_IsConfigured(

false

)

4595  auto

root_logger = get_logger.

Apply

();

4638 #if PY_VERSION_HEX >= 0x03020000 4639  if

( !m_IsConfigured ) {

4640

m_IsConfigured = m_HasHandlers.Apply(

m_Logger

);

4641  if

( !m_IsConfigured ) {

4654

s.erase(0, s.find_first_not_of(

" "

, s.find_first_of(

" "

) + 1));

4686  "set_logger: expected logging.logger but got "

+

type_name

);

4732  string

name(

"python_ncbi_dbapi.ini"

);

4735  int Run

(

void

)

override

{

return

0; }

4743

s_app->FlushDiag(

nullptr

);

4782 #if PY_VERSION_HEX >= 0x02040000 4808  const string

connection_name(module_name +

".Connection"

);

4820  const string

transaction_name(module_name +

".Transaction"

);

4831  const string

cursor_name(module_name +

".Cursor"

);

4849  const string

cursor_iter_name(module_name +

".__CursorIterator__"

);

4859  if

(PyModule_AddObject(module,

const_cast<char

*

>

(

"BINARY"

),

4868  if

( PyModule_AddObject(module,

const_cast<char

*

>

(

"NUMBER"

), (PyObject*)&

python::CNumber::GetType

() ) == -1 ) {

4876  if

( PyModule_AddObject(module,

const_cast<char

*

>

(

"ROWID"

), (PyObject*)&

python::CRowID::GetType

() ) == -1 ) {

4897  static char

str_class[] =

"__class__"

;

4898  static char

str_errorhandler[] =

"errorhandler"

;

4899  static

PyMemberDef conn_members[] = {

4900

{str_class, T_OBJECT_EX, 0, READONLY,

NULL

},

4901

{str_errorhandler, T_OBJECT_EX, 0, 0,

NULL

},

4904

extt->tp_members = conn_members;

4905  if

( PyType_Ready(extt) == -1 ) {

4908  if

( PyModule_AddObject(module,

const_cast<char

*

>

(

"Connection"

), (PyObject*)extt ) == -1 ) {

4912

extt->tp_members = conn_members;

4913  if

( PyType_Ready(extt) == -1 ) {

4916  if

( PyModule_AddObject(module,

const_cast<char

*

>

(

"Transaction"

), (PyObject*)extt ) == -1 ) {

4921  static char

str_rowcount[] =

"rowcount"

;

4922  static char

str_messages[] =

"messages"

;

4923  static char

str_description[] =

"description"

;

4924  static

PyMemberDef members[] = {

4925

{str_rowcount, T_LONG, 0, READONLY,

NULL

},

4926

{str_messages, T_OBJECT_EX, 0, READONLY,

NULL

},

4927

{str_description, T_OBJECT_EX, 0, READONLY,

NULL

},

4928

{str_errorhandler, T_OBJECT_EX, 0, 0,

NULL

},

4929

{str_class, T_OBJECT_EX, 0, READONLY,

NULL

},

4932

extt->tp_members = members;

4934  if

( PyType_Ready(extt) == -1 ) {

4937  if

( PyModule_AddObject(module,

const_cast<char

*

>

(

"Cursor"

), (PyObject*)extt ) == -1 ) {

4943  if

( PyType_Ready(extt) == -1 ) {

4946  if

( PyModule_AddObject(module,

const_cast<char

*

>

(

"__CursorIterator__"

), (PyObject*)extt ) == -1 ) {

5050 #ifdef NCBI_OS_DARWIN

void SetDriverName(const string &name)

void SetDatabaseName(const string &name)

void SetParam(const string &key, const string &value)

void SetServerType(EServerType type)

void SetEncoding(EEncoding encoding)

virtual TSvrRef GetServer(const string &service)

Map a service to a server.

int Run(void) override

Run the application.

static CNcbiApplication * Instance(void)

Singleton method.

static SSystemFastMutex & GetMutex(void)

vector< pythonpp::CCalable > m_LoggingFunctions

pythonpp::CTuple m_Logger

void Post(const SDiagMessage &mess) override

Post message to handler.

pythonpp::CModule m_LoggingModule

pythonpp::CObject m_LoggerClass

pythonpp::CDict m_LoggingDict

void SetLogger(pythonpp::CObject logger)

class CStaticArrayMap<> provides access to a static array in much the same way as CStaticArraySet<>,...

TBase::const_iterator const_iterator

CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...

virtual const IResultSetMetaData & GetMetaData(void) const

Get Metadata.

virtual bool Next(void)

Get next row.

CCachedResultSet(IResultSet &other)

virtual ~CCachedResultSet(void)

virtual const CVariant & GetVariant(const CDBParamVariant &param)

Retrieve a CVariant class describing the data stored in a given column.

deque< CVariant > TRecord

virtual unsigned int GetTotalColumns(void)

Get total columns.

const EDB_ResType m_ResType

virtual EDB_ResType GetResultType(void)

Get result type.

unique_ptr< const IResultSetMetaData > m_MetaData

deque< TRecord > TRecordSet

const unsigned int m_ColumsNum

CTransaction *const m_ParentTransaction

CCallableStmtHelper(CTransaction *trans)

int GetReturnStatus(void)

long GetRowCount(void) const

unique_ptr< ICallableStatement > m_Stmt

unique_ptr< CResultSetProxy > m_RSProxy

void SetStr(const CStmtStr &stmt, CDB_UserHandler *handler)

void SetParam(const string &name, const CVariant &value, bool &output_param)

void CreateStmt(CDB_UserHandler *handler)

CDB_UserHandler * m_UserHandler

~CCallableStmtHelper(void)

void FillDescription(pythonpp::CList &descr)

void Execute(bool cache_results=false)

CVariantSet & GetRS(void)

bool m_ResultStatusAvailable

CCPPToolkitConnParams m_Params

CTransaction * CreateTransaction(void)

void DestroyTransaction(CTransaction *trans)

EConnectionMode m_ConnectionMode

pythonpp::CObject __enter__(const pythonpp::CTuple &args)

CDBDefaultConnParams m_DefParams

pythonpp::CObject m_ErrorHandler

pythonpp::CObject commit(const pythonpp::CTuple &args)

CConnection(const string &driver_name, const string &db_type, const string &server_name, const string &db_name, const string &user_name, const string &user_pswd, bool support_standard_interface, const pythonpp::CDict &extra_params)

IConnection * MakeDBConnection(void) const

pythonpp::CObject close(const pythonpp::CTuple &args)

pythonpp::CObject rollback(const pythonpp::CTuple &args)

CTransaction * m_DefTransaction

CTransaction & GetDefaultTransaction(void)

pythonpp::CObject cursor(const pythonpp::CTuple &args)

pythonpp::CObject transaction(const pythonpp::CTuple &args)

CCursorIter(CCursor *cursor)

pythonpp::CObject fetchmany(const pythonpp::CTuple &args)

Fetch the next set of rows of a query result, returning a sequence of sequences (e....

pythonpp::CList m_InfoMessages

pythonpp::CObject __enter__(const pythonpp::CTuple &args)

pythonpp::CList m_DescrList

void AddInfoMessage(const string &message)

pythonpp::CObject m_Description

pythonpp::CObject fetchall(const pythonpp::CTuple &args)

Fetch all (remaining) rows of a query result, returning them as a sequence of sequences (e....

PyObject * CreateIter(void)

bool NextSetInternal(void)

CCursor(CTransaction *trans)

pythonpp::CObject setinputsizes(const pythonpp::CTuple &args)

This can be used before a call to executeXXX() to predefine memory areas for the operation's paramete...

pythonpp::CObject close(const pythonpp::CTuple &args)

Close the cursor now (rather than whenever __del__ is called).

pythonpp::CObject fetchone(const pythonpp::CTuple &args)

Fetch the next row of a query result set, returning a single sequence, or None when no more data is a...

pythonpp::CObject get_proc_return_status(const pythonpp::CTuple &args)

CCallableStmtHelper m_CallableStmtHelper

CUserHandler m_UserHandler

pythonpp::CObject execute(const pythonpp::CTuple &args, const pythonpp::CDict &kwargs)

Prepare and execute a database operation (query or command).

pythonpp::CObject m_ErrorHandler

void SetupParameters(const pythonpp::CDict &dict, CStmtHelper &stmt)

pythonpp::CObject callproc(const pythonpp::CTuple &args)

Call a stored database procedure with the given name.

CVariant GetCVariant(const pythonpp::CObject &obj) const

pythonpp::CObject setoutputsize(const pythonpp::CTuple &args)

Set a column buffer size for fetches of large columns (e.g.

pythonpp::CObject executemany(const pythonpp::CTuple &args, const pythonpp::CDict &kwargs)

Prepare a database operation (query or command) and then execute it against all parameter sequences o...

CTransaction & GetTransaction(void)

pythonpp::CObject nextset(const pythonpp::CTuple &args)

This method will make the cursor skip to the next available set, discarding any remaining rows from t...

static void Declare(const char *name, PyMethodDef *methods)

static PyObject * m_Module

CDMLConnPool(CTransaction *trans, ETransType trans_type=eImplicitTrans)

void rollback(void) const

const ETransType m_TransType

IStatement & GetLocalStmt(void) const

unique_ptr< IStatement > m_LocalStmt

const CConnection & GetConnection(void) const

IConnection * Create(void)

void Destroy(IConnection *db_conn)

unique_ptr< IConnection > m_DMLConnection

void x_Init(const CDB_Exception &e, PyObject *err_type)

TFormat GetDriverFmt(void) const

static const char * GetName(TFormat fmt)

TFormat GetUserFmt(void) const

CParamFmt(TFormat user_fmt=eTSQL, TFormat drv_fmt=eTSQL)

virtual unsigned int GetTotalColumns(void)

Get total columns.

virtual const CVariant & GetVariant(const CDBParamVariant &param)

Retrieve a CVariant class describing the data stored in a given column.

virtual EDB_ResType GetResultType(void)

Get result type.

CRealResultSet(IResultSet *other)

virtual bool Next(void)

Get next row.

virtual ~CRealResultSet(void)

virtual const IResultSetMetaData & GetMetaData(void) const

Get Metadata.

virtual bool MoveToLastRS(void)

virtual ~CRealSetProxy(void)

virtual bool HasRS(void) const

virtual CVariantSet & GetRS(void)

unique_ptr< CVariantSet > m_VariantSet

virtual bool MoveToNextRS(void)

CRealSetProxy(ICallableStatement &stmt)

ICallableStatement * m_Stmt

virtual void DumpResult(void)

const CConnection & GetConnection(void) const

TConnectionList m_ConnPool

void Destroy(IConnection *db_conn)

IConnection * Create(void)

CSelectConnPool(CTransaction *trans, size_t size=3)

TConnectionList m_ConnList

int GetReturnStatus(void)

void FillDescription(pythonpp::CList &descr)

CDB_UserHandler * m_UserHandler

void SetParam(const string &name, const CVariant &value)

unique_ptr< IResultSet > m_RS

CStmtHelper(CTransaction *trans)

void SetStr(const CStmtStr &stmt, CDB_UserHandler *handler)

long GetRowCount(void) const

CTransaction *const m_ParentTransaction

unique_ptr< IStatement > m_Stmt

void CreateStmt(CDB_UserHandler *handler)

bool m_ResultStatusAvailable

string::size_type find_named(const string &str, string::size_type offset, int &param_len)

EStatementType GetType(void) const

void SetStr(const string &str, EStatementType default_type=estSelect, const CParamFmt &fmt=CParamFmt(), ETriState output_expected=eTriState_Unknown)

string::size_type find_numeric(const string &str, string::size_type offset, int &param_len)

string::size_type find_TSQL(const string &str, string::size_type offset, int &param_len)

string GetStr(void) const

CDMLConnPool m_DMLConnPool

pythonpp::CObject __enter__(const pythonpp::CTuple &args)

void CloseOpenCursors(void)

IConnection * CreateSelectConnection(void)

pythonpp::CObject commit(const pythonpp::CTuple &args)

pythonpp::CObject rollback(const pythonpp::CTuple &args)

CTransaction(CConnection *conn, pythonpp::EOwnershipFuture ownnership=pythonpp::eOwned, EConnectionMode conn_mode=eSimpleMode)

const CConnection & GetParentConnection(void) const

IConnection * CreateDMLConnection(void)

void RollbackInternal(void) const

CSelectConnPool m_SelectConnPool

CCursor * CreateCursor(void)

pythonpp::CObject close(const pythonpp::CTuple &args)

void DestroyCursor(CCursor *cursor)

void DestroySelectConnection(IConnection *db_conn)

void CommitInternal(void) const

void DestroyDMLConnection(IConnection *db_conn)

const EConnectionMode m_ConnectionMode

pythonpp::CObject m_PythonConnection

pythonpp::CObject cursor(const pythonpp::CTuple &args)

virtual bool HandleIt(CDB_Exception *ex)

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

pythonpp::CObject m_PythonConnection

virtual ~CVariantSetProxy(void)

virtual bool MoveToNextRS(void)

virtual bool MoveToLastRS(void)

CRef< CVariantSet > m_CurResultSet

CVariantSetProxy(ICallableStatement &stmt)

deque< CRef< CVariantSet > > TCachedSet

virtual bool HasRS(void) const

virtual CVariantSet & GetRS(void)

virtual void DumpResult(void)

virtual const IResultSetMetaData & GetMetaData(void) const =0

Get Metadata.

virtual EDB_ResType GetResultType(void)=0

Get result type.

virtual bool Next(void)=0

Get next row.

virtual const CVariant & GetVariant(const CDBParamVariant &param)=0

Retrieve a CVariant class describing the data stored in a given column.

virtual unsigned int GetTotalColumns(void)=0

Get total columns.

virtual ~CVariantSet(void)

Destructor.

void Cleanup(CVariant &value)

CWarning(const string &msg)

static bool HasSameType(PyObject *obj)

static bool HasExactSameType(PyObject *obj)

CObject Apply(void) const

Call.

static bool HasSameType(PyObject *obj)

int GetMicroSecond(void) const

int GetMinute(void) const

int GetSecond(void) const

static bool HasSameType(PyObject *obj)

void SetItem(const string &key, const CObject &obj)

CObject GetItem(const string &s) const

static bool HasSameType(PyObject *obj)

static void SetString(const string &msg)

void RWAttr(const string &name, long &value)

static void Declare(const char *name, const char *descr=0, PyTypeObject *base=&PyBaseObject_Type)

void ROAttr(const string &name, long &value)

static CExtType & GetType(void)

static void PrepareForPython(CExtObject< CBinaryType > *self)

static CClass< 1 > Def(const char *name, TMethodVarArgsFunc func, const char *doc=0)

static CObject & GetTypeObject(void)

void SetName(const char *name)

static bool HasSameType(PyObject *obj)

static bool HasSameType(PyObject *obj)

void SetItem(int offset, const CObject &obj)

void Append(const CObject &obj)

static bool HasSameType(PyObject *obj)

static bool HasSameType(PyObject *obj)

static void AddConst(const string &name, const string &value)

static void Declare(const string &name, PyMethodDef *methods, inquiry cleanup_hook=NULL)

static PyObject * GetPyModule(void)

static bool HasExactSameType(PyObject *obj)

static bool HasSameType(PyObject *obj)

void Set(PyObject *obj, EOwnership ownership)

Not exception-safe this time.

PyTypeObject * GetObjType(void) const

PyObject * Get(void) const

CObject GetAttr(const std::string &name) const

virtual size_type size() const

static bool HasSameType(PyObject *obj)

CThreadingGuard – "Anti-guard" for Python's global interpreter lock, which it temporarily releases to...

static void SetMayRelease(bool may_release)

int GetMinute(void) const

int GetSecond(void) const

int GetMicroSecond(void) const

static bool HasSameType(PyObject *obj)

void SetItem(int offset, const CObject &obj)

void SetItemFast(int offset, PyObject *obj)

size_type size(void) const

static bool HasSameType(PyObject *obj)

CObject GetItem(int offset) const

static void Declare(const string &name)

iterator_bool insert(const value_type &val)

const_iterator begin() const

const_iterator end() const

parent_type::const_iterator const_iterator

void(*)(CSeq_entry_Handle seh, IWorkbench *wb, const CSerialObject &obj) handler

#define DBLB_INSTALL_DEFAULT()

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

static CS_CONNECTION * conn

static const char * str(char *buf, int n)

ETriState

Enumeration to represent a tristate value.

virtual bool LoadConfig(CNcbiRegistry &reg, const string *conf, CNcbiRegistry::TFlags reg_flags)

Load settings from the configuration file to the registry.

CNcbiRegistry & GetRWConfig(void)

Get the application's cached configuration parameters, accessible for read-write for an application's...

@ eTriState_False

The value is equivalent to false/no.

@ eTriState_True

The value is equivalent to true/yes.

@ eTriState_Unknown

The value is indeterminate.

@ 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 &param) const =0

Get name of column.

virtual IResultSet * GetResultSet()=0

Get resulset.

virtual bool HasMoreResults()=0

Check for more results available.

virtual const IResultSetMetaData * GetMetaData(EOwnership ownership=eNoOwnership)=0

Get Metadata.

virtual CDB_Connection * GetCDB_Connection()=0

Returns the internal driver connection object.

virtual EDB_ResType GetResultType()=0

Get result type.

virtual IStatement * GetStatement()=0

Get statement object for regular SQL queries.

virtual unsigned int GetTotalColumns()=0

Get total columns.

virtual const CVariant & GetVariant(const CDBParamVariant &param)=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 Connect(const string &user, const string &password, const string &server, const string &database=kEmptyStr)=0

Connect to a database.

virtual bool HasRows()=0

Check if resultset has rows.

virtual void ExecuteUpdate(const string &sql)=0

Executes SQL statement with no results returned.

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

IDataSource * MakeDs(const CDBConnParams &params, const string &tag=kEmptyStr)

static CDriverManager & GetInstance()

void AddDllSearchPath(const string &path)

Add path for the DLL lookup.

int GetDBErrCode(void) const

int GetSybaseSeverity(void) const

bool IsPositional(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 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...

unsigned int GetPosition(void) const

EDB_ResType

EDB_ResType::

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

Put the message handler into message handler stack.

@ eDateTimeOffset

DATETIMEOFFSET (MS); no Sybase equivalent.

static CVariant VarBinary(const void *p, size_t len)

void Write(string &str, TDiagWriteFlags flags=fNone) const

Binary OR of "EDiagWriteFlags".

TExtraArgs m_ExtraArgs

If event type is "extra", contains the list of arguments.

static bool IsSetOldPostFormat(void)

Check old/new format flag (for compatibility only)

const char * m_Buffer

Not guaranteed to be '\0'-terminated!

EDiagSev m_Severity

Severity level.

#define NCBI_CURRENT_FUNCTION

Get current function name.

int CompareDiagPostLevel(EDiagSev sev1, EDiagSev sev2)

Compare two severities.

CDiagHandler * GetDiagHandler(bool take_ownership=false, bool *current_ownership=0)

Get the currently set diagnostic handler class.

size_t m_BufferLen

Length of m_Buffer.

void SetDiagHandler(CDiagHandler *handler, bool can_delete=true)

Set the diagnostic handler using the specified diagnostic handler class.

static void SetOldPostFormat(bool value)

Set old/new format flag.

@ fNoEndl

No end of line.

@ fNoPrefix

No std prefix.

@ eDiag_Trace

Trace message.

@ eDiag_Info

Informational message.

@ eDiag_Error

Error message.

@ eDiag_Warning

Warning message.

@ eDiag_Fatal

Fatal error – guarantees exit(or abort)

@ eDiag_Critical

Critical error message.

@ eDiagSevMax

Verbosity level for max. severity.

#define NCBI_CATCH_ALL_X(err_subcode, message)

const string & GetMsg(void) const

Get message string.

virtual const char * what(void) const noexcept

Standard report (includes full backlog).

const CException * GetPredecessor(void) const

Get "previous" exception from the backlog.

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.

static SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)

Find the pattern in the specified range of a string using a case insensitive search.

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

Convert int to string.

static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)

Replace occurrences of a substring within a string.

static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)

Case-insensitive equality of a substring with another string.

size_type find(const CTempString match, size_type pos=0) const

Find the first instance of the entire matching string within the current string, beginning at an opti...

static string & ToUpper(string &str)

Convert string to upper case – string& version.

static const size_type npos

int Minute(void) const

Get minute.

void SetMinute(int minute)

Set minute.

TSeconds TimeZoneOffset(void) const

Get difference between local timezone for current time object and UTC in seconds.

void SetSecond(int second)

Set second.

void SetMicroSecond(long microsecond)

Set microseconds.

long NanoSecond(void) const

Get nano-seconds.

int Year(void) const

Get year.

void SetHour(int hour)

Set hour.

time_t GetTimeT(void) const

Get time in time_t format.

int Day(void) const

Get day.

int Hour(void) const

Get hour.

int Second(void) const

Get second.

int Month(void) const

Get month.

@ eCurrent

Use current time. See also CCurrentTime.

Definition of all error codes used in dbapi libraries (dbapi_driver.lib and others).

The blob sat and sat key Both must be positive integers</td > n< td > Non empty string The interpretation of the blob id depends on a processor Cassandra n processor expects the following format

if(yy_accept[yy_current_state])

double value_type

The numeric datatype used by the parser.

const struct ncbi::grid::netcache::search::fields::SIZE size

const struct ncbi::grid::netcache::search::fields::KEY key

static string RetrieveModuleFileName(void)

PyObject * s_GetCursorIter(PyObject *curs_obj)

static void s_FillDescription(pythonpp::CList &descr, const IResultSetMetaData *data)

static PyObject * Binary(PyObject *self, PyObject *args)

static PyObject * Timestamp(PyObject *self, PyObject *args)

static PyObject * ReturnStrsAsUnicode(PyObject *self, PyObject *args)

static CNullable< short > x_GetUTCOffset(const pythonpp::CDateTime &dt)

EStatementType RetrieveStatementType(const string &stmt, EStatementType default_type, ETriState output_expected)

SStaticPair< int, FRethrow > TDBErrCodePair

static PyObject * TimeFromTicks(PyObject *self, PyObject *args)

PyObject * s_CursorIterNext(PyObject *iter_obj)

PyObject * s_GetCursorIterFromIter(PyObject *iter_obj)

static const TDBErrCodePair kClientErrCodes[]

static PyObject * DateFromTicks(PyObject *self, PyObject *args)

static PyObject * SetLogger(PyObject *self, PyObject *args)

static PyObject * ReleaseGlobalLock(PyObject *self, PyObject *args)

static PyObject * Time(PyObject *self, PyObject *args)

void(* FRethrow)(const CDB_Exception &)

static PyObject * Connect(PyObject *self, PyObject *args, PyObject *kwargs)

static PyObject * TimestampFromTicks(PyObject *self, PyObject *args)

DEFINE_STATIC_ARRAY_MAP(TDBErrCodeMap, sc_ClientErrCodes, kClientErrCodes)

static ETriState s_IsOutputExpected(const pythonpp::CDict &kwargs)

pythonpp::CTuple MakeTupleFromResult(IResultSet &rs)

pythonpp::CObject ConvertCVariant2PCObject(const CVariant &value)

static PyObject * Date(PyObject *self, PyObject *args)

static const TDBErrCodePair kSybaseErrCodes[]

CStaticArrayMap< int, FRethrow > TDBErrCodeMap

static void s_ThrowDatabaseError(const CException &e)

PyObject * DecRefCount(PyObject *obj)

PyObject * IncRefCount(PyObject *obj)

const GenericPointer< typename T::ValueType > T2 value

#define NCBI_PACKAGE_VERSION

Static variables safety - create on demand, destroy on application termination.

Defines the CNcbiApplication and CAppException classes for creating NCBI applications.

Defines access to miscellaneous global configuration settings.

const char * NCBI_GetDefaultRunpath(void)

Get default run path.

Int4 delta(size_t dimension_, const Int4 *score_)

#define DB_ERR_CODE(value, type)

static void s_RestoreOrigDiagHandler(void)

static struct PyMethodDef python_ncbi_dbapi_methods[]

static PyObject * init_common(const string &module_name)

static int s_OnClear(PyObject *)

#define PYDBAPI_MODINIT_FUNC(name)

#define PYDBAPI_SUPPORT_DIR

#define PYDBAPI_MOD_RETURN

static bool s_WasUsingOldPostFormat

bool g_PythonStrDefToUnicode

Flag showing whether all pythonpp::CString objects should be created as Python unicode strings (TRUE ...

static CDiagHandler * s_OrigDiagHandler

static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)

#define row(bind, expected)

Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...

static const char * type_name(CS_INT value)


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