📄 oracl.h
字号:
OParameterCollection GetParameters(void) const;
// overloaded operators
ODatabase &operator=(const ODatabase &other);
// execute an arbitrary SQL statement
oresult ExecuteSQL(const char *sqlstmt) const;
long GetRowsProcessed(void) const;
oresult RemoveFromPool(void) const;
//new methods in 8.1.6
OMetaData Describe(const char *SchemaObjectName) throw(OException);
oresult BeginTrans(void) const;
oresult CommitTrans(void) const;
oresult Rollback(void) const;
// properties
const char *GetName(void) const; // return database name (from the connection)
const char *GetConnectString(void) const; // return connect string (without password)
const char *GetRdbmsVersion(void) const; // returns RDBMS Version
long GetOptions(void) const;
// error handling
long ServerErrorNumber(void) const;
const char *GetServerErrorText(void) const;
oresult ServerErrorReset(void);
int ServerErrorSQLPos(void) const;
//new properties in 8.1.6
bool GetAutoCommit(void);
oresult SetAutoCommit(bool autocommit);
void SetCacheMaximumSize(long maxsize) throw(OException);
void SetCacheOptimalSize(long size) throw(OException);
// function used by other classes to construct ODatabase objects (don't call this!)
oresult OpenHelper(void *idisp, void *otheri);
private:
long m_numrows;
char *m_dbname;
char *m_dbconnect;
char *m_errtext;
char *m_version;
// internal helper routines
oresult Cleanup(void);
oresult Copy(const ODatabase &other);
oresult GetUserPwd(const char *username, const char *pwd, char **retname);
};
class OEXPORT OValue
{
public:
// construction & destruction
OValue(void);
OValue(int intval); // allows OValue val = 3
OValue(long longval); // allows OValue val = 99L;
OValue(double doubleval); // allows initialization with a double
OValue(const char *tval); // allows initialization with a string
OValue(const OValue &other); // copy constructor
OValue(short *intval); // Added for ARRAYINSERT
OValue(int *intval); // Added for ARRAYINSERT
OValue(long *longval); // Added for ARRAYINSERT
OValue(double *doubleval);// Added for ARRAYINSERT
OValue(char **tval); // Added for ARRAYINSERT
OValue(const OBlob &val) throw(OException);
OValue(const OClob &val) throw(OException);
OValue(const OBfile &val) throw(OException);
OValue(const OObject &val) throw(OException);
OValue(const ORef &val) throw(OException);
OValue(const OCollection &val) throw(OException);
OValue(const OMetaData &val) throw(OException);
OValue(void* dp, int type);
~OValue(void);
OValue &operator=(const OValue &other);
int operator==(const OValue &other) const;
int operator!=(const OValue &other) const;
// setting the data & type
oresult Clear(void); // clear the values
oresult SetValue(const OValue &val);
oresult SetValue(const char *val); // sets string value (copies text)
oresult SetValue(int val); // sets to int value
oresult SetValue(long val);
oresult SetValue(double dval); // sets to double value
// oresult SetValue(const void *longval, long len); // set to long value (not implemented)
oresult SetValue(char **val); // Added for ARRAYINSERT
oresult SetValue(short *val); // Added for ARRAYINSERT
oresult SetValue(int *val); // Added for ARRAYINSERT
oresult SetValue(long *val); // Added for ARRAYINSERT
oresult SetValue(double *dval); // Added for ARRAYINSERT
oresult SetValue(const OBlob &val);
oresult SetValue(const OClob &val);
oresult SetValue(const OBfile &val);
oresult SetValue(const OObject &val);
oresult SetValue(const ORef &val);
oresult SetValue(const OCollection &val);
oresult SetValue(const OMetaData &val);
oresult SetValue(void* raw, int type);
oresult SetEmpty(void); //sets to "empty" object
oboolean IsNull(void) const; // returns TRUE if value is NULL (which includes uninitialized)
long GetObjType(void) const;
// getting data (overloaded cast operators)
operator int() const;
operator long() const;
operator const char *() const; // returns 0 if instance isn't string (no allocation)
operator double() const;
operator OBlob () const throw(OException);
operator OClob () const throw(OException);
operator OBfile () const throw(OException);
operator OObject () const throw(OException);
operator ORef () const throw(OException);
operator OCollection () const throw(OException);
operator OMetaData () const throw(OException);
// conversions to implementation-specific representations (used by OField)
oresult FromLocalType(void *localv, int type=0);
// helper routine for implementation of other classes
void *Internal(void) const;
int IsEqual(const OValue &other) const;
private:
OOLEvar *m_value; // pointer to data representation
// helper routines
oresult Copy(const OValue &other);
oresult Cleanup(void);
};
// ----- ODynaset -----------------------------------------------
class OEXPORT ODynaset : public OOracleObject
{
public:
// construction & destruction
ODynaset(void);
ODynaset(const ODynaset &other);
ODynaset(const ODatabase &odb, const char *sql_statement,
long options = ODYNASET_DEFAULT, OSnapshotID *snapID = NULL); // construct & open
// Added for custom dynaset
ODynaset(const ODatabase &odb, const char *sql_statement,
unsigned int slicesize, unsigned int perblock,
unsigned int blocks, unsigned int fetchlimit,
unsigned int fetchsize, long options = ODYNASET_DEFAULT,
OSnapshotID *snapID = NULL);
~ODynaset(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 = ODYNASET_DEFAULT, OSnapshotID *snapID = NULL); // creates a dynaset object
// Added for custom dynaset
oresult Open(const ODatabase &odb, const char *sql_statement,
unsigned int slicesize, unsigned int perblock,
unsigned int blocks, unsigned int fetchlimit,
unsigned int fetchsize, long options = ODYNASET_DEFAULT,
OSnapshotID *snapID = NULL);
// The clone of a dynaset is looking at the original data, but has a different navigational
// position. Useful if you want to navigate through a set of data without side-effects
oresult Close(void);
// getting other objects
ODynaset Clone(void) const; // clone a dynaset
ODatabase GetDatabase(void) const;
OFieldCollection GetFields(void) const;
OSession GetSession(void) const;
OField GetField(int index) const;
OField GetField(const char *fieldname) const;
int GetFieldOriginalNameIndex(const char *fieldname) const;
OConnection GetConnection(void) const;
ODynasetMark GetMark(void) const; // bookmark at current position
ODynasetMark GetLastModifiedMark(void) const; // get bookmark at last modified record
// overloaded operators
ODynaset &operator=(const ODynaset &other);
// the sql statement of the dynaset
oresult SetSQL(const char *sql_statement); // sets new sql statement for the dynaset
const char *GetSQL(void) const; // gets sql statement
oresult Refresh(void); // refresh dynaset with current sql statement
// navigation methods
oresult MoveFirst(void); // go to first record in the set
oresult MoveLast(void); // go to last record in the set. Note that this requires that all the records
// in the query be downloaded from the server. Can be expensive.
// MovePrev and MoveNext take a "gopast" argument. If it is TRUE we can navigate to an
// invalid record before the first or after the last. If "gopast" is FALSE, then we won't
// go before the first or after the last record.
oresult MovePrev(oboolean gopast = TRUE); // go to previous record
oresult MoveNext(oboolean gopast = TRUE); // go to next record - the most frequently used
// extra move methods
oresult MovePrevN(long rows, oboolean gopast = TRUE); // go to previous (n) record
oresult MoveNextN(long rows, oboolean gopast = TRUE); // go to next (n) record
oresult MoveRel(long rows, oboolean gopast = TRUE); // go to relative record (n)
oresult MoveTo(long rownum, oboolean gopast = TRUE); // go to record (n)
oresult MoveToMark(const ODynasetMark &odmark); // repositions to mark (see ODynasetMark class)
oboolean IsEOF(void) const; // true if at end of dynaset. Set to TRUE when you have tried to go
// beyond the end
oboolean IsBOF(void) const; // true if at begin of dynaset
oboolean IsValidRecord(void) const; // true if current row is valid
// editing
oboolean CanTransact(void) const; // returns TRUE if transaction processing is enabled
oboolean CanUpdate(void) const; // returns TRUE if this dynaset is updatable
int GetEditMode(void) const; // returns current edit mode: ODYNASET_EDIT_*
oresult StartEdit(void); // starts edit operation
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
// 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
// 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
// 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 GetFieldValue(int index, OBlob *val) const;
oresult GetFieldValue(int index, OClob *val) const;
oresult GetFieldValue(int index, OBfile *val) const;
oresult GetFieldValue(int index, ORef *val) const;
oresult GetFieldValue(int index, OObject *val) const;
oresult GetFieldValue(int index, OCollection *val) const;
oresult GetFieldValue(const char *fieldname, OBlob *val) const;
oresult GetFieldValue(const char *fieldname, OClob *val) const;
oresult GetFieldValue(const char *fieldname, OBfile *val) const;
oresult GetFieldValue(const char *fieldname, ORef *val) const;
oresult GetFieldValue(const char *fieldname, OObject *val) const;
oresult GetFieldValue(const char *fieldname, OCollection *val) 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 SetFieldValue(int index, const OBlob &val);
oresult SetFieldValue(int index, const OClob &val);
oresult SetFieldValue(int index, const OBfile &val);
oresult SetFieldValue(int index, const ORef &val);
oresult SetFieldValue(int index, const OObject &val);
oresult SetFieldValue(int index, const OCollection &val);
oresult SetFieldValue(const char *fieldname, const OBlob &val);
oresult SetFieldValue(const char *fieldname, const OClob &val);
oresult SetFieldValue(const char *fieldname, const OBfile &val);
oresult SetFieldValue(const char *fieldname, const ORef &val);
oresult SetFieldValue(const char *fieldname, const OObject &val);
oresult SetFieldValue(const char *fieldname, const OCollection &val);
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);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -