Table Class Reference

Handle to the database table. More...

Inherited by AggTableImpl, and TableImpl.


Public Member Functions

virtual void setCondition (Condition *c)=0
 sets condition for the select, update and delete operations
virtual DbRetVal bindFld (const char *name, void *val)=0
 binds application buffer to the specified field of the table.
virtual void markFldNull (const char *name)=0
 marks the specified field to insert null when insert method is called.
virtual void markFldNull (int colpos)=0
 marks the specified field to insert null when insert method is called.
virtual void clearFldNull (const char *name)=0
 clears the null mark which is set before.
virtual void clearFldNull (int colpos)=0
 clears the null mark which is set before.
virtual bool isFldNull (const char *name)=0
 checks whether the field value is null.
virtual bool isFldNull (int colpos)=0
 checks whether the field value is null for the specified field position.
virtual DbRetVal execute ()=0
 executes the select statement.
virtual DbRetVal insertTuple ()=0
 insert the tuple into the table.
virtual DbRetVal updateTuple ()=0
 update values in the current tuple of the table.
virtual DbRetVal deleteTuple ()=0
 deletes the current tuple of the table.
virtual int deleteWhere ()=0
 deletes all the records which satisfies the condition set.
virtual int truncate ()=0
 deletes the all the records in the table.
virtual void * fetch ()=0
 fetches the next tuple in the table which satisfies the condition specified.
virtual void * fetchNoBind ()=0
 fetches the next tuple in the table which satisfies the condition specified.
virtual DbRetVal close ()=0
 closes the scan.
virtual long spaceUsed ()=0
 Retrieves the total space used for this table in bytes.
virtual long numTuples ()=0
 Retrieves the total number of tuples present in this table.
virtual DbRetVal lock (bool shared)=0
 takes lock on the table if bool shared flag is set, it will take shared lock, or else exclusive lock
virtual DbRetVal unlock ()=0
 releases the lock acquired on the table
virtual DbRetVal setUndoLogging (bool flag)=0
 sets the undo log flag.


Detailed Description

Handle to the database table.

Table is a set of data values organized using a model of horizontal rows and columns.
Columns are identified by name and rows by values. It shall be visualized as a linked
list of related data
Functionality:
1.insert
2.update
3.delete
4.select with predicate or condition


Member Function Documentation

virtual DbRetVal Table::bindFld ( const char *  name,
void *  val 
) [pure virtual]

binds application buffer to the specified field of the table.

Before doing any DML operations required fields are binded first. Below are the candidates for this:
1.All the fields in the projection list of select statement.
2.Field list in the insert statement.
3.Fields in the assignment list of update statement.

Parameters:
name field name in the table
val address of the application buffer. Memory should be allocated by the application before binding the buffer.

virtual void Table::clearFldNull ( int  colpos  )  [pure virtual]

clears the null mark which is set before.

Parameters:
colpos field position

virtual void Table::clearFldNull ( const char *  name  )  [pure virtual]

clears the null mark which is set before.

Parameters:
name field name

virtual DbRetVal Table::close (  )  [pure virtual]

closes the scan.

Needs to be called before calling execute again on the same table handle. It releases the resources acquired during the scan.

Returns:
DbRetVal

virtual DbRetVal Table::deleteTuple (  )  [pure virtual]

deletes the current tuple of the table.

It works only on top of select. using fetch first go to the tuple to be deleted, then call this method to delete.
To delete all the tuples, do not set any condition and call fetch followed by delete in a loop till fetch exhausts.

Returns:
DbRetVal

virtual int Table::deleteWhere (  )  [pure virtual]

deletes all the records which satisfies the condition set.

Returns:
int totalTuples deleted

virtual DbRetVal Table::execute (  )  [pure virtual]

executes the select statement.

Based on the predicate(condition), respective index is chosen for the select. Application should call execute before they start fetching the values from the table.This starts scan on the table.

Returns:
DbRetVal

virtual void* Table::fetch (  )  [pure virtual]

fetches the next tuple in the table which satisfies the condition specified.

execute should be called before calling this method. Application buffer should be binded to get the tuple values.

Returns:
void* NULL if there is no tuple.

virtual void* Table::fetchNoBind (  )  [pure virtual]

fetches the next tuple in the table which satisfies the condition specified.

execute should be called before calling this method. Application buffer need not be binded to call this method.

Returns:
void* NULL if there is no tuple.

virtual DbRetVal Table::insertTuple (  )  [pure virtual]

insert the tuple into the table.

Prior to this, the binded buffer should be updated Values present in the binded buffers of all the fields are taken and stored in the table.

Returns:
DbRetVal

virtual bool Table::isFldNull ( int  colpos  )  [pure virtual]

checks whether the field value is null for the specified field position.

Parameters:
colpos field position

virtual bool Table::isFldNull ( const char *  name  )  [pure virtual]

checks whether the field value is null.

Parameters:
name field name

virtual DbRetVal Table::lock ( bool  shared  )  [pure virtual]

takes lock on the table if bool shared flag is set, it will take shared lock, or else exclusive lock

Returns:
DbRetVal

virtual void Table::markFldNull ( int  colpos  )  [pure virtual]

marks the specified field to insert null when insert method is called.

Parameters:
colpos field position

virtual void Table::markFldNull ( const char *  name  )  [pure virtual]

marks the specified field to insert null when insert method is called.

Parameters:
name field name in the table

virtual long Table::numTuples (  )  [pure virtual]

Retrieves the total number of tuples present in this table.

Returns:
DbRetVal

virtual void Table::setCondition ( Condition c  )  [pure virtual]

sets condition for the select, update and delete operations

Parameters:
c condition

virtual DbRetVal Table::setUndoLogging ( bool  flag  )  [pure virtual]

sets the undo log flag.

If this flag is unset then undo logs will not be generated

Returns:
DbRetVal

virtual long Table::spaceUsed (  )  [pure virtual]

Retrieves the total space used for this table in bytes.

Returns:
DbRetVal

virtual int Table::truncate (  )  [pure virtual]

deletes the all the records in the table.

No transaction required to call this. It takes table level lock.

Returns:
DbRetVal

virtual DbRetVal Table::unlock (  )  [pure virtual]

releases the lock acquired on the table

Returns:
DbRetVal

virtual DbRetVal Table::updateTuple (  )  [pure virtual]

update values in the current tuple of the table.

It works only on top of select using fetch go to the tuple to be updated, then update the binded buffer value and then call this method to updates the field values in the tuple.

Returns:
DbRetVal


The documentation for this class was generated from the following file:
CSQL Project Page