Table Operations

database exposes the API to create table. Following are the APIs for creating different kinds of table

To create normal table

table* gettable(char *name, bangdb_open_type openflag = OPENCREATE, table_env *tenv=NULL);

Using table_env user can set various config parameters and tell db how the table should be created. If table_env is null, the db picks all the necessary config values from the bangdn.config file. The openflag OPENCREATE is good for all the use cases as it creates if doesn't exist or open if it's already there

To get connection to operate on the table, you must call following;

connection* getconnection();

To create primitive table

table* getPrimitiveTable(char *name, bangdb_primitive_data_type dataType = PRIMITIVE_LONG, bangdb_open_type openflag = OPENCREATE, table_env *tenv=NULL);

The bangdb_primitive_data_type value decides what kind of primitive table will be created. For example if PRIMITIVE_LONG is used for the datatype then db will create table to handle long as key and value. Note that for primitive table both key and value are always of same type. This is the only way to create primitive table, by calling getPrimitiveTable().

The bangdb_primitive_data_type is defined as following;

	enum bangdb_primitive_data_type
	{
		PRIMITIVE_INT,
		PRIMITIVE_LONG,
		PRIMITIVE_STRING,
	};
	

To get the connection to operate on the primitive table, you must call following;

primConnection* getPrimConnection();

To create wide table

wideTable* getWideTable(char *name, bangdb_open_type openflag = OPENCREATE, table_env *tenv=NULL);

The API is similar to that of normal table, however user must get wideConnection to work/operate on the table. To get the wide connection user must call following;

wideConnection* getconnection();