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

📄 oracl.h

📁 这是书上的代码
💻 H
📖 第 1 页 / 共 5 页
字号:
	operator ORef () const throw(OException);
	operator OCollection () const throw(OException);

    // other status information
    int GetStatus(void) const;
    
    // enabling
    oresult AutoEnable(oboolean enable);

    // function used by other classes to construct OParameter objects (don't call this!)
    oresult OpenHelper(void *idisp, void *otheri);  // finish the work of opening the object

	// PL/SQL cursor return options
	void SetDynasetOption(long options);
	void SetDynasetCacheParams(long SliceSize, long perblock, long Blocks, long FetchLimit, long FetchSize) ;

private:
    char *m_name; 
    char *m_data;

    // internal helper routines
    oresult Copy(const OParameter &other);
	oresult Cleanup(void);
	oresult HelpGetValue(OOLEvar *tempv) const;
};

// ----- OParameterCollection -----------------------------------------------

class OEXPORT OParameterCollection : public OOracleObject
{
public:
    OParameterCollection(void);
    OParameterCollection(const OParameterCollection &other);
    ~OParameterCollection(void);
    
    oresult Close(void);
    
    // overloaded operators
    OParameterCollection &operator=(const OParameterCollection &other);
    
    // getting other objects
    OParameter GetParameter(int index) const;
    OParameter GetParameter(const char *pname) const;
	OParamArray GetParamArray(int index) const;
	OParamArray GetParamArray(const char *pname) const;

    // adding a new parameter
    OParameter Add(const char *name, int value, int iotype, int serverType, char* object_name = NULL);
    OParameter Add(const char *name, long value, int iotype, int serverType, char* object_name = NULL);
    OParameter Add(const char *name, double value, int iotype, int serverType, char* object_name = NULL);
    OParameter Add(const char *name, const char *value, int iotype, int serverType, char* object_name = NULL);     
	OParameter Add(const char *name, const OBlob &value, int iotype, int servertype);
	OParameter Add(const char *name, const OClob &value, int iotype, int servertype);
	OParameter Add(const char *name, const OBfile &value, int iotype, int servertype);
	OParameter Add(const char *name, const OObject &value, int iotype, int servertype, char* object_name);
	OParameter Add(const char *name, const ORef &value, int iotype, int servertype, char* object_name = NULL);
	OParameter Add(const char *name, const OCollection &value, int iotype, int servertype, char* object_name);
    OParameter Add(const char *name, const OValue &value, int iotype, int serverType, char* object_name = NULL);     

	// array binding
	OParamArray AddTable(const char *name, int iotype, int serverType, int Dimension, int Size=0, char* object_name = NULL);
    
    // removing a parameter
    oresult Remove(int index);
    oresult Remove(const char *name);

    // getting # of parameters
	long GetCount(void) const;

    // function used by other classes to construct OParameterCollection objects (don't call this!)
    oresult OpenHelper(void *idisp, void *otheri);  // finish the work of opening the set

private:
    // internal helper routines
	int m_arraysize ;	// ARRAYINSERT
	oresult Copy(const OParameterCollection &other);
    oresult Cleanup(void);   
	OParameter AddHelp(const char *name, const OValue &val, int iotype, int serverType, char* object_name = NULL);
};


// ----- OSqlStmt -----------------------------------------------

class OEXPORT OSqlStmt : public OOracleObject
{
public:
    // construction & destruction
	 OSqlStmt(void);
	 OSqlStmt(const OSqlStmt &other);
	 OSqlStmt(const ODatabase &odb, const char *sql_statement,
					long options = OSQLSTMT_DEFAULT);  // construct & open
	 ~OSqlStmt(void);

	 // Open takes an SQL query as an argument.  This constructs a set of records which can
	 //    then be accessed.
	 oresult Open(const ODatabase &odb, const char *sql_statement,
						long options = OSQLSTMT_DEFAULT);  // creates a dynaset object
	 oresult Close(void);

    // getting other objects
	 ODatabase GetDatabase(void) const;
	 OSession GetSession(void) const;
	 OConnection GetConnection(void) const;

	 // overloaded operators
	 OSqlStmt &operator=(const OSqlStmt &other);
    
	 // the sql statement of the object
	 oresult SetSQL(const char *sql_statement);  // sets new sql statement
     const char *GetSQL(void) const;  // gets sql statement
	 oresult Refresh(void);  // refresh with current sql statement

	 // editing
	 oboolean CanTransact(void) const;  // returns TRUE if transaction processing is enabled
	 // others
	 oboolean CanRefresh(void) const;  // our sql statement can always requery

	 long GetOptions(void) const;
	 long GetRecordCount(void) const;

	 // function used by other classes to construct ODynaset objects (don't call this!)
	 oresult OpenHelper(void *idisp, void *otheri);

private:
	 char *m_sqlstmt;  // the sql statement that creates the dynaset

	 // internal helper routines
	 oresult Copy(const OSqlStmt &other);
	 oresult Cleanup(void);
};

// ----- OParamArray -----------------------------------------------

class OEXPORT OParamArray : public OOracleObject
{
public:
	 OParamArray(void);
	 OParamArray(const OParamArray &other);
	 ~OParamArray(void);
    
    oresult Close(void);
    
    // overloaded operators
	OParamArray &operator=(const OParamArray &other);
    
    // parameter name
    const char *GetName(void) const;

    short GetServerType(void) const;    

	const char *GetLastErrorText(void ) ;
    
    // parameter value
	oresult GetValue(OValue *val, int index) const;
	oresult GetValue(int *val, int index) const;
	oresult GetValue(long *val, int index) const;
	oresult GetValue(double *val, int index) const;
	oresult GetValue(const char **val, int index) const;

	oresult GetValue(OBlob *val, int index) const;
	oresult GetValue(OClob *val, int index) const;
	oresult GetValue(OBfile *val, int index) const;
	oresult GetValue(ORef *val, int index) const;
	oresult GetValue(OObject *val, int index) const;
	oresult GetValue(OCollection *val, int index) const;

	oresult Clear(void);
	oresult SetValue(const OValue &val, int index);
	oresult SetValue(int val, int index);
	oresult SetValue(long val, int index);
	oresult SetValue(double val, int index);
	oresult SetValue(const char *val, int index);

	oresult SetValue(const OBlob &val, int index);
	oresult SetValue(const OClob &val, int index);
	oresult SetValue(const OBfile &val, int index);
	oresult SetValue(const ORef &val, int index);
	oresult SetValue(const OObject &val, int index);
	oresult SetValue(const OCollection &val, int index);

    oresult MinimumSize (long size);
    long    MinimumSize (void);

    // other status information
    int GetStatus(void) const;
	const char *GetLastError(void);		
	int GetArraySize(void);

	 // enabling
    oresult AutoEnable(oboolean enable);

    // function used by other classes to construct OParameter objects (don't call this!)
    oresult OpenHelper(void *idisp, void *otheri);  // finish the work of opening the object

private:
	char *m_name; 
    char **m_data;
    char *m_errtext;

    // internal helper routines
	oresult Copy(const OParamArray &other);
    oresult Cleanup(void);
	oresult HelpGetValue(OOLEvar *tempv, unsigned int index) const;
};


// ----- ODatabaseCollection -----------------------------------------------

class OEXPORT ODatabaseCollection : public OOracleCollection
{
public:
    ODatabase GetDatabase(int index) const;

    // function used by other classes to construct OConnectionCollection objects (don't call this!)
    oresult OpenHelper(void *idisp, void *otheri);  // finish the work of opening the set
};


// ----- OException ---------------------------------------------------------
//
//   Oracle Exception Class
//
//   This exception object is thrown by new methods (ver >= 8.1.6) when 
//   error conditions occur. 

class OEXPORT OException
{
public:
    // constructors & destructors
	OException(const OException &other);
	virtual ~OException(void);

	//these two constructors for internal use only
    OException(const char *methodName, const OOracleObject *other);
    OException(const char *methodName, int arg, const OOracleObject *other);
    
	OException &operator=(const OException &other);

	//public methods
	virtual const char *GetErrorText(void) const; //OIP error text when available
	virtual long  GetErrorNumber(void) const;     //Error Number
	virtual const char *GetFailedMethodName(void) const; //id of exception source
    
	//internal use
	virtual void SetFailedMethodName(const char *method);
protected:
	virtual void Copy(const OException &other);
	virtual void Cleanup(void);
	
private:
    char *m_methodname;
	char *m_oiperrtxt;
    long m_errnum;
	int m_arg;

	void HelpInit(void);
	void HelpInit(const char *methodName, int arg, const OOracleObject *other);	
};


// ----- OServer -----------------------------------------------

class OEXPORT OServer : public OOracleObject
{

public:
	
	// construction & destruction
	OServer(void) throw(OException); 
	OServer(const OServer& other) throw(OException);
    OServer(const char *server_alias) throw(OException);

	OServer(void *dp);

	~OServer(void); 

	OServer &operator=(const OServer &other);

	//methods
	void ChangePassword(const char *username, const char *current_pass, const char *new_pass) const throw(OException);
	
	void Open(const char *server_alias) throw(OException);
	void Close(void) throw(OException);

	//properties
	const char* GetName(void) throw(OException);
	OSession GetSession(void) const throw(OException);
	ODatabaseCollection GetDatabases(void) const throw(OException);
	
private:
	char *m_name;
	void HelpInit(void);
	oresult Copy(const OServer &other);
    oresult Cleanup(void);
};


// ----- OObject --------------------------------------------------

class OEXPORT OObject : public OOracleObject
{
public:
    // construction & destruction
	OObject(void) throw(OException);
	OObject(const OObject& other) throw(OException);
	OObject(ODatabase& odb, const char *type_name) throw(OException);
    virtual ~OObject(void);

	OObject(void *dp);
 
	OObject &operator=(const OObject &other);

	//methods
	void Open(ODatabase& odb, const char *type_name) throw(OException);
	virtual void Close(void) throw(OException);

	OObject Clone(void) const throw(OException);
	void Clone(OObject *clone) const throw(OException);

	OValue GetAttrValue(int index) const throw(OException);
	OValue GetAttrValue(const char *attrname) const throw(OException);

	void GetAttrValue(int index, OValue *value) const throw(OException);	
	void GetAttrValue(int index, int *val) const throw(OException);
	void GetAttrValue(int index, long *val) const throw(OException);
	void GetAttrValue(int index, double *val) const throw(OException);
	void GetAttrValue(int index, char *val, unsigned short maxlen) const throw(OException);
	void GetAttrValue(int index, OBlob *val) const throw(OException);
	void GetAttrValue(int index, OClob *val) const throw(OException);
	void GetAttrValue(int index, OBfile *val) const throw(OException);
	void GetAttrValue(int index, ORef *val) const throw(OException);
	void GetAttrValue(int index, OObject *val) const throw(OException);
	void GetAttrValue(int index, OCollection *val) const throw(OException);
	
	void GetAttrValue(const char *attrname, OValue *value) const throw(OException);
	void GetAttrValue(const char *attrname, int *val) const throw(OException);
	void GetAttrValue(const char *attrname, long *val) const throw(OException);
	void GetAttrValue(const char *attrname, double *val) const throw(OException);
	void GetAttrValue(const char *attrname, char *val, unsigned short maxlen) const throw(OException);
	void GetAttrValue(const char *attrname, OBlob *val) const throw(OException);
	void GetAttrValue(const char *attrname, OClob *val) const throw(OException);
	void GetAttrValue(const char *attrname, OBfile *val) const throw(OException);
	void GetAttrValue(const char *attrname, ORef *val) const throw(OException);
	void GetAttrValue(const char *attrname, OObject *val) const throw(OException);
	void GetAttrValue(const char *attrname, OCollection *val) const throw(OException);
	

	void SetAttrValue(int index, const OValue& val) const throw(OException);
	void SetAttrValue(int index, int val) const throw(OException);
	void SetAttrValue(int index, long val) const throw(OException);
	void SetAttrValue(int index, double val) const throw(OException);
	void SetAttrValue(int index, const char *val) const throw(OException);
	void SetAttrValue(int index, const OBlob  &val) const throw(OEx

⌨️ 快捷键说明

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