8 #include <CUnit/CUnit.h>
13 static PGresult *result = NULL;
38 CU_ASSERT_EQUAL(rc, 0);
39 CU_PASS(
"DeleteFolders PASS!");
60 CU_ASSERT_EQUAL(rc, 0);
63 memset(sql,
'\0', 1024);
64 snprintf(sql, 1024,
"SELECT * FROM uploadtree WHERE upload_fk = %ld;", UploadId);
65 result = PQexec(
pgConn, sql);
68 CU_FAIL(
"DeleteUploads FAIL!");
72 CU_ASSERT_EQUAL(PQntuples(result),0);
77 memset(sql,
'\0', 1024);
78 snprintf(sql, 1024,
"SELECT * FROM copyright C INNER JOIN uploadtree U ON C.pfile_fk = U.pfile_fk AND U.upload_fk = %ld;", UploadId);
79 result = PQexec(
pgConn, sql);
82 CU_FAIL(
"DeleteUploads FAIL!");
86 CU_ASSERT_EQUAL(PQntuples(result),0);
93 CU_ASSERT_NOT_EQUAL(rc, 0);
96 CU_PASS(
"DeleteUploads PASS!");
PGconn * pgConn
Database connection.
int deleteUpload(long uploadId, int userId, int userPerm)
Given an upload ID, delete it.
int deleteFolder(long cFolder, long pFolder, int userId, int userPerm)
recursively delete a folder
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.
void testDeleteFolders()
for function DeleteFolders
char * DBConfFile
DB conf file location.
void testDeleteUploads()
for function DeleteUploads
CU_TestInfo testcases_DeleteFolders[]
testcases for function Delete