#include <string.h>#include <stdlib.h>#include <unistd.h>#include <time.h>#include <stdio.h>#include <sqlite3.h>#include <fakedbfs/fdbfsconfig.h>#include <fakedbfs/fakedbfs.h>#include <fakedbfs/db.h>#include <fakedbfs/debug.h>Functions | |
| int | fdbfs_db_busy_handler (void *data, int prior) |
| Handle busy conditions in the sqlite database. (internal). | |
| int | fdbfs_db_open (fdbfs_t *f) |
| Open the database and initialise sqlite. | |
| int | fdbfs_db_close (fdbfs_t *f) |
| Close the database. | |
| int | fdbfs_db_table_exists (fdbfs_t *f, const char *tname) |
| Check if a table exists in the database. | |
| int | fdbfs_db_cat_exists (fdbfs_t *f, const char *cat) |
| Check if a catalogue exists in the database. | |
| int | fdbfs_db_create_table (fdbfs_t *f, const char *tname, const char *tspec) |
| Create a table. | |
| const char * | fdbfs_db_gettype (enum DataType t) |
| Get the database-specific typename for an DataType enum. | |
| int | fdbfs_db_add_column (fdbfs_t *f, const char *tname, const char *cname, coltype_t datatype) |
| Add a column to a table. | |
| int | fdbfs_db_del_column (fdbfs_t *f, const char *tname, const char *cname) |
| Delete a column from a table. | |
| int | fdbfs_db_add_to_enum_list_table (fdbfs_t *f, const char *name, const char *tname, const char *specf) |
| Add an entry to the enum_list table. | |
| int | fdbfs_db_cat_getcfdname (fdbfs_t *f, const char *catname, char **tcfd) |
| Get CFD name of table. (without cfd_ prefix). | |
| int | fdbfs_db_cfd_update_refcount (fdbfs_t *f, const char *name, int add, unsigned int val) |
| Update refcount of CFD table entry. | |
| int | fdbfs_db_add_to_cfd_list_table (fdbfs_t *f, const char *name, const char *alias, const char *tablename, const char *specfile) |
| Add entry to catalogue field definition list table. | |
| int | fdbfs_db_add_to_cat_list_table (fdbfs_t *f, const char *name, const char *alias, const char *tablename, const char *fieldtable) |
| Add an entry to the cat_list table. | |
| int | fdbfs_db_add_to_field_desc (fdbfs_t *f, const char *tablename, const char *name, const char *alias, enum DataType type, const char *typen) |
| Add to the field description table for a catalogue. | |
| int | fdbfs_db_delete (fdbfs_t *f, const char *from, const char *wherecol, const char *wherecmp, const char *whereval) |
| Delete row from table in database. | |
| int | fdbfs_db_drop_table (fdbfs_t *f, const char *tablename) |
| Drops a table from the database. | |
| int | fdbfs_db_add_enum_elem (fdbfs_t *f, const char *tname, const char *name, const char *fmtname, unsigned int value, enum DataType dtype, const char *subelements) |
| Add an element to an enumeration description table. | |
| int | fdbfs_db_bind_field (fdbfs_t *f, int *count, enum DataType type, void *value, size_t len, sqlite3_stmt *stmt) |
| Bind a field to a statement. | |
| int | fdbfs_db_get_lastupdate (fdbfs_t *f, const char *cat, const char *filename) |
| Get the lastupdate time from a catalogue. | |
| int | fdbfs_db_mib_add (fdbfs_t *f, const char *mib, enum DataType type, union Data data) |
| Adds a MIB to the configuration table. | |
| int | fdbfs_db_mib_update (fdbfs_t *f, const char *mib, enum DataType type, union Data data) |
| Updates a MIB in the configuration table. | |
|
||||||||||||||||||||
|
Add a column to a table. fdbfs_db_add_column adds a column to a table. This isn't exactly production-ready. It requires that the version of SQLite support the "ALTER TABLE ADD COLUMN" command.
|
|
||||||||||||||||||||||||||||||||
|
Add an element to an enumeration description table. fdbfs_add_enum_elem() adds a row to an enum descripton table.
|
|
||||||||||||||||||||||||
|
Add an entry to the cat_list table. fdbfs_db_add_to_cat_list_table() adds an entry to the cat list table.
|
|
||||||||||||||||||||||||
|
Add entry to catalogue field definition list table.
|
|
||||||||||||||||||||
|
Add an entry to the enum_list table. fdbfs_db_add_to_enum_list_table() adds an entry to the enum list table.
|
|
||||||||||||||||||||||||||||
|
Add to the field description table for a catalogue. fdbfs_db_add_to_field_desc() adds an entry to the field description table for a catalogue.
|
|
||||||||||||||||||||||||||||
|
Bind a field to a statement. fdbfs_db_bind_field() binds data to an SQLite statement. The field counter is increased on each call.
|
|
||||||||||||
|
Handle busy conditions in the sqlite database. (internal).
|
|
||||||||||||
|
Check if a catalogue exists in the database. fdbfs_db_cat_exists() looks at the cat_list table to see if a catalogue exists.
|
|
||||||||||||||||
|
Get CFD name of table. (without cfd_ prefix).
|
|
||||||||||||||||||||
|
Update refcount of CFD table entry.
|
|
|
Close the database. fdbfs_db_close() closes the database.
|
|
||||||||||||||||
|
Create a table. fdbfs_db_create_table() creates a table of the specified name and specification.
|
|
||||||||||||||||
|
Delete a column from a table. fdbfs_db_del_column() deletes a column from a table if the database driver supports it. SQLite doesn't, so for now this does nothing.
|
|
||||||||||||||||||||||||
|
Delete row from table in database. fdbfs_db_delete() deletes rows from a table based on certain conditions.
|
|
||||||||||||
|
Drops a table from the database. fdbfs_db_drop_table() drops the named table from the database.
|
|
||||||||||||||||
|
Get the lastupdate time from a catalogue. fdbfs_db_get_lastupdate() gets the lastupdate time for a certain file in a catalogue.
|
|
|
Get the database-specific typename for an DataType enum. fdbfs_db_gettype() returns the database-specific type string for a specified DataType enum.
|
|
||||||||||||||||||||
|
Adds a MIB to the configuration table. This is used by the configuration subsystem.
|
|
||||||||||||||||||||
|
Updates a MIB in the configuration table. This is used by the configuration subsystem.
|
|
|
Open the database and initialise sqlite. fdbfs_db_open() opens our database and sets certain sqlite paramaters.
|
|
||||||||||||
|
Check if a table exists in the database. fdbfs_db_table_exists() looks at the sqlite_master table to see if a table exists.
|
1.4.6