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

📄 oracl.h

📁 VC数据库编程实例-ORACLE数据库VC数据库编程实例
💻 H
📖 第 1 页 / 共 4 页
字号:
	 oresult CancelEdit(void); // cancels edit operation
    oresult Update(void);     // finishes editing
	 oresult DuplicateRecord(void);  // copy the current record, adds a new record, sets field to copied values

	 // V2DEV -	Find methods
	 oresult FindFirst(const char *sql);
	 oresult FindNext(const char *sql = 0);
	 oresult FindPrevious(const char *sql = 0);
	 oresult FindLast(const char *sql);
	 oboolean NoMatch(void);							// TRUE if find failed

	 // V2DEV - Tunable cache and fetch parameters
	 unsigned int GetCacheSliceSize (void);
	 unsigned int GetCacheSlicePerBlock (void);
	 unsigned int GetCacheBlocks (void);
	 unsigned int GetFetchLimit (void);
	 unsigned int GetFetchSize (void);
	 void SetCacheSliceSize (unsigned int slice);
	 void SetCacheSlicePerBlock (unsigned int perblock);
	 void SetCacheBlocks (unsigned int blocks);
	 void SetFetchLimit (unsigned int flimit);
	 void SetFetchSize (unsigned int fsize);
	 oboolean IsCacheChanged(void);	// TRUE if cache or fetch parameters changed

	 // V2.1 dev - paste to clipboard functions
	 oresult PlsqlOpen(const ODatabase &odb, const char *sqlst, 
							const char *CursorName, long options);
	 oresult PlsqlOpen(const ODatabase &odb, const char *sqlst, const char *CursorName, 
					unsigned int slicesize, unsigned int perblock,
					unsigned int blocks, unsigned int fetchlimit,
					unsigned int fetchsize, long options);

	 // others
	 oboolean CanRefresh(void) const;  // our dynasets can always requery
    oboolean CanScroll(void) const;    // always scrollable
	 oboolean CanMark(void) const;
    
    long GetOptions(void) const;

    // record manipulation
    oresult AddNewRecord(void);
	 oresult DeleteRecord(void);
    
    // record access
	 int GetFieldCount(void) const;  // returns # of fields in a record
    long GetRecordCount(void) const;  // (dangerous!) gets total number of records in dynaset
                         // this routine downloads the entire dynaset to the client   
	 int GetFieldIndex(const char *fieldname) const;  // gets the index of a field by name

	 // all the Get and Set methods can refer to a column either by index (column position in the
    //    query) or by fieldname (the name of the column as specified in the query).  GetFieldIndex
	 //    can be used to find the index of columns - which is more efficient
    short GetFieldServerType(int index) const;
    short GetFieldServerType(const char *fieldname) const;
	 short GetFieldPrecision(int index) const;
    short GetFieldPrecision(const char *fieldname) const;
    short GetFieldScale(int index) const;
	 short GetFieldScale(const char *fieldname) const;
    oboolean IsFieldNullOK(int index) const;
    oboolean IsFieldNullOK(const char *fieldname) const;

    long GetFieldSize(int index) const;
    long GetFieldSize(const char *fieldname) const;
	 long GetFieldServerSize(int index) const;
    long GetFieldServerSize(const char *fieldname) const;
	 oboolean IsFieldTruncated(int index) const;
	 oboolean IsFieldTruncated(const char *fieldname) const;
    
	 // get data from a field, either by name or index
    oresult GetFieldValue(int index, OValue *val) const;
	 oresult GetFieldValue(const char *fieldname, OValue *val) const;
    oresult GetFieldValue(int index, int *val) const;
	 oresult GetFieldValue(const char *fieldname, int *val) const;
    oresult GetFieldValue(int index, long *val) const;
	 oresult GetFieldValue(const char *fieldname, long *val) const;
    oresult GetFieldValue(int index, double *val) const;
	 oresult GetFieldValue(const char *fieldname, double *val) const;
	 oresult GetFieldValue(int index, char *val, unsigned short maxlen) const;
	 oresult GetFieldValue(const char *fieldname, char *val, unsigned short maxlen) const;
	 oresult GetFieldValue(int index, void __huge *longval, long len, long *readlen) const;
    oresult GetFieldValue(const char *fieldname, void __huge *longval, long len, long *readlen) const;
	 oresult GetFieldChunk(int index, void *chunkp, long offset, unsigned short len) const;
	 oresult GetFieldChunk(const char *fieldname, void *chunkp, long offset,
								unsigned short len) const;
	 oresult GetFieldChunk(int index, void *chunkp, long offset,
								unsigned short len, unsigned short *bytesread) const;
	 oresult GetFieldChunk(const char *fieldname, void *chunkp, long offset,
								unsigned short len, unsigned short *bytesread) const;

    // set data in a field, either by name or index
	 oresult SetFieldValue(int index, const OValue &val);
    oresult SetFieldValue(const char *fieldname, const OValue &val);
	 oresult SetFieldValue(int index, int val);
    oresult SetFieldValue(const char *fieldname, int val);
	 oresult SetFieldValue(int index, long val);
    oresult SetFieldValue(const char *fieldname, long val);
	 oresult SetFieldValue(int index, double val);
    oresult SetFieldValue(const char *fieldname, double val);
	 oresult SetFieldValue(int index, const char *val);
	 oresult SetFieldValue(const char *fieldname, const char *val);
	 oresult SetFieldValue(int index, const void __huge *longval, long len);
	 oresult SetFieldValue(const char *fieldname, const void __huge *longval, long len);
	 oresult AppendFieldChunk(int index, const void *chunkp, unsigned short len);
	 oresult AppendFieldChunk(const char *fieldname, const void *chunkp, unsigned short len);

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

	oboolean IsFirst(void) const;
	oboolean IsLast(void) const;

    oboolean IsFieldUpdatable(int index) const;
    oboolean IsFieldUpdatable(const char *fieldname) const;
    oresult SetFieldUpdatable(int index, oboolean update) const;
    oresult SetFieldUpdatable(const char *fieldname, oboolean update) const;

	// V2.1 dev - Original Column name and update source
	oresult GetOrigFieldIndex(const char *fieldname) const;
	const char * GetFieldName(int index) const;
	const char * GetFieldOriginalName(int index) const;
 	oresult UpdateSource(int index, updsrcs updsrc, const char *source=NULL);
	oresult UpdateSource(const char *fieldname, updsrcs updsrc, const char *source=NULL);
	oresult CopyToClipboard(long NumOfRows);
	oresult CopyToClipboard(long NumOfRows, char colsep, char rowsep);

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

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

// ----- ODynasetMark -----------------------------------------------

class OEXPORT ODynasetMark : public OOracleObject
{
public:
	 // construction & destruction
    ODynasetMark(void); 
	 ODynasetMark(const ODynasetMark &other);
	 ~ODynasetMark(void);
    
    // overloaded operators
	 ODynasetMark &operator=(const ODynasetMark &other);
	 int operator==(const ODynasetMark &other) const;
    int operator!=(const ODynasetMark &other) const;

    
    oresult Close(void);
    oboolean IsOpen(void) const;
    
    // function used by other classes to construct ODynasetMark objects (don't call this!)
    oresult OpenHelper(void *idisp, void *otheri);
    
    char *Internal(void) const;

private:
    char  *m_markdata;  // holds data for bookmark
    
    oresult Cleanup(void);
};

// ----- OField -----------------------------------------------

class OEXPORT OField : public OOracleObject
{
public:
    // construction & destruction
    OField(void);
    OField(const OField &other);
    ~OField(void);              
    
    oresult Close(void);
    
    // overloaded operators
    OField &operator=(const OField &other);
    
    // other objects
    ODynaset GetDynaset(void) const;
    
    // properties
    const char *GetName(void) const; // returns name of field (user doesn't need to free)
    long GetSize(void) const;  // returns length of field
    long GetServerSize(void) const;  // returns length of a field (in server)
    short GetServerType(void) const;
    short GetPrecision(void) const;
    short GetScale(void) const;
    oboolean IsNullOK(void) const;
	 oboolean IsTruncated(void) const;
	 // V2DEV - Added
	 oboolean IsUpdatable(void) const;
	 oresult SetUpdatable(oboolean upd = TRUE);

    // field value
    oresult GetValue(OValue *val) const;  // returns value of field in val
    oresult GetValue(int *val) const;
    oresult GetValue(long *val) const;
    oresult GetValue(double *val) const;
    oresult GetValue(const char **val) const;
    oresult GetValue(void __huge *longval, long len, long *readlen) const;
    oresult SetValue(const OValue &val);  // sets the field to new value
    oresult SetValue(int val);
    oresult SetValue(long val);
    oresult SetValue(double val);
    oresult SetValue(const char *val);
    oresult SetValue(const void __huge *longval, long len); 
    
    // for long fields
    oresult AppendChunk(const void *chunkp, unsigned short numbytes);
	oresult GetChunk(const char **chunkp, long offset, unsigned short numbytes) const;
	// V2DEV - Added
	oresult GetChunk(const char **chunkp, long offset, unsigned short numbytes,
														unsigned short *bytesread) const;
	// Added for testing
	oresult GetChunk(const void **chunkp, long offset, unsigned short numbytes,
														unsigned short *bytesread) const;
	oresult AppendChunk(const char *chunkp, unsigned short numbytes);

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

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

	// V2.1 dev - Original field name
	const char	*GetOriginalName (void) const;
	int			GetIndex () {return m_index;}
	oresult		UpdateSource(updsrcs updsrc, const char *source=NULL);

private:
    short  m_index;
    char  *m_name;
    char  *m_data;

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

// ----- OFieldCollection -----------------------------------------------

class OEXPORT OFieldCollection : public OOracleCollection
{
public:
    OField GetField(int index) const;
	OField GetField(const char *name) const;
	OField GetFieldOname(const char *oname) const;
     OField GetFieldByOriginalName(const char *oname) const;
    // function used by other classes to construct OFieldCollection objects (don't call this!)
    oresult OpenHelper(void *idisp, void *otheri);  // finish the work of opening the set
};

// ----- OClient -----------------------------------------------

class OEXPORT OClient : public OOracleObject
{
public:
    // construction & destruction
    OClient(void);
    OClient(const OClient &other);
    ~OClient(void);
    
    // use OSession::GetClient to open a client object
    oresult Close(void);

    // Getting other objects
    OSessionCollection GetSessions(void) const;  // get set of sessions

    // overloaded operators
    OClient &operator=(const OClient &other);
    
    // get properties
    const char        *GetName(void) const;        // returns client name.
    
    // function used by other classes to construct OSession objects (don't call this!)
    oresult OpenHelper(void *idisp, void *otheri);

private:
    char *m_name;

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

// ----- OConnection -----------------------------------------------

class OEXPORT OConnection : public OOracleObject
{
public:
    // construction & destruction
    OConnection(void);
    OConnection(const OConnection &other);
    ~OConnection(void);
    
    oresult Close(void);
    
    // getting other objects
    OSession GetSession(void) const;   

    // overloaded operators
    OConnection &operator=(const OConnection &other);
    
    // properties
    const char  *GetConnectString(void) const;  // returns connect string
    const char  *GetDatabaseName(void) const;  // returns database name for this connection

 	// V2.1 dev - transactions on database
	oresult  BeginTransaction(void);  // start a transaction
    oresult  Commit(oboolean startnew = FALSE);   // commit (may start new transaction)
    oresult  Rollback(oboolean startnew = FALSE); // rolls back transaction (may start new transaction)
    oresult  ResetTransaction(void);  // unconditionally rollback (no advisories)
    
    // function used by other classes to construct OConnection objects (don't call this!)
    oresult OpenHelper(void *idisp, void *otheri);

private:
    char *m_dbname;
    char *m_dbconnect;

    // internal helper routines
    oresult Copy(const OConnection &other);
    oresult Cleanup(void);   
};
 
// ----- OConnectionCollection -----------------------------------------------

class OEXPORT OConnectionCollection : public OOracleCollection
{
public:
    OConnection GetConnection(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

⌨️ 快捷键说明

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