28 char *fcnName =
"childInBucket";
33 lft = puploadtree->
lft;
34 rgt = puploadtree->
rgt;
41 snprintf(sql,
sizeof(sql),
42 "select uploadtree_pk from %s \
43 inner join bucket_container \
44 on uploadtree_fk=uploadtree_pk and bucket_fk=%d \
45 and agent_fk=%d and nomosagent_fk=%d \
46 where upload_fk=%d and %s.lft BETWEEN %d and %d limit 1",
47 bucketDef->uploadtree_tablename,
50 bucketDef->uploadtree_tablename,
53 result = PQexec(
pgConn, sql);
55 rv = PQntuples(result);
60 snprintf(sql,
sizeof(sql),
61 "select uploadtree_pk from %s \
62 inner join bucket_file \
63 on %s.pfile_fk=bucket_file.pfile_fk and bucket_fk=%d \
64 and agent_fk=%d and nomosagent_fk=%d \
65 where upload_fk=%d and %s.lft BETWEEN %d and %d limit 1",
66 bucketDef->uploadtree_tablename,
67 bucketDef->uploadtree_tablename,
70 bucketDef->uploadtree_tablename,
73 result = PQexec(
pgConn, sql);
75 rv = PQntuples(result);
PGconn * pgConn
Database connection.
FUNCTION int childInBucket(PGconn *pgConn, pbucketdef_t bucketDef, puploadtree_t puploadtree)
Given a container uploadtree_pk and bucketdef, determine if any child is in this bucket.
int fo_checkPQresult(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb)
Check the result status of a postgres SELECT.