24 #include <libfossdb.h> 32 #include <CUnit/CUnit.h> 35 #define COMMIT_HASH "COMMIT_HASH Unknown" 51 int nonexistant_table;
58 CU_ASSERT_PTR_NOT_NULL(pgConn);
61 CU_ASSERT_FALSE(nonexistant_table);
63 PGresult* result = PQexec(pgConn,
"CREATE table exists()");
64 CU_ASSERT_PTR_NOT_NULL_FATAL(result);
65 CU_ASSERT_FALSE_FATAL(
fo_checkPQcommand(pgConn, result,
"create", __FILE__, __LINE__));
68 CU_ASSERT_TRUE(existing_table);
78 CU_TestInfo libfossdb_testcases[] =
char * DBConfFile
DB conf file location.
void test_fo_tableExists()
fo_tableExists() tests
PGconn * pgConn
Database connection.
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...
int fo_tableExists(PGconn *pgConn, const char *tableName)
Check if table exists. Note, this assumes the database name is 'fossology'.
PGconn * fo_dbconnect(char *DBConfFile, char **ErrorBuf)
Connect to a database. The default is Db.conf.