19 #include <CUnit/CUnit.h> 24 static PGresult *result = NULL;
49 CU_ASSERT_EQUAL(rc, 0);
50 CU_PASS(
"DeleteFolders PASS!");
71 CU_ASSERT_EQUAL(rc, 0);
74 memset(sql,
'\0', 1024);
75 snprintf(sql, 1024,
"SELECT * FROM uploadtree WHERE upload_fk = %ld;", UploadId);
76 result = PQexec(
pgConn, sql);
79 CU_FAIL(
"DeleteUploads FAIL!");
83 CU_ASSERT_EQUAL(PQntuples(result),0);
88 memset(sql,
'\0', 1024);
89 snprintf(sql, 1024,
"SELECT * FROM copyright C INNER JOIN uploadtree U ON C.pfile_fk = U.pfile_fk AND U.upload_fk = %ld;", UploadId);
90 result = PQexec(
pgConn, sql);
93 CU_FAIL(
"DeleteUploads FAIL!");
97 CU_ASSERT_EQUAL(PQntuples(result),0);
104 CU_ASSERT_NOT_EQUAL(rc, 0);
107 CU_PASS(
"DeleteUploads PASS!");
char * DBConfFile
DB conf file location.
int fo_checkPQresult(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb)
Check the result status of a postgres SELECT.
int deleteFolder(long cFolder, long pFolder, int userId, int userPerm)
recursively delete a folder
void testDeleteFolders()
for function DeleteFolders
PGconn * pgConn
Database connection.
int deleteUpload(long uploadId, int userId, int userPerm)
Given an upload ID, delete it.
void testDeleteUploads()
for function DeleteUploads
CU_TestInfo testcases_DeleteFolders[]
testcases for function Delete
PGconn * fo_dbconnect(char *DBConfFile, char **ErrorBuf)
Connect to a database. The default is Db.conf.