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

📄 oracl.h

📁 VC数据库编程实例-ORACLE数据库VC数据库编程实例
💻 H
📖 第 1 页 / 共 4 页
字号:
};

// ----- OAdvise -----------------------------------------------
 
class OEXPORT OAdvise : public OOracleObject
{
public:
    OAdvise(void);
    OAdvise(const OAdvise &other);
    OAdvise(const ODynaset &odyn);  // construct & open
    virtual ~OAdvise(void);
    
    virtual oresult Open(const ODynaset &odyn);
    virtual oresult Close(void);  // stop the advisory sink
    
    // getting other objects
    ODynaset GetDynaset(void) const;
    
    // overloaded operators
    OAdvise &operator=(const OAdvise &other);
    
    // called before an action takes place
    virtual oboolean ActionRequest(int movekind);  // returns TRUE if action is allowed, FALSE to cancel
    
    // routines called to to notify that action occured
    virtual void ActionNotify(int movekind); 
    
    // routine called on status change
    virtual void StatusChange(int statuskind);
    
private:
    ODynaset  m_oDyn;    // the dynaset we're getting notices from
    
    // private helper routines
    oresult Cleanup(void);
	 oresult Copy(const OAdvise &other);
};

// ----- OParameter -----------------------------------------------

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

    short GetServerType(void) const;    

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

	 //V2.2 development , multiple cursor return
	 oresult GetValue(ODynaset *odyn) const;

    int	    Count (void);
    
    oresult Clear(void);
	 oresult SetValue(const OValue &val);
	 oresult SetValue(int val);
	 oresult SetValue(long val);
	 oresult SetValue(double val);
	 oresult SetValue(const char *val);
    oresult MinimumSize (long size);
    long    MinimumSize (void);

    // getting data (overloaded cast operators)
    operator int() const;
    operator long() const;
    operator double() const;
    operator const char *() const;

    // 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);
    OParameter Add(const char *name, long value, int iotype, int serverType);
    OParameter Add(const char *name, double value, int iotype, int serverType);
    OParameter Add(const char *name, const char *value, int iotype, int serverType);     
//BUG #262723
    OParameter Add(const char *name, const OValue &value, int iotype, int serverType);     

// PL/SQL table parameter
	 OParamArray AddTable(const char *name, int iotype, int serverType, int Dimension, int Size=0 );
    
    // 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);
};

// V2DEV -- New classes
// ----- 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 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 MinimumSize (long size);
    long    MinimumSize (void);

    // other status information
    int GetStatus(void) const;
	 const char *GetLastError(void);		// V2DEV - PL/SQL table parameters
	 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;
};

#ifdef ORAANSI
typedef char FAR* BSTRA;
typedef BSTRA * LPBSTRA;

typedef struct FARSTRUCT tagVARIANTA  VARIANTA;
typedef struct FARSTRUCT tagVARIANTA FAR * LPVARIANTA;
typedef struct FARSTRUCT tagVARIANTA VARIANTARGA;
typedef struct FARSTRUCT tagVARIANTA FAR * LPVARIANTARGA;

struct FARSTRUCT tagVARIANTA{
	VARTYPE vt;
	unsigned short wReserved1;
	unsigned short wReserved2;
	unsigned short wReserved3;
	union {
	  unsigned char bVal;              /* VT_UI1                */
	  short    iVal;              /* VT_I2                */
	  long     lVal;              /* VT_I4                */
	  float    fltVal;            /* VT_R4                */
	  double       dblVal;            /* VT_R8                */
	  VARIANT_BOOL boolvar;              /* VT_BOOL              */
	  SCODE    scode;             /* VT_ERROR             */
	  CY       cyVal;             /* VT_CY                */
	  DATE     date;              /* VT_DATE              */
	  BSTRA    bstrVal;           /* VT_BSTR              */
	  IUnknown     FAR* punkVal;      /* VT_UNKNOWN           */
	  IDispatch  FAR* pdispVal;     /* VT_DISPATCH          */
	  SAFEARRAY   FAR* parray;       /* VT_ARRAY|*           */

	  unsigned char    FAR* pbVal;        /* VT_BYREF|VT_UI1       */
	  short    FAR* piVal;        /* VT_BYREF|VT_I2       */
	  long     FAR* plVal;        /* VT_BYREF|VT_I4       */
	  float    FAR* pfltVal;      /* VT_BYREF|VT_R4       */
	  double       FAR* pdblVal;      /* VT_BYREF|VT_R8       */
	  VARIANT_BOOL FAR* pbool;        /* VT_BYREF|VT_BOOL     */
	  SCODE    FAR* pscode;       /* VT_BYREF|VT_ERROR    */
	  CY       FAR* pcyVal;       /* VT_BYREF|VT_CY       */
	  DATE     FAR* pdate;        /* VT_BYREF|VT_DATE     */
	  BSTRA    FAR* pbstrVal;     /* VT_BYREF|VT_BSTR     */
	  IUnknown   FAR* FAR* ppunkVal;  /* VT_BYREF|VT_UNKNOWN  */
	  IDispatch FAR* FAR* ppdispVal; /* VT_BYREF|VT_DISPATCH */
	  SAFEARRAY FAR* FAR* pparray;   /* VT_BYREF|VT_ARRAY|*  */
	  VARIANT    FAR* pvarVal;      /* VT_BYREF|VT_VARIANT  */

	  void     FAR* byref;        /* Generic ByRef        */
	}
#if defined(NONAMELESSUNION) || (defined(_MAC) && !defined(__cplusplus) && !defined(_CID_MS20))
	u
#endif
	;
};


STDAPI_(BSTRA) SysAllocStringA(const char FAR*);
#define SysAllocStringLenA	SysAllocStringByteLen
inline void SysFreeStringA(BSTRA bstr) { SysFreeString((BSTR)bstr); }
STDAPI_(int)   SysReAllocStringLenA(BSTRA FAR*, const char FAR*, unsigned int);
HRESULT ConvertVariantToA(LPVARIANTA);
HRESULT ConvertVariantToW(LPVARIANT);

STDAPI  VariantChangeTypeA(	VARIANTARGA FAR* pvargDest,VARIANTARGA FAR* pvarSrc,unsigned short wFlags,VARTYPE vt);


#endif // WRAPPER
#endif // ORACL_ORACLE

⌨️ 快捷键说明

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