?? otl.hpp
字號:
int find(const int ndx) { int i; for(i=0;i<len;++i) if(ndx==col_ndx[i]) return i; return -1; } void set_all_column_types(const unsigned int amask=0) { all_mask=amask; } int getLen(void){return len;}protected: int container_size_;private:// this class is not meant to be copied: copy constructor and// operator= are declared private otl_select_struct_override(const otl_select_struct_override&): col_ndx(0), col_type(0), col_size(0), len(0), all_mask(0), lob_stream_mode(false), container_size_(0) { } otl_select_struct_override& operator=(const otl_select_struct_override&) { return *this; }};inline int otl_decimal_degree(unsigned int num){ int n=0; while(num!=0){ ++n; num/=10; } return n;}inline bool otl_isspace(char c){ return c==' '||c=='\t'||c=='\n'|| c=='\r'||c=='\f'||c=='\v';}inline char otl_to_upper(char c){ return OTL_SCAST(char,toupper(c));}inline unsigned int otl_to_fraction(unsigned int fraction,int frac_prec){ if(fraction==0||frac_prec==0)return fraction; int degree_diff=9-frac_prec; for(int i=0;i<degree_diff;++i) fraction*=10; return fraction;}inline unsigned int otl_from_fraction(unsigned int fraction,int frac_prec){ if(fraction==0||frac_prec==0)return fraction; int degree_diff=9-frac_prec; for(int i=0;i<degree_diff;++i) fraction/=10; return fraction;}#define OTL_NO_STM_TEXT "#No Stm Text available#"class otl_datetime{public: int year; int month; int day; int hour; int minute; int second; unsigned long fraction; int frac_precision;#if defined(OTL_ORA_TIMESTAMP) || defined(OTL_ODBC_TIME_ZONE) short int tz_hour; short int tz_minute;#endif otl_datetime(): year(1900), month(1), day(1), hour(0), minute(0), second(0), fraction(0), frac_precision(0)#if defined(OTL_ORA_TIMESTAMP) || defined(OTL_ODBC_TIME_ZONE) ,tz_hour(0), tz_minute(0)#endif { } otl_datetime (const int ayear, const int amonth, const int aday, const int ahour, const int aminute, const int asecond, const unsigned long afraction=0, const int afrac_precision=0#if defined(OTL_ORA_TIMESTAMP)||defined(OTL_ODBC_TIME_ZONE) , const short int atz_hour=0, const short int atz_minute=0#endif ): year(ayear), month(amonth), day(aday), hour(ahour), minute(aminute), second(asecond), fraction(afraction), frac_precision(afrac_precision)#if defined(OTL_ORA_TIMESTAMP)||defined(OTL_ODBC_TIME_ZONE) ,tz_hour(atz_hour), tz_minute(atz_minute)#endif { } otl_datetime(const otl_datetime& dt): year(dt.year), month(dt.month), day(dt.day), hour(dt.hour), minute(dt.minute), second(dt.second), fraction(dt.fraction), frac_precision(dt.frac_precision)#if defined(OTL_ORA_TIMESTAMP)||defined(OTL_ODBC_TIME_ZONE) ,tz_hour(dt.tz_hour), tz_minute(dt.tz_minute)#endif { } ~otl_datetime(){} otl_datetime& operator=(const otl_datetime& dt) { copy(dt); return *this; }protected: void copy(const otl_datetime& dt) { year=dt.year; month=dt.month; day=dt.day; hour=dt.hour; minute=dt.minute; second=dt.second; fraction=dt.fraction; frac_precision=dt.frac_precision;#if defined(OTL_ORA_TIMESTAMP)||defined(OTL_ODBC_TIME_ZONE) tz_hour=dt.tz_hour; tz_minute=dt.tz_minute;#endif }};class otl_oracle_date{public: unsigned char century; unsigned char year; unsigned char month; unsigned char day; unsigned char hour; unsigned char minute; unsigned char second; otl_oracle_date(): century(0), year(0), month(0), day(0), hour(0), minute(0), second(0) { } ~otl_oracle_date(){}};inline void convert_date(otl_datetime& t,const otl_oracle_date& s){ t.year=(OTL_SCAST(int, s.century-100)*100+(OTL_SCAST(int, s.year-100))); t.month=s.month; t.day=s.day; t.hour=s.hour-1; t.minute=s.minute-1; t.second=s.second-1;}inline void convert_date(otl_oracle_date& t,const otl_datetime& s){ t.year=OTL_SCAST(unsigned char, ((s.year%100)+100)); t.century=OTL_SCAST(unsigned char, ((s.year/100)+100)); t.month=OTL_SCAST(unsigned char, s.month); t.day=OTL_SCAST(unsigned char, s.day); t.hour=OTL_SCAST(unsigned char, (s.hour+1)); t.minute=OTL_SCAST(unsigned char, (s.minute+1)); t.second=OTL_SCAST(unsigned char, (s.second+1));}class otl_null{public:#if (defined(_MSC_VER)&&(_MSC_VER==1200)) int dummy; // this is to fix a compiler bug in VC++ 6.0#endif otl_null(){} ~otl_null(){}};class otl_column_desc{public: char* name; int dbtype; int otl_var_dbtype;#if defined(_WIN64) __int64 dbsize;#else int dbsize;#endif int scale;#if defined(_WIN64) __int64 prec;#else int prec;#endif int nullok;#if defined(OTL_ORA_UNICODE)||defined(OTL_ORA_UTF8) int charset_form; int char_size;#endif otl_column_desc(): name(0), dbtype(0), otl_var_dbtype(0), dbsize(0), scale(0), prec(0), nullok(0),#if defined(OTL_ORA_UNICODE)||defined(OTL_ORA_UTF8) charset_form(0), char_size(0),#endif name_len_(0) { } ~otl_column_desc() { delete[] name; } otl_column_desc& operator=(const otl_column_desc& desc) { if(name_len_>=desc.name_len_) OTL_STRCPY_S(name,name_len_,desc.name); else if(name==0 && desc.name!=0){ name=new char[desc.name_len_]; name_len_=desc.name_len_; OTL_STRCPY_S(name,name_len_,desc.name); }else if(name_len_<desc.name_len_ && desc.name!=0){ delete[] name; name=new char[desc.name_len_]; name_len_=desc.name_len_; OTL_STRCPY_S(name,name_len_,desc.name); } dbtype=desc.dbtype; otl_var_dbtype=desc.otl_var_dbtype; dbsize=desc.dbsize; scale=desc.scale; prec=desc.prec; nullok=desc.nullok;#if defined(OTL_ORA_UNICODE)||defined(OTL_ORA_UTF8) charset_form=desc.charset_form; char_size=desc.char_size;#endif return *this; } void set_name(const char* aname,const int aname_len=0) { int len; if(aname_len==0) len=OTL_SCAST(int,strlen(aname))+1; else len=aname_len+1; if(name_len_<len){ if(name)delete[] name; name=new char[len]; name_len_=len; for(int i=0;i<len-1;++i) name[i]=aname[i]; name[len-1]=0; } }protected: int name_len_;private: otl_column_desc(const otl_column_desc&): name(0), dbtype(0), otl_var_dbtype(0), dbsize(0), scale(0), prec(0), nullok(0),#if defined(OTL_ORA_UNICODE)||defined(OTL_ORA_UTF8) charset_form(0), char_size(0),#endif name_len_(0) { }};class otl_var_desc{public: int param_type; int ftype; int elem_size; int array_size; int pos; int name_pos; char name[128]; int pl_tab_flag; otl_var_desc(): param_type(0), ftype(0), elem_size(0), array_size(0), pos(0), name_pos(0), name(), pl_tab_flag(0) { name[0]=0; } ~otl_var_desc(){} void copy_name(const char* nm) { if(!nm) name[0]=0; else{#if defined(_MSC_VER)#if (_MSC_VER >= 1400) OTL_STRNCPY_S(name,sizeof(name),nm,sizeof(name)-1); name[sizeof(name)-1]=0;#else strncpy(name,nm,sizeof(name)); name[sizeof(name)-1]=0;#endif#else strncpy(name,nm,sizeof(name)); name[sizeof(name)-1]=0;#endif } }};const int otl_var_none=0;const int otl_var_char=1;const int otl_var_double=2;const int otl_var_float=3;const int otl_var_int=4;const int otl_var_unsigned_int=5;const int otl_var_short=6;const int otl_var_long_int=7;const int otl_var_timestamp=8;const int otl_var_varchar_long=9;const int otl_var_raw_long=10;const int otl_var_clob=11;const int otl_var_blob=12;const int otl_var_refcur=13;const int otl_var_long_string=15;const int otl_var_db2time=16;const int otl_var_db2date=17;const int otl_var_tz_timestamp=18;const int otl_var_ltz_timestamp=19;const int otl_var_bigint=20;#if defined(OTL_ORA_UNICODE)||defined(OTL_ORA_UTF8)const int otl_var_nchar=21;const int otl_var_nclob=22;#else#endifconst int otl_var_raw=23;const int otl_var_lob_stream=100;const int otl_bigint_str_size=40;class otl_long_string{public:
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -