⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 h_oracle.h

📁 使用OCI类的API函数
💻 H
字号:
//---------------------------------------------------------------------------

#ifndef h_oracleH
#define h_oracleH
//---------------------------------------------------------------------------
#include <oci.h>
#include <set>
#include <vector>
using namespace std;

struct ColumnDes
{
  int ColId;
  AnsiString ValueOfLog;
  AnsiString ColumnName;
  AnsiString DataType;
  int        DataLength;
  int        DataPrecision;
  int        DataScale;
  bool IsNull;
  bool IsKey;
  AnsiString Comment;
  char *    ColValue;
  signed short     NullInd;
  //Added by Liaoyangbo
  //是否为大对象字段
  bool IsBlob;
  //是否为LONG字段类型
  bool IsLong;
  //End by Liaoyangbo
};

struct TableDes
{
  AnsiString  TableOwner;
  AnsiString  TableName;
  AnsiString  TableSpace;
  int         Rows;
  AnsiString  Type;        //oracle use
  vector <ColumnDes> Fields;
  AnsiString   GetColOk;
  bool      GetKeyOk;
  bool      GetIndexOk;
  //Add by Liaoyangbo
  //增加该表是否存在大对象类型
  bool      IsBlob;
  //是否含有LONG字段类型
  bool      hasLong;
  //End by Liaoyangbo
};



struct TableData
{
    AnsiString col1;
    AnsiString col2;
    AnsiString col3;
    AnsiString col4;
};

class HOracle
{
public :
   __fastcall HOracle(void);
   __fastcall ~HOracle(void);
   static void __fastcall Prepare(void);
   bool __fastcall Init(void);
   static bool __fastcall SchemaInBlackList(const AnsiString &Schema);
   bool __fastcall Connect(const AnsiString &DatabaseName,
      const AnsiString &UserId, const AnsiString &Password,
      bool Sysdba = false);
   void __fastcall Disconnect(void);
   bool __fastcall GetTableInfoList(vector <TableDes> &TableList,AnsiString DBName);
   bool __fastcall HOracle::GetTableCol(AnsiString tableName,
         AnsiString tableOwner, vector <ColumnDes> &TableCols);
   bool __fastcall GetTableDataInfo(AnsiString tableName, AnsiString tableOwner, vector <TableData> &TableData);

   OCILobLocator *srcLocator;
   OCILobLocator *dstLocator;
private :
   bool FInitOk;
   static set<AnsiString> BlackList;

   OCIEnv *FEnvhp;
   OCIServer *FSrvhp;
   OCIError *FErrhp;
   OCISvcCtx *FSvchp;
   OCISession *FSsnhp;

   AnsiString FErrorString;
   int DbIndex;
   bool FConnected;
   bool __fastcall AllocateHandles(void);
   void __fastcall FreeHandles(void);
   int __fastcall CreateErrorString(const AnsiString &Text, bool Env = false);

   //Add by Liaoyangbo
   //增加大对象类型列表
   static set<AnsiString> BlobList;

   void __fastcall prepareBlob(void);
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -