📄 otlv4.h
字号:
while(*c1 && *c1!='/'){ \ *c2=*c1; \ ++c1; ++c2; \ } \ if(*c1=='/'){ \ *c2=*c1; \ ++c1; ++c2; \ while(*c1 && *c1!='@'){ \ *c2='*'; \ ++c1; ++c2; \ } \ if(*c1=='@'){ \ while(*c1){ \ *c2=*c1; \ ++c1; ++c2; \ } \ } \ } \ *c2=0; \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_PREFIX; \ OTL_TRACE_STREAM<<class_name; \ OTL_TRACE_STREAM<<"(this="; \ OTL_TRACE_STREAM<<OTL_RCAST(void*,this); \ OTL_TRACE_STREAM<<")::" func_name "("; \ OTL_TRACE_STREAM<<"connect_str=\""; \ OTL_TRACE_STREAM<<temp_connect_str; \ OTL_TRACE_STREAM<<"\", auto_commit="; \ OTL_TRACE_STREAM<<auto_commit; \ OTL_TRACE_STREAM<<");"; \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_SUFFIX; \ }#endif#if !defined(OTL_TRACE_RLOGON_ORA8) && defined(OTL_ORA8)#define OTL_TRACE_RLOGON_ORA8(level,class_name,func_name, \ tnsname,userid,passwd, \ auto_commit) \ if(OTL_TRACE_LEVEL & level){ \ char temp_connect_str[2048]; \ strcpy(temp_connect_str,userid); \ strcat(temp_connect_str,"/"); \ size_t sz=strlen(passwd); \ for(size_t i=0;i<sz;++i)strcat(temp_connect_str,"*"); \ size_t tns_sz=strlen(tnsname); \ if(tns_sz>0){ \ strcat(temp_connect_str,"@"); \ strcat(temp_connect_str,tnsname); \ } \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_PREFIX; \ OTL_TRACE_STREAM<<class_name<<"(this="; \ OTL_TRACE_STREAM<<OTL_RCAST(void*,this); \ OTL_TRACE_STREAM<<")::" func_name "("; \ OTL_TRACE_STREAM<<"connect_str=\""; \ OTL_TRACE_STREAM<<temp_connect_str; \ OTL_TRACE_STREAM<<"\", auto_commit="; \ OTL_TRACE_STREAM<<auto_commit <<");"; \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_SUFFIX; \ }#endif#if !defined(OTL_TRACE_RLOGON_ODBC)&&(defined(OTL_ODBC)||defined(OTL_DB2_CLI))#define OTL_TRACE_RLOGON_ODBC(level,class_name,func_name, \ tnsname,userid,passwd, \ auto_commit) \ if(OTL_TRACE_LEVEL & level){ \ char temp_connect_str2[2048]; \ strcpy(temp_connect_str2,userid); \ strcat(temp_connect_str2,"/"); \ size_t sz=strlen(passwd); \ for(size_t i=0;i<sz;++i)strcat(temp_connect_str2,"*"); \ size_t tns_sz=strlen(tnsname); \ if(tns_sz>0){ \ strcat(temp_connect_str2,"@"); \ strcat(temp_connect_str2,tnsname); \ } \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_PREFIX; \ OTL_TRACE_STREAM<<class_name; \ OTL_TRACE_STREAM<<"(this="; \ OTL_TRACE_STREAM<<OTL_RCAST(void*,this); \ OTL_TRACE_STREAM<<")::" func_name "("; \ OTL_TRACE_STREAM<<"connect_str=\""; \ OTL_TRACE_STREAM<<temp_connect_str2; \ OTL_TRACE_STREAM<<"\", auto_commit="; \ OTL_TRACE_STREAM<<auto_commit; \ OTL_TRACE_STREAM<<");"; \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_SUFFIX; \ }#endif#if !defined(OTL_TRACE_RLOGON_ODBC_W)&& \ (defined(OTL_ODBC)||defined(OTL_DB2_CLI))#define OTL_TRACE_RLOGON_ODBC_W(level,class_name,func_name, \ tnsname,userid,passwd, \ auto_commit) \ if(OTL_TRACE_LEVEL & level){ \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_PREFIX; \ OTL_TRACE_STREAM<<class_name; \ OTL_TRACE_STREAM<<L"(this="; \ OTL_TRACE_STREAM<<OTL_RCAST(void*,this); \ OTL_TRACE_STREAM<<L")::" func_name L"("; \ OTL_TRACE_STREAM<<L"connect_str=\""; \ OTL_TRACE_STREAM<<userid<<L"/***@"<<tnsname; \ OTL_TRACE_STREAM<<L"\", auto_commit="; \ OTL_TRACE_STREAM<<auto_commit; \ OTL_TRACE_STREAM<<L");"; \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_SUFFIX; \ }#endif#if !defined(OTL_TRACE_FIRST_FETCH)#if defined(OTL_TRACE_ENABLE_STREAM_LABELS)#define OTL_TRACE_FIRST_FETCH \ if(OTL_TRACE_LEVEL & 0x8){ \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_PREFIX; \ OTL_TRACE_STREAM<<"otl_stream, fetched the first batch of rows, SQL Stm="; \ if(this->stm_label) \ OTL_TRACE_STREAM<<this->stm_label; \ else \ OTL_TRACE_STREAM<<this->stm_text; \ OTL_TRACE_STREAM<<", RPC="; \ OTL_TRACE_STREAM<<row_count; \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_SUFFIX; \ }#else#define OTL_TRACE_FIRST_FETCH \ if(OTL_TRACE_LEVEL & 0x8){ \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_PREFIX; \ OTL_TRACE_STREAM<<"otl_stream, fetched the first batch of rows, SQL Stm="; \ OTL_TRACE_STREAM<<this->stm_text; \ OTL_TRACE_STREAM<<", RPC="; \ OTL_TRACE_STREAM<<row_count; \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_SUFFIX; \ }#endif#endif#if !defined(OTL_TRACE_NEXT_FETCH)#if defined(OTL_TRACE_ENABLE_STREAM_LABELS)#define OTL_TRACE_NEXT_FETCH \ if(OTL_TRACE_LEVEL & 0x8 && cur_row==0){ \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_PREFIX; \ OTL_TRACE_STREAM<<"otl_stream, fetched the next batch of rows, SQL Stm=" ; \ if(this->stm_label) \ OTL_TRACE_STREAM<<this->stm_label; \ else \ OTL_TRACE_STREAM<<this->stm_text; \ OTL_TRACE_STREAM<<", RPC="; \ OTL_TRACE_STREAM<<row_count; \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_SUFFIX; \ }#else#define OTL_TRACE_NEXT_FETCH \ if(OTL_TRACE_LEVEL & 0x8 && cur_row==0){ \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_PREFIX; \ OTL_TRACE_STREAM<<"otl_stream, fetched the next batch of rows, SQL Stm=" ; \ OTL_TRACE_STREAM<<this->stm_text; \ OTL_TRACE_STREAM<<", RPC="; \ OTL_TRACE_STREAM<<row_count; \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_SUFFIX; \ }#endif#endif#if !defined(OTL_TRACE_STREAM_EXECUTION)#if defined(OTL_TRACE_ENABLE_STREAM_LABELS)#define OTL_TRACE_STREAM_EXECUTION \ if(OTL_TRACE_LEVEL & 0x8){ \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_PREFIX; \ OTL_TRACE_STREAM<<"otl_stream, executing SQL Stm="; \ if(this->stm_label) \ OTL_TRACE_STREAM<<this->stm_label; \ else \ OTL_TRACE_STREAM<<this->stm_text; \ OTL_TRACE_STREAM<<", buffer size="; \ OTL_TRACE_STREAM<<this->array_size; \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_SUFFIX; \ }#else#define OTL_TRACE_STREAM_EXECUTION \ if(OTL_TRACE_LEVEL & 0x8){ \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_PREFIX; \ OTL_TRACE_STREAM<<"otl_stream, executing SQL Stm="; \ OTL_TRACE_STREAM<<this->stm_text; \ OTL_TRACE_STREAM<<", buffer size="; \ OTL_TRACE_STREAM<<this->array_size; \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_SUFFIX; \ }#endif#endif#if !defined(OTL_TRACE_STREAM_EXECUTION2)#if defined(OTL_TRACE_ENABLE_STREAM_LABELS)#define OTL_TRACE_STREAM_EXECUTION2 \ if(OTL_TRACE_LEVEL & 0x8){ \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_PREFIX; \ OTL_TRACE_STREAM<<"otl_stream, executing SQL Stm="; \ if(this->stm_label) \ OTL_TRACE_STREAM<<this->stm_label; \ else \ OTL_TRACE_STREAM<<this->stm_text; \ OTL_TRACE_STREAM<<", current batch size="; \ OTL_TRACE_STREAM<<(cur_y+1); \ OTL_TRACE_STREAM<<", row offset="; \ OTL_TRACE_STREAM<<rowoff; \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_SUFFIX; \ }#else#define OTL_TRACE_STREAM_EXECUTION2 \ if(OTL_TRACE_LEVEL & 0x8){ \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_PREFIX; \ OTL_TRACE_STREAM<<"otl_stream, executing SQL Stm="; \ OTL_TRACE_STREAM<<this->stm_text; \ OTL_TRACE_STREAM<<", current batch size="; \ OTL_TRACE_STREAM<<(cur_y+1); \ OTL_TRACE_STREAM<<", row offset="; \ OTL_TRACE_STREAM<<rowoff; \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_SUFFIX; \ }#endif#endif#if !defined(OTL_TRACE_READ)#define OTL_TRACE_READ(val,function,type) \ if(OTL_TRACE_LEVEL & 0x10){ \ otl_var_desc* temp_vdesc=describe_next_in_var(); \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_PREFIX; \ OTL_TRACE_STREAM<<"otl_stream(this="; \ OTL_TRACE_STREAM<<OTL_RCAST(void*,this); \ OTL_TRACE_STREAM<<")::" function "(" type ": "; \ OTL_TRACE_STREAM<<"ftype="; \ OTL_TRACE_STREAM<<temp_vdesc->ftype; \ OTL_TRACE_STREAM<<", placeholder="; \ OTL_TRACE_STREAM<<temp_vdesc->name; \ OTL_TRACE_STREAM<<", value="; \ OTL_TRACE_STREAM<<val; \ OTL_TRACE_STREAM <<");"; \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_SUFFIX; \ }#endif#if !defined(OTL_TRACE_WRITE)#define OTL_TRACE_WRITE(val,function,type) \ if(OTL_TRACE_LEVEL & 0x10){ \ otl_var_desc* temp_vdesc=describe_next_out_var(); \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_PREFIX; \ OTL_TRACE_STREAM<<"otl_stream(this="; \ OTL_TRACE_STREAM<<OTL_RCAST(void*,this); \ OTL_TRACE_STREAM<<")::" function "(" type " : "; \ OTL_TRACE_STREAM<<"ftype="; \ OTL_TRACE_STREAM<<temp_vdesc->ftype; \ OTL_TRACE_STREAM<<", placeholder="; \ OTL_TRACE_STREAM<<temp_vdesc->name; \ OTL_TRACE_STREAM<<", value="; \ if(this->is_null()) \ OTL_TRACE_STREAM<<"NULL"; \ else \ OTL_TRACE_STREAM<<val; \ OTL_TRACE_STREAM<<");"; \ OTL_TRACE_STREAM<<OTL_TRACE_LINE_SUFFIX; \ }#endif#else#define OTL_TRACE_LINE_PREFIX#define OTL_TRACE_LINE_SUFFIX#define OTL_TRACE_DIRECT_EXEC#define OTL_TRACE_SYNTAX_CHECK#define OTL_TRACE_FUNC(level,class_name,func_name,args)#define OTL_TRACE_EXCEPTION(code,msg,stm_text,var_info)#define OTL_TRACE_RLOGON_ORA7(level,class_name,func_name, \ connect_str,auto_commit)#define OTL_TRACE_RLOGON_ORA8(level,class_name,func_name, \ tnsname,userid,passwd, \ auto_commit)#define OTL_TRACE_RLOGON_ODBC(level,class_name,func_name, \ tnsname,userid,passwd, \ auto_commit)#define OTL_TRACE_STREAM_OPEN#define OTL_TRACE_STREAM_OPEN2#define OTL_TRACE_FIRST_FETCH#define OTL_TRACE_NEXT_FETCH#define OTL_TRACE_STREAM_EXECUTION#define OTL_TRACE_STREAM_EXECUTION2#define OTL_TRACE_WRITE(val,function,type)#define OTL_TRACE_READ(val,function,type)#define OTL_TRACE_RLOGON_ODBC_W(level,class_name,func_name, \ tnsname,userid,passwd, \ auto_commit)#endif#if defined(OTL_DB2_CLI)#define OTL_ODBC#endif#if defined(OTL_UNICODE)#if !defined(OTL_UNICODE_CHAR_TYPE)#define OTL_UNICODE_CHAR_TYPE wchar_t#endif#if !defined(OTL_UNICODE_CHAR_TYPE_TRACE_NAME)#define OTL_UNICODE_CHAR_TYPE_TRACE_NAME "wchar_t"#endif#endif#if defined(OTL_UNICODE)&& \ (defined(OTL_ORA8I)|| \ defined(OTL_ORA9I)|| \ defined(OTL_ORA10G)||defined(OTL_ORA10G_R2))#define OTL_ORA_UNICODE#endif#if defined(OTL_UNICODE)#if (defined(OTL_ORA8I)||defined(OTL_ORA9I)||defined(OTL_ORA10G)||defined(OTL_ORA10G_R2)) && defined(OTL_ODBC)#error OTL_UNICODE is not supported when both OTL_ORAxx and OTL_ODBC/OTL_DB2_CLI are defined#endif#if defined(OTL_ORA8I)||defined(OTL_ORA9I)||defined(OTL_ORA10G)||defined(OTL_ORA10G_R2)#define OTL_CHAR unsigned short#define OTL_UNICODE_CHAR OTL_CHAR#define OTL_WCHAR unsigned long#if defined(OTL_ORA8I)#define OTL_UNICODE_ID OCI_UCS2ID#endif#if defined(OTL_ORA9I)#define OTL_UNICODE_ID OCI_UTF16ID#endif#elif defined(OTL_ODBC)#define OTL_CHAR unsigned short#define OTL_UNICODE_CHAR OTL_CHAR#define OTL_WCHAR OTL_CHAR#endif#else#define OTL_CHAR unsigned char#endif#if defined(OTL_ORA7) || defined(OTL_ORA8)#define OTL_PL_TAB#endifconst int otl_odbc_adapter=1;const int otl_ora7_adapter=2;const int otl_ora8_adapter=3;const int otl_inout_binding=1;const int otl_select_binding=2;const int otl_unsupported_type=-10000;#if defined(OTL_ANSI_CPP)#define OTL_SCAST(_t,_e) static_cast<_t >(_e)#define OTL_RCAST(_t,_e) reinterpret_cast<_t >(_e)#define OTL_DCAST(_t,_e) dynamic_cast<_t >(_e)#define OTL_CCAST(_t,_e) const_cast<_t >(_e)#define OTL_CONST_EXCEPTION const#if defined OTL_FUNC_THROW_SPEC_ON#define OTL_THROWS_OTL_EXCEPTION throw(otl_exception)#define OTL_NO_THROW throw()#else#define OTL_THROWS_OTL_EXCEPTION#define OTL_NO_THROW#endif#define OTL_TYPE_NAME typename#include <new>#else#define OTL_SCAST(_t,_e) ((_t)(_e))#define OTL_RCAST(_t,_e) ((_t)(_e))#define OTL_DCAST(_t,_e) ((_t)(_e))#define OTL_CCAST(_t,_e) ((_t)(_e))#define OTL_CONST_EXCEPTION#define OTL_THROWS_OTL_EXCEPTION#define OTL_NO_THROW#define OTL_TYPE_NAME class#endif#define OTL_PCONV(_to,_from,_val) \OTL_SCAST(_to,*OTL_RCAST(_from*,OTL_CCAST(void*,_val)))#if defined(OTL_ACE)#include <ace/SString.h>#include <ace/Array.h>#include <ace/Functor.h>#include <ace/RB_Tree.h>#define OTL_USER_DEFINED_STRING_CLASS_ON#define USER_DEFINED_STRING_CLASS ACE_TString#define OTL_VALUE_TEMPLATE_ONconst int otl_tmpl_vector_default_size=16;template<OTL_TYPE_NAME T>class otl_tmpl_vector: public ACE_Array<T>{public: otl_tmpl_vector(const int init_size=otl_tmpl_vector_default_size) : ACE_Array<T>(init_size==0?otl_tmpl_vector_default_size:init_size) { _length=0; } ~otl_tmpl_vector(){} int capacity(void) const { return this->max_size(); } int size(void) const { return _length; } void clear(void) { _length=0; } void resize(const int new_size, const T& t=T()) { ACE_Array<T>::size(new_size); if(new_size>_length){ for(int i=_length;i<new_size;++i) (*this)[i]=t; } _length=new_size; } void push_back(const T& elem) { int curr_max_size=this->max_size(); if(_length==curr_max_size) ACE_Array<T>::size(curr_max_size*2); ++_length; (*this)[_length-1]=elem; } void pop_back(void) { if(_length>0) --_length; }protected: int _length; };#endif#if defined(OTL_STLPORT)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -