16 #ifndef SQLSTATEMENTS_H
17 #define SQLSTATEMENTS_H
23 " SELECT column_name FROM information_schema.columns "
24 " WHERE table_catalog = '%s' "
25 " AND table_schema = 'public' "
32 " SELECT conf_value FROM sysconfig "
33 " WHERE variablename = 'FOSSologyURL';";
39 " SELECT job_upload_fk FROM job, jobqueue "
40 " WHERE jq_job_fk = job_pk "
47 " SELECT * FROM jobqueue "
48 " LEFT JOIN job ON jq_job_fk = job_pk"
49 " WHERE job.job_upload_fk = %d;";
55 " SELECT folder_name, folder_pk FROM folder "
56 " LEFT JOIN foldercontents ON folder_pk = foldercontents.parent_fk "
57 " LEFT JOIN job ON child_id = job_upload_fk "
58 " LEFT JOIN jobqueue ON jq_job_fk = job_pk "
66 " SELECT folder_name, folder_pk FROM folder "
67 " INNER JOIN foldercontents ON folder_pk=foldercontents.parent_fk "
68 " WHERE child_id = %d AND foldercontents_mode = 1;";
74 " SELECT upload_filename FROM upload "
75 " LEFT JOIN job ON upload_pk = job_upload_fk "
76 " LEFT JOIN jobqueue ON jq_job_fk = job_pk "
83 " SELECT upload_fk, uploadtree_pk FROM uploadtree "
84 " LEFT JOIN job ON upload_fk = job_upload_fk "
85 " LEFT JOIN jobqueue ON jq_job_fk = job_pk "
86 " WHERE parent IS NULL"
93 " SELECT user_name, user_email, email_notify FROM users, upload "
94 " WHERE user_pk = user_fk "
95 " AND upload_pk = %d;";
101 " SELECT user_name, user_email, email_notify FROM users, job, jobqueue "
102 " WHERE user_pk = job_user_fk AND job_pk = jq_job_fk "
110 " SELECT jobqueue.* FROM jobqueue INNER JOIN job ON job_pk = jq_job_fk "
111 " WHERE jq_starttime IS NULL AND jq_end_bits < 2 "
112 " AND NOT EXISTS(SELECT * FROM jobdepends, jobqueue jdep "
113 " WHERE jdep_jq_fk=jobqueue.jq_pk "
114 " AND jdep_jq_depends_fk=jdep.jq_pk"
115 " AND NOT(jdep.jq_endtime IS NOT NULL AND jdep.jq_end_bits < 2)) "
116 " ORDER BY job_priority DESC "
123 " SELECT user_pk, job_priority, job_group_fk as group_pk FROM users "
124 " LEFT JOIN job ON job_user_fk = user_pk "
125 " WHERE job_pk = '%s';";
132 " SET jq_starttime = now(), "
133 " jq_schedinfo ='%s.%d', "
134 " jq_endtext = 'Started' "
135 " WHERE jq_pk = '%d';";
142 " SET jq_endtime = now(), "
143 " jq_end_bits = jq_end_bits | 1, "
144 " jq_schedinfo = null, "
145 " jq_endtext = 'Completed' "
146 " WHERE jq_pk = '%d';";
153 " SET jq_endtext = 'Restarted', "
154 " jq_starttime = ( CASE "
155 " WHEN jq_starttime = CAST('9999-12-31' AS timestamp with time zone) "
157 " ELSE jq_starttime "
159 " WHERE jq_pk = '%d';";
166 " SET jq_endtime = now(), "
167 " jq_end_bits = jq_end_bits | 2, "
168 " jq_schedinfo = null, "
169 " jq_endtext = '%s' "
170 " WHERE jq_pk = '%d';";
177 " SET jq_itemsprocessed = %d "
178 " WHERE jq_pk = '%d';";
185 " SET jq_endtext = 'Paused', "
186 " jq_starttime = ( CASE "
187 " WHEN jq_starttime IS NULL "
188 " THEN CAST('9999-12-31' AS timestamp with time zone) "
189 " ELSE jq_starttime "
191 " WHERE jq_pk = '%d';";
198 " SET jq_log = '%s' "
199 " WHERE jq_pk = '%d';";
206 " SET job_priority = '%d' "
207 " WHERE job_pk IN ( "
208 " SELECT jq_job_fk FROM jobqueue "
209 " WHERE jq_pk = '%d');";
215 " SELECT * FROM jobqueue "
216 " WHERE jq_starttime IS NULL AND jq_end_bits < 2 "
217 " AND NOT EXISTS(SELECT * FROM jobdepends, jobqueue jdep "
218 " WHERE jdep_jq_fk=jobqueue.jq_pk "
219 " AND jdep_jq_depends_fk=jdep.jq_pk"
220 " AND NOT(jdep.jq_endtime IS NOT NULL AND jdep.jq_end_bits < 2))"
221 " AND jq_job_fk = (SELECT jq_job_fk FROM jobqueue queue WHERE queue.jq_pk = %d)";
227 " SELECT jq_pk, jq_end_bits FROM jobqueue "
228 " WHERE jq_job_fk = ( "
229 " SELECT jq_job_fk FROM jobqueue "
238 " SET jq_starttime=null, "
240 " jq_schedinfo=null "
241 " WHERE jq_endtime is NULL;";
247 " SELECT * FROM jobqueue "
248 " WHERE jq_job_fk = ( "
249 " SELECT jq_job_fk FROM jobqueue "
257 " SELECT conf_value, variablename FROM sysconfig "
258 " WHERE variablename LIKE 'SMTP%';";
const char * jobsql_started
const char * check_scheduler_tables
const char * jobsql_paused
const char * jobsql_failed
const char * upload_common
const char * jobsql_information
const char * jobsql_jobinfo
const char * parent_folder_name
const char * jobsql_processed
const char * jobsql_resetqueue
const char * basic_checkout
const char * url_checkout
const char * jobsql_restart
const char * jobsql_anyrunnable
const char * jobsql_complete
const char * jobsql_priority
const char * jobsql_email
const char * jobsql_jobendbits
const char * jobsql_email_job
const char * select_upload_fk