otl翻译(11) -- OTL的迭代器

OTL stream read iterator

这个类是一个像传统的JDBC中的getter()操作一样扩展了OTL流的模板类。它现在还不支持UNICODE字符集。它对otl_refcur_stream和otl_stream的使用基本相同(在ORACLE8版本里面)。

模板的定义如下:

template<typename OTLStream,

         typename OTLException

#if !defined(OTL_ORA7)

  // when any flavor of OTL but OTL_ORA7 is defined:

  // OTL_ORA8, OTL_ORA8I, OTL_ORA9I, OTL_ORA10G,

  // OTL_ORA10G_R2, OTL_ODBC, OTL_DB2_CLI

         ,typename OTLLobStream

#endif

        >

class otl_stream_read_iterator{

//...

}

下面为相关的函数与说明:

序号

函数

说明

1

otl_stream_read_iterator();

默认构造函数

2

~otl_stream_read_iterator();

析构函数

3

otl_stream_read_iterator(OTLStream& s);

构造函数。把它附着到一个流上面

4

void attach(OTLStream& s);

附加到一个流上面

5

void reattach();

重新附加到一个相同的流上面。

它是在对同一个游标流关闭后再打开的情况下使用。

6

void detach();

从流中分离出来

7

bool next_row();

读取下一条记录。如果有下一条记录,则返回真。如果没有下一条记录直接到达结尾,则返回假。

8

const otl_var_desc* describe(int& var_desc_len);

解析输出字段的结构。参数为参数个数。相同的功能与otl_stream::describe_out_vars()。

9

void get(const int pos, char& c);

通过位置读取一个字符

10

void get(const int pos, unsigned char& c);

通过位置读取一个无符号字符

11

void get(const int pos, char* s);

通过位置读取一个字符串

12

void get(const int pos, unsigned char* s);

通过位置读取一个无符号字符串

13

void get(const int pos, int& n);

通过位置读取一个32位整型

14

void get(const int pos, unsigned int& n);

通过位置读取一个32位无符号整型

15

void get(const int pos, short int& n);

通过位置读取一个短整型

16

void get(const int pos, long int& n);

通过位置读取一个长整型

17

void get(const int pos, float& n);

通过位置读取一个4字节长度的浮点型

18

void get(const int pos, double& n);

通过位置读取一个8字节长度的浮点型

19

void get(const int pos, OTL_BIGINT& n);

读取一个有符号的64位整型

20

void get(const int pos, OTL_STRING_CONTAINER& s);

当定义了OTL_STL宏的时候读取string;

当定义了OTL_STLPORT宏的时候读取string;

当定义了OTL_ACE宏的时候读取ACE_TString;

当定义了OTL_USER_DEFINED_STRING_CLASS_ON宏的时候,读取USER_DEFINED_STRING_CLASS;

它还可以用来读取VARCHAR/CHAR/LONG/TEXT等大对象。

21

void get(const int pos, otl_long_string& s);

读取otl_long_string类型

22

void get(const int pos, otl_long_string*& s);

通过引用的指针读取otl_long_string类型。这个在读取大对象的时候性能比上面的更好。

23

void get(const int pos, otl_lob_stream*& s);

仅在OCI8/9/10/11时候适用。

从一个大对象流中读取大对象。需要在LOG_STREAM_MODE模式下。

24

void get(const int pos, otl_datetime& s);

通过位置读取一个日期时间类型

25

bool is_null(const int pos);

如果指定位置为空,则返回真。否则返回假。

26

void get(const char* var_name, char& c);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

通过指定变量名读取一个字符

27

void get(const char* var_name, unsigned char& c);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

通过指定变量读取一个无符号字符

28

void get(const char* var_name, char* s);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

通过指定的变量读取一个字符串

29

void get(const char* var_name, unsigned char* s);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

通过指定变量读取一个无符号字符串

30

void get(const char* var_name, int& n);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

通过指定变量读取一个整型

31

void get(const char* var_name, unsigned int& n);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

通过指定变量读取一个无符号整型

32

void get(const char* var_name, short int& n);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

通过指定变量读取一个短整型

33

void get(const char* var_name, long int& n);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

通过指定变量读取一个长整型

34

void get(const char* var_name, float& n);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

通过指定变量读取一个4字节长度的浮点型

35

void get(const char* var_name, double& n);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

通过指定变量读取一个8字节长度的浮点型

36

void get(const char* var_name, OTL_BIGINT& n);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

通过指定变量读取一个64位长整型

37

void get(const char* var_name, OTL_STRING_CONTAINER& s);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

在定义了OTL_STL的情况下读取一个std::string类型。可以用来读取VARCHAR/CHAR/TEXT等类型。

38

void get(const char* var_name, otl_long_string& s);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

读取一个otl_long_string类型

39

void get(const char* var_name, otl_long_string*& s);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

读取一个otl_long_string类型引用指针。在读取大对象的时候性能比较好。

40

void get(const char* var_name, otl_lob_stream*& s);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

读取一个otl_lob_stream对象的引用指针

41

void get(const char* var_name, otl_datetime& s);

需要定义OTL_STL或OTL_STLPORT或OTL_ACE宏。

通过指定变量读取一个日期时间类型

42

bool is_null(const char* var_name);

如果指定的变量为空,返回真,否则返回假。

原文地址:https://www.cnblogs.com/fnlingnzb-learner/p/5903322.html