{"id":27,"date":"2007-06-21T07:01:22","date_gmt":"2007-06-21T07:01:22","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?page_id=27"},"modified":"2008-01-18T16:26:27","modified_gmt":"2008-01-18T16:26:27","slug":"function-jobinqueue","status":"publish","type":"page","link":"https:\/\/www.wapshere.com\/missmiis\/code-snippets\/function-jobinqueue","title":{"rendered":"jobRunner.vbs: Function JobInQueue"},"content":{"rendered":"<p style=\"margin: 0cm 0cm 0pt\" class=\"MsoNormal\"><span lang=\"EN-GB\"><font face=\"Times New Roman\">Returns the found job and deletes it from the Queue<\/font><\/span><br \/>\n\u00c2\u00a0<\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"MsoNormal\"><span lang=\"EN-GB\"><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\" face=\"Microsoft Sans Serif\">Function JobInQueue(ByRef Task, ByRef Name, ByRef Profile)<\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Dim objDB, sqlQuery, recordset<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 JobInQueue = FALSE<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Task = &#8220;&#8221;<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Name = \u00e2\u20ac\u0153\u00e2\u20ac\u009d<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Profile = &#8220;&#8221;<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Set objDB = CreateObject(&#8220;ADODB.Connection&#8221;)<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Set recordset = CreateObject(&#8220;ADODB.Recordset&#8221;)<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 objDB.Open DB_CONNECT_STRING<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 sqlQuery = &#8220;select top 1 * from &#8221; &amp; DB_TABLE_QUEUE &amp; &#8221; order by priority&#8221; <\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 recordset.Open sqlQuery, objDB<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 If Not recordset.EOF Then<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Task = recordset.Fields(&#8220;Task&#8221;)<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Name = recordset.Fields(&#8220;Name&#8221;)<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Profile = recordset.Fields(&#8220;Profile&#8221;)<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 End If<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 objDB.Close<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 If Not Task = &#8220;&#8221; Then<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 WriteLog &#8220;Found in Queue: &#8221; &amp; Task &amp; &#8220;, &#8221; &amp; Name &amp; \u00e2\u20ac\u0153, \u00e2\u20ac\u0153 &amp; Profile<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 JobInQueue = TRUE<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 <a href=\"https:\/\/www.wapshere.com\/missmiis\/?page_id=28\">DeleteFromQueue<\/a> Task, Name, Profile<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\"><font face=\"Microsoft Sans Serif\"><span><\/span><span><\/span>\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 End If<\/font><\/font><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt\" class=\"Code\"><span lang=\"EN-GB\"><font size=\"1\" face=\"Microsoft Sans Serif\">End Function<\/font><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Returns the found job and deletes it from the Queue \u00c2\u00a0 Function JobInQueue(ByRef Task, ByRef Name, ByRef Profile) \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Dim objDB, sqlQuery, recordset \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 JobInQueue = FALSE \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Task = &#8220;&#8221; \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Name = \u00e2\u20ac\u0153\u00e2\u20ac\u009d \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Profile = &#8220;&#8221; \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Set objDB = CreateObject(&#8220;ADODB.Connection&#8221;) \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Set recordset = CreateObject(&#8220;ADODB.Recordset&#8221;) \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 objDB.Open DB_CONNECT_STRING \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 sqlQuery =&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":30,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-27","page","type-page","status-publish","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/Pkp1o-r","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages\/27","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/comments?post=27"}],"version-history":[{"count":0,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages\/27\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages\/30"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}