28 if (!arrayA || !arrayB)
return 0;
36 if (*arrayA == *arrayB)
break;
39 if (!*arrayB)
return 0;
54 FUNCTION
int intAinB(
int intA,
int *arrayB)
57 if (!arrayB)
return 0;
61 if (intA == *arrayB)
return 1;
86 char *fcnName =
"validate_pk";
91 result = PQexec(
pgConn, sql);
93 if (PQntuples(result) > 0) pk = atoi(PQgetvalue(result, 0, 0));
105 printf(
"Usage: %s [debug options]\n", Name);
106 printf(
" Debug options are:\n");
107 printf(
" -i :: Initialize the database, then exit.\n");
108 printf(
" -n :: bucketpool name of bucketpool to use.\n");
109 printf(
" -p :: bucketpool_pk of bucketpool to use.\n");
110 printf(
" -r :: rerun buckets.\n");
111 printf(
" -t :: uploadtree_pk, root of tree to scan.\n");
112 printf(
" -u :: upload_pk to scan.\n");
113 printf(
" -v :: verbose (turns on copious debugging output)\n");
114 printf(
" -V :: print the version info, then exit.\n");
115 printf(
" -c SYSCONFDIR :: Specify the directory for the system configuration. \n");
116 printf(
" NOTE: -n and -p are mutually exclusive. If both are specified\n");
117 printf(
" -p is used. One of these is required.\n");
118 printf(
" NOTE: -t and -u are mutually exclusive. If both are specified\n");
119 printf(
" -u is used. One of these is required.\n");
120 printf(
" NOTE: If none of -nptu are specified, the bucketpool_pk and upload_pk are read from stdin, one comma delimited pair per line. For example, 'bppk=123, upk=987' where 123 is the bucketpool_pk and 987 is the upload_pk. This is the normal execution from the scheduler.\n");
140 int bucketpool_pk,
int bucket_pk)
142 char *fcnName =
"processed";
152 "select bf_pk from bucket_file, bucket_def \
153 where pfile_fk=%d and agent_fk=%d and nomosagent_fk=%d and bucketpool_fk=%d \
154 and bucket_pk=%d and bucket_fk=bucket_pk \
156 select bf_pk from bucket_container, bucket_def \
157 where uploadtree_fk=%d and agent_fk=%d and nomosagent_fk=%d and bucketpool_fk=%d \
158 and bucket_pk=%d and bucket_fk=bucket_pk limit 1",
159 pfile_pk,
agent_pk, nomos_agent_pk, bucketpool_pk, bucket_pk,
160 uploadtree_pk,
agent_pk, nomos_agent_pk, bucketpool_pk, bucket_pk);
165 "select bf_pk from bucket_file, bucket_def \
166 where pfile_fk=%d and agent_fk=%d and nomosagent_fk=%d and bucketpool_fk=%d \
167 and bucket_fk=bucket_pk \
169 select bf_pk from bucket_container, bucket_def \
170 where uploadtree_fk=%d and agent_fk=%d and nomosagent_fk=%d and bucketpool_fk=%d \
171 and bucket_fk=bucket_pk limit 1",
172 pfile_pk,
agent_pk, nomos_agent_pk, bucketpool_pk,
173 uploadtree_pk,
agent_pk, nomos_agent_pk, bucketpool_pk);
175 result = PQexec(
pgConn, sqlbuf);
177 numRecs = PQntuples(result);
180 if (
debug) printf(
"%s: returning %d, for pfile_pk %d, uploadtree_pk %d\n",fcnName,numRecs,pfile_pk, uploadtree_pk);
205 int pfile_pk,
int uploadtree_pk,
208 char *fcnName =
"UploadProcessed";
215 "select ars_pk from bucket_ars \
216 where agent_fk=%d and nomosagent_fk=%d and upload_fk=%d and bucketpool_fk=%d \
217 and ars_success=true limit 1",
218 bucketagent_pk, nomosagent_pk,
upload_pk, bucketpool_pk);
219 result = PQexec(
pgConn, sqlbuf);
221 numRecs = PQntuples(result);
PGconn * pgConn
Database connection.
int fo_checkPQresult(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb)
Check the result status of a postgres SELECT.
FUNCTION void Usage(char *Name)
FUNCTION int UploadProcessed(PGconn *pgConn, int bucketagent_pk, int nomosagent_pk, int pfile_pk, int uploadtree_pk, int upload_pk, int bucketpool_pk)
Has this upload already been bucket processed? This function checks buckets_ars to see if the upload ...
FUNCTION int intAinB(int intA, int *arrayB)
Verify that all the value A is a member of array B.
FUNCTION int validate_pk(PGconn *pgConn, char *sql)
Verify a primary key exists.
FUNCTION int processed(PGconn *pgConn, int agent_pk, int nomos_agent_pk, int pfile_pk, int uploadtree_pk, int bucketpool_pk, int bucket_pk)
Has this pfile or uploadtree_pk already been bucket processed? This only works if the bucket has been...
FUNCTION int arrayAinB(int *arrayA, int *arrayB)
Verify that all the values in array A are also in B.