CringeDB/Database Abstraction/cdb_database.h

34 lines
1.0 KiB
C
Raw Permalink Normal View History

2024-02-18 18:46:34 +01:00
typedef struct db_Database_impl * db_Database;
typedef struct db_Table_impl * db_Table;
typedef struct db_Data_impl * db_Data;
typedef int db_Error;
typedef enum {
BINARY8, BINARY16, BINARY32, BINARY64, BINARYREF
} db_ColumnType;
typedef struct {
char * name;
db_ColumnType type;
} db_Column;
// Creates new database in specified directory
db_Database db_databaseNew(const char * directory);
// Closes specified Database and frees memory
void db_databaseClose(db_Database db);
// Creates, gets, renames, closes and deletes a Table
db_Error db_tableNew(db_Database db, char * name, db_Column * columns, unsigned int count);
db_Error db_tableRename(db_Table table);
db_Error db_tableDelete(db_Table table);
db_Error db_tableClose(db_Table table);
db_Table db_tableGet(char * name);
// Creates empty new Data
db_Data db_tableEntryNew(db_Table table);
db_Error db_tableEntrySet(db_Data entry, char * columnName, void * data);
db_Error db_tableEntryAdd(db_Table table, db_Data data);
unsigned long db_tableSize(db_Table table);
db_Error db_tableClear(db_Table table);