connection (for Normal Table)

Once table is created, then we need a connection object. Using connection object we do all our operations for the db. Connection represent a light weight active handle for a table inside the db. There can be multiple connections created for a single table, whereas we can't create same table twice or get different handle for the same table, this is not allowed.

many a times we require multiple connections per table and hence this is enabled by the BangDB

following is the way to create a connection object

API is as follows, we get connection through table object;

connection* getconnection();

To create connection;

	connection *conn = tbl->getconnection();
	if(!conn)
		bangdb_logger("couldn't get connection");		
	

To close connection;

	int retval = conn->closeconnection();
	if(retval < 0)
		bangdb_logger("error in conn close");
	delete conn;
	

API is as follows, we get connection through table object;

Connection GetConnection()

To create connection;

	Connection conn = tbl.GetConnection();
	

To close connection;

	int retval = conn.CloseConnection();
	if(retval < 0)
		Common.BangDBLogger("error in conn close");
	

API is as follows, we get connection through table object;

Connection getConnection()

To create connection;

	Connection conn = tbl.getConnection();
	

To close connection;

	int retval = conn.closeConnection();
	if(retval < 0)
		BangDBCommon.bangdb_logger("error in conn close");
	

primitive connection (for Primitive Table)

If primitive table has been created then we need to get the primConnection in order to do operations. primConnection implements the API suitable for doing operations on primitive table

API is as follows, we get connection through table object;

primConnection* getPrimConnection();

To create connection;

	primConnection *pconn = tbl->getPrimConnection();	
	if(!conn)
		bangdb_logger("couldn't get connection");			
	

To close connection;

	int retval = pconn->closeconnection();
	if(retval < 0)
		bangdb_logger("error in conn close");
	delete conn;
	

API is as follows, we get connection through table object;

PrimConnection GetPrimConnection();

To create connection;

	PrimConnection pconn = tbl.GetPrimConnection();		
	

To close connection;

	int retval = pconn.CloseConnection();
	if(retval < 0)
		Common.BangDBLogger("error in conn close");
	delete conn;
	

API is as follows, we get connection through table object;

PrimConnection getPrimConnection();

To create connection;

	PrimConnection pconn = tbl.getPrimConnection();		
	

To close connection;

	int retval = pconn.closeConnection();
	if(retval < 0)
		BangDBCommon.bangdb_logger("error in conn close");
	delete conn;
	

wide connection

This is only for Wide Table. This exposes set of different get and put along with the similar ones exposed by connection

following is the way to create a connection object

API is as follows, we get wideConnection through wideTable object;

wideConnection* getconnection();

To create connection;

	wideConnection *conn = tbl->getconnection();		
	

To close connection;

	int retval = conn->closeconnection();
	if(retval < 0)
		bangdb_logger("error in conn close");
	delete conn;
	

API is as follows, we get WideConnection through WideTable object;

WideConnection GetConnection()

To create connection;

	WideConnection conn = tbl.GetConnection();
	

To close connection;

	int retval = conn.CloseConnection();
	if(retval < 0)
		Common.BangDBLogger("error in conn close");
	

API is as follows, we get connection through table object;

WideConnection getConnection()

To create connection;

	WideConnection conn = tbl.getConnection();
	

To close connection;

	int retval = conn.closeConnection();
	if(retval < 0)
		BangDBCommon.bangdb_logger("error in conn close");