dbRegisterDBSchemaGoAhead WebServer APIGoAhead EMF

Synopsis

Add a schema to the module-internal schema database.

Prototype

 #include "emfdb.h"

 int dbRegisterDBSchema(char_t * tablename, schemaTable_t * sTable);

Parameters

tablenamename of the table to add to the database
sTableschema for the table being added

Description

This function creates an empty table in the web server database module. Tables are defined by means of the following schema structure:

typedef struct schemaTable_s {
	 int	 nColumns;
	 char_t	 **columnNames;
	 int	 *columnTypes;
	 int	 nRows;
	 int	 **rows;
} schemaTable_t;

nColumns - the number of columns in the table
columnName - a list of strings defining the column names
columnTypes - a list of integers defining the column type (can be T_STRING or T_INT)
nRows - indicates the number of rows in the table. Initialized to 0.
rows - a list of pointers to a number (nColumns) of data items

This function does NOT exist in the EMF database module.

Return Value

dbRegisterDBSchema returns 0 if successful, or -1 on error.

Example

schemaTable_t	stable;
sTable.nColumns = 3;
sTable.columnNames = {T("USERID"), T("PASSWORD"), T("GROUP")};
sTable.columnTypes = {T_STRING, T_STRING, T_INT};
/* The remaining elements of the schema table are not used */
nCheck = dbRegisterSchema(T("USERS"), &sTable);
	

See Also

dbOpen(), dbClose(), dbLoad(), dbSave()