41 $ARSarray = array(
"pkgagent" =>
"pkgagent_ars",
42 "copyright" =>
"copyright_ars",
43 "mimetype" =>
"mimetype_ars",
44 "unpack" =>
"ununpack_ars",
45 "ununpack" =>
"ununpack_ars");
47 foreach($ARSarray as $agent_name => $ARStablename)
56 $sql =
"select distinct job_upload_fk, jq_type, jq_starttime, jq_endtime from jobqueue 57 join job on jq_job_fk=job_pk where jq_type='$agent_name' and (jq_end_bits=1) order by jq_type";
58 $result = pg_query($PG_CONN, $sql);
62 while ($row = pg_fetch_assoc($result))
64 $upload_fk = $row[
'job_upload_fk'];
67 $sql =
"select ars_pk from $ARStablename where agent_fk=$agent_pk and upload_fk=$upload_fk and ars_success=true";
68 $checkrec = pg_query($PG_CONN, $sql);
70 $num_rows = pg_num_rows($checkrec);
71 pg_free_result($checkrec);
72 if ($num_rows > 0)
continue;
75 $sql =
"insert into $ARStablename (agent_fk, upload_fk, ars_success, ars_starttime, ars_endtime) 76 values ($agent_pk, $upload_fk, true, '$row[jq_starttime]', '$row[jq_endtime]')";
78 echo
"DryRun: $sql\n";
81 $insresult = pg_query($PG_CONN, $sql);
83 pg_free_result($insresult);
86 pg_free_result($result);
106 $sql =
"CREATE TABLE $ARStablename () INHERITS (ars_master)";
107 $result = pg_query($PG_CONN, $sql);
Migrate_14_20($DryRun)
Create the new ars tables and populate them from the job/jobqueue data.
CreateARStable($ARStablename)
Create ars table.
DB_TableExists($tableName)
Check if table exists.
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.
GetAgentKey($agentName, $agentDesc)
Get the latest enabled agent_pk for a given agent.