bg
BangDB Database Api – BangDB = NoSQL + AI + Stream

BangDB Database Api

chevron

BangDB Database Type

C++

Selected

Java

Selected

To describe the database

const char *describeDatabase(); It returns NULL for error or json describing the database
To get the table or create a new table
bangdb_table *getTable(const char *tblName, table_env *tblenv = NULL, bangdb_open_type openflag = OPENCREATE); Before creating new table, we should set the table_env object properly based on what kind of table we wish to create. There are several properties that we could set for the table. Please see the section on "table_env" bangdb_open_type has following options; OPENCREATE, // to create new or open if table is not existing TRUNCOPEN, // hardly used JUSTOPEN // open only if exists, else fail It returns NULL for error
To get the table stats, the details of the table
const char *getTableStats(const char *tblName, bool verbose); It returns NULL for error or json describing the table and it's stats
To get database stats
const char *getStats(bool verbose = true); It returns NULL for error or json describing the database and it's stats
To get table reference (for already created or opened table)
table_env *getTableEnv(const char *tblName, long tblId = 0); It returns NULL if table doesn't exist. Please note this is the reference to the table and should not be deleted
To drop a table
int dropTable(bangdb_table **tbl); It returns -1 for error
BangDB supports transaction for set of operations. To get the transaction reference
void beginTransaction(bangdb_txn *txn); to commit the transaction long commitTransaction(bangdb_txn *txn); to abort the transaction void abortTransaction(bangdb_txn *txn); Please see "bangdb transaction" for details
to dumpdata on the disk
int dumpData(); This may be required when you simply want to force table contents on disk for copying the files etc. It returns -1 for error
BangDB stream processing supports UDFs (user defined functions), to deal with udfs
char *add_udf(const char *udf_json); char *del_udf(const char *udf_name); char *exec_udf(const char *req_json); The arguments for all these methods are json, these are described in detail in "udf" section

To describe the database

String describeDatabase() It returns null for error or json describing the database
To get the table or create a new table
BangDBTable getTable(String tableName, TableEnv tenv, OpenType openType) Before creating new table, we should set the table_env object properly based on what kind of table we wish to create. There are several properties that we could set for the table. Please see the section on "table_env" OpenType has following options; OPENCREATE, // to create new or open if table is not existing TRUNCOPEN, // hardly used JUSTOPEN // open only if exists, else fail It returns null for error
To get the table stats, the details of the table
String getTableStats(String tblName, boolean verbose) It returns null for error or json describing the table and it's stats
To get database stats
String getStats(boolean verbose); It returns null for error or json describing the database and it's stats
To get table reference (for already created or opened table)
TableEnv getTableEnv(String tblName, long tblId) It returns null if table doesn't exist. Please note this is the reference to the table and should not be deleted
To drop a table
int dropTable(BangDBTable tbl) It returns -1 for error
BangDB supports transaction for set of operations. To get the transaction reference
void beginTransaction(Transaction txn) to commit the transaction long commitTransaction(Transaction txn) to abort the transaction void abortTransaction(Transaction txn) Please see "bangdb transaction" for details
to dumpdata on the disk
int dumpData() This may be required when you simply want to force table contents on disk for copying the files etc. It returns -1 for error
BangDB stream processing supports UDFs (user defined functions), to deal with udfs
String add_udf(String udf_json) String del_udf(String udf_name) String exec_udf(String req_json) The arguments for all these methods are json, these are described in detail in "udf" section