8 #include <CUnit/CUnit.h>
30 LOG_FATAL(
"Unable to connect to database");
33 MagicCookie = magic_open(MAGIC_PRESERVE_ATIME|MAGIC_MIME);
58 char SQL[MAXCMD] = {0};
59 PGresult *result = NULL;
60 char mimetype_name[] =
"application/octet-stream";
62 memset(
SQL,
'\0', MAXCMD);
63 snprintf(
SQL, MAXCMD,
"DELETE FROM mimetype where mimetype_name = '%s';", mimetype_name);
71 memset(
SQL,
'\0', MAXCMD);
72 snprintf(
SQL, MAXCMD,
"INSERT INTO mimetype (mimetype_name) VALUES ('%s');", mimetype_name);
84 memset(
SQL,
'\0', MAXCMD);
85 snprintf(
SQL, MAXCMD,
"SELECT mimetype_name from mimetype where mimetype_name = ('%s');", mimetype_name);
92 int count = PQntuples(result);
97 memset(
SQL,
'\0', MAXCMD);
98 snprintf(
SQL, MAXCMD,
"DELETE FROM mimetype where mimetype_name = '%s';", mimetype_name);
char SQL[256]
SQL query to execute.
PGconn * pgConn
Database connection.
magic_t MagicCookie
for Magic
int MaxDBMime
how many rows in DBMime
PGresult * DBMime
contents of mimetype table
PGconn * fo_dbconnect(char *DBConfFile, char **ErrorBuf)
Connect to a database. The default is Db.conf.
int fo_checkPQresult(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb)
Check the result status of a postgres SELECT.
int fo_checkPQcommand(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb)
Check the result status of a postgres commands (not select) If an error occured, write the error to s...
void DBLoadMime()
Populate the DBMime table.
int DBLoadMimeClean()
clean the env
int DBLoadMimeInit()
initialize DB
char * DBConfFile
DB conf file location.
CU_TestInfo testcases_DBLoadMime[]
testcases for function DBLoadGold
void testDBLoadMime()
for function DBLoadMime()