ORAC++ Classes and Functions
 
In this section ORAC++ classes and functions operating on member objects are described.
 
Class Connect:
This class is used to open Database connection:

Function                                                
Description                                        
Connect()
Default constructor
Connect(char *server)
Constructor - server connection
Connect(int mode)
Constructor - mode connection
Connect(int mode, char *server)
Constructor - mode, server
void Close()
To close connection
Database& OpenDatabase(char *usr, char *psw)
return Database  object
Database* OpenADatabase(char *usr, char *psw)
return database address
Database& OpenDatabase(char *usr, char *psw, char *sid)
return Database - SID used
Database& OpenADatabase(char *usr, char *psw, char *sid)
return Database address - SID used

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Class Database:
This class is used to connect to database, and Database object is created after successful connection has been made. Member functions of this class are:

Function
Description
Table& GetTable(char *name)
return Table object
Table* GetATable(char *name)
return Table address
View& GetView(char *name)
return View object
View* GetAView(char *name)
return View address
Procedure& GetProcedure(char *name)
return Procedure object
Function& GetFunction(char *name)
return Function object
Sql& GetSql()
return Sql object
Sql& GetSql(char *sql)
return Sql object
Sql* GetASql()
return Sql* object
Sql* GetASql(char *sql)
return Sql* object
void Commit()
commit changes to database
void Rollback()
rollback changes in database
void Close()
close database

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Class Table/View
This class is used to store Table/View information. Objects of this class correspond to objects existing in the database (persistent objects). All operations on these objects are performed by operational objects ( from class Select, Insert, Update or Delete ) Objects are created from class Database.

Function        
Description
Object& GetObject()
return next embedded object from the table
Object* GetAObject()
return next embedded object ptr from the table
Object& GetObject(char *name)
return embedded object from the table
Object* GetAObject(char *name)
return embedded object from the table

int GetNumColumns()

return number columns in the table

char* GetColName(int i)

return columns name (column number i)

int GetColAttr(short attr, int i)

return attribute attr for column number i

where: attr value

attr description

COLTYPE

column type

COLSIZE

column size

COLPREC

column precision

COLSCALE

column scale

int GetNumObjects()
return number of embedded objects in the table
char* operator[](char *n)
return column name (after validation)
char* operator[](TDate& n)
return column name (after validation)
char* operator[](TClob& n)
return column name (after validation)
char* operator[](TBlob& n)
return column name (after validation)
char* operator[](TRowid& n)
return column name (after validation)
char* operator[](Aggregate& n)
return column name (after validation)

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Class Object
This class is used to store embedded Object information. Objects of this class correspond to objects existing in the database (persistent objects). All operations on these objects are performed by operational objects ( from class Select), so there are no external functions defined for classes Table/View. Objects are created from class Table.

Function                                                        
Description
char* GetObjName()
return object name
Table* GetTable()
return table address of embedded object

int GetObjType()

return object type

int GetObjLevel()

return object level

int GetObjNumColumns()

return object number columns

char* GetColName(int num)

return column name for num column

int GetColAttr(short attr, int num)

return column attribute for num column

Object& GetObject(char *name)

return nested object

Object* GetObject(char* name)
return nested object

RefObject* AsRef()

return RefObject from this Object

char* operator[](char* n)
return column name (after validation)

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
This class is used to store information on reference to embedded object. Objects of this class correspond to objects existing in the database (persistent objects). Objects are based on Table (for table of objects), or Object (reference to embedded object).

Function                                                        
Description
RefObject(const Table& t)
constructor based on Table
RefObject(const Object* o)
constructor based on Object
OCIRef* GetRef()
return OCI reference to object

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Class Select
This class is used for Query on table(s) or view(s). Member functions of this class are:

Function                                                                
Description
Select(Table& t)
class constructor - based on Table
Select(Table* t)
class constructor - based on Table*
Select(View& t)
class constructor - based onView
Select(View* t)
class constructor - based onView*
Select(Object& t)
class constructor - based on Object
Select(Object* t)
class constructor - based on Object*
int Row()
fetch rows, return number rows fetched
void Array(int num)
set number of rows to be fetched by Row()
void ClearColumns()
reset selected columns
void ClearWhere()
remove query condition
void Reset()
reset selected and query columns
void AsRecord()
set pre-formatted record display
void AsLine()
set pre-formatted line display
char* In(char* data) - external function
process 'in(...)' statement
char* NotIn(char* data) - external function
process 'not in(...)' statement
char* In(Select& s) - external function
process sub-query
char* NotIn(Select& s) - external function
process sub-query
char* Exists(Table& t)
process 'exists' sql statement
char* NotExists(Table& t)
process 'not exists' sql statement
void Prepare()
prepare and parse SQL statement
Select& operator+=(Table& t)
add Table object to Select
Select& operator+=(View& t)
add View object to Select
Select& operator+=(Object& t)
add Object object to Select
Select& operator<<(int& i)
load fetched data into integer variable
Select& operator<<(double& i)
load fetched data into double variable
Select& operator<<(char* i)
load fetched data into char* variable
Select& operator<<(TInt& i)
load fetched data into TInt object
Select& operator<<(TFloat& i)
load fetched data into TFloat object
Select& operator<<(TStr& i)
load fetched data into TStr object
Select& operator<<(TDate& i)
load fetched data into TDate object
Select& operator<<(TRowid& i)
load fetched data into TRowid object
Select& operator<<(TClob& i)
load fetched data into TClob object
Select& operator<<(TBlob& i)
load fetched data into TBlob object
Select& operator<<(Aggregate& i)
load fetched data into Aggregate object
Select& operator<<(Record& i
load fetched data into Record object
Select& operator<<(Line& i)
load fetched data into Line object
Select& operator<<(int[] i)
load fetched data into array of integers
Select& operator<<(double[] i)
load fetched data into array of doubles
Select& operator<<(char  *i[])
load feched data into array of char*
Select& operator<<(TInt[] i)
load fetched data into array of TInt
Select& operator<<(TFloat[] i)
load fetched data into array of TFloat
Select& operator<<(TStr[] i)
load fetched data into array of TStr
Select& operator>>(const int& i)
set query data
Select& operator>>(const double& i)
set query data
Select& operator>>(const char* i)
set query data
Select& operator>>(const TRowid& i)
set query data
Select& operator>>(const TDate& i)
set query data

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Class Insert  : public Select
This class is used to Insert records into the Table. Member functions of this class:

Function                                                                
Description
Insert (Table& t)
class constructor
int Row()
insert and return number of rows inserted
void Array(int n)
set batch insert array size ( nrows )
void Prepare()        
prepare and parse SQL statement
Insert& operator>>(const int& i)
insert integer data
Insert& operator>>(const double& i)
insert double data
Insert& operator>>(const char* i)
insert char* data
Insert& operator>>(const TDate& i)
insert TDate data
Insert& operator>>(const TClob& i)
insert TClob data
Insert& operator>>(const TBlob& i)
insert TBlob data
Insert& operator>>(const TInt& i)
insert TInt data
Insert& operator>>(const TFloat& i)
insert TFloat data
Insert& operator>>(const TStr& i)
insert TStr data
Insert& operator>>(const int i[] )
insert array of integers
Insert& operator>>(const double i[] )
insert array of doubles
Insert& operator>>(char *i[])
insert array of char*
Insert& operator>>(const TInt i[])
insert array of TInt
Insert& operator>>(const TFloat i[])
insert array of TFloat
Insert& operator>>(const TStr i[])
insert array of TStr

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Class Update : public Select
This class is used to Update records in the Table. Member functions are:

Function                                                                        
Description
Update (Table& t)
class constructor (based on class Table)
int Row()
insert a row(s) into the table
void Data()        
reset update and where columns
void ClearWhere()
remove query condition
void Prepare()        
prepare and parse SQL statement
int GetLobs()
get all LOB columns (if LOB update)
Update& operator>>(const int& i)
set update data
Update& operator>>(const double& i)
set update data
Update& operator>>(const char* i)
set update data
Update& operator>>(const TInt& i)
set update data
Update& operator>>(const TFloat& i)
set update data
Update& operator>>(const TStr& i)
set update data
Update& operator>>(const TDate& i)
set update data
Update& operator>>(const TClob& i)
set update data
Update& operator>>(const TBlob& i)
set update data

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Class Delete : public Select
This class is used to Delete records from the Table. Member functions of this class are:

Function                        
Description
Delete (Table& t)
class constructor (based on class Table)
int Row()
delete row(s) from a table - return number rows deleted
void ClearWhere()
reset query condition
void Prepare()        
prepare and parse SQL statement

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Class Procedure
This class is used to access and execute a Stored Procedure. Member functions of this class are:

Function                                                                
Description
void Execute()
execute Stored Procedure
void Array(int n)
set array processing to nrows
void Prepare()        
prepare and parse sql statement
Procedure& operator>>(const int& i)
set input data
Procedure& operator>>(const double& i)
set input data
Procedure& operator>>(const char* i)
set input data
Procedure& operator>>(const TInt& i)
set input data
Procedure& operator>>(const TFloat& i)
set input data
Procedure& operator>>(const TStr& i)
set input data
Procedure& operator>>(const int i[])
set input data - array
Procedure& operator>>(const double i[])
set input data - array
Procedure& operator>>(char* i[])
set input data - array
Procedure& operator>>(const TInt i[])
set input data - array
Procedure& operator>>(const TFloat i[])
set input data - array
Procedure& operator>>(TStr i[])
set input data - array
Procedure& operator<<(int& i)
set output data
Procedure& operator<<(double& i)
set output data
Procedure& operator<<(char* i)
set output data
Procedure& operator<<(TInt& i)
set output data
Procedure& operator<<(TFloat& i)
set output data
Procedure& operator<<(TStr& i)
set output data
Procedure& operator<<(int i[])
set output data - array
Procedure& operator<<(double i[])
set output data - array
Procedure& operator<<(char *i[])
set output data - array
Procedure& operator<<(TStr i[])
set output data - array

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Class Function : public Procedure
This class is used to access and execute a Stored Function. Member functions of this class are:

Function                                
Description
void Execute()         
execute Stored Function
void Array(int n)
set array processing to nrows
void Prepare()
prepare and parse sql statement