[CalendarServer-changes] [15142] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Mon Sep 21 07:34:01 PDT 2015
Revision: 15142
http://trac.calendarserver.org//changeset/15142
Author: cdaboo at apple.com
Date: 2015-09-21 07:34:01 -0700 (Mon, 21 Sep 2015)
Log Message:
-----------
Latest CDT and twext. Support Oracle stored procedures for next_job.
Modified Paths:
--------------
CalendarServer/trunk/requirements-dev.txt
CalendarServer/trunk/requirements-stable.txt
CalendarServer/trunk/txdav/base/datastore/dbapiclient.py
CalendarServer/trunk/txdav/common/datastore/sql_schema/current-oracle-dialect-extras.sql
CalendarServer/trunk/txdav/common/datastore/sql_schema/current-oracle-dialect.sql
CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_58_to_59.sql
CalendarServer/trunk/txdav/common/datastore/test/test_sql_schema_files.py
Modified: CalendarServer/trunk/requirements-dev.txt
===================================================================
--- CalendarServer/trunk/requirements-dev.txt 2015-09-21 14:29:03 UTC (rev 15141)
+++ CalendarServer/trunk/requirements-dev.txt 2015-09-21 14:34:01 UTC (rev 15142)
@@ -8,4 +8,4 @@
q
tl.eggdeps
--editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVClientLibrary/trunk@14856#egg=CalDAVClientLibrary
---editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVTester/trunk@15066#egg=CalDAVTester
+--editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVTester/trunk@15138#egg=CalDAVTester
Modified: CalendarServer/trunk/requirements-stable.txt
===================================================================
--- CalendarServer/trunk/requirements-stable.txt 2015-09-21 14:29:03 UTC (rev 15141)
+++ CalendarServer/trunk/requirements-stable.txt 2015-09-21 14:34:01 UTC (rev 15142)
@@ -36,7 +36,7 @@
#pyOpenSSL
pycrypto==2.6.1
- --editable svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@15118#egg=twextpy
+ --editable svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@15141#egg=twextpy
cffi==1.1.0
pycparser==2.13
#twisted
@@ -68,7 +68,7 @@
#six
six==1.9.0
- --editable svn+http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk@15134#egg=kerberos
+ --editable svn+http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk@15140#egg=kerberos
--editable svn+http://svn.calendarserver.org/repository/calendarserver/PyCalendar/trunk@15020#egg=pycalendar
python-dateutil==1.5 # Note: v2.0+ is for Python 3
Modified: CalendarServer/trunk/txdav/base/datastore/dbapiclient.py
===================================================================
--- CalendarServer/trunk/txdav/base/datastore/dbapiclient.py 2015-09-21 14:29:03 UTC (rev 15141)
+++ CalendarServer/trunk/txdav/base/datastore/dbapiclient.py 2015-09-21 14:34:01 UTC (rev 15142)
@@ -149,7 +149,15 @@
return super(OracleCursorWrapper, self).execute(sql, realArgs)
+ def callproc(self, name, args=()):
+ return self.realCursor.callproc(name, args)
+
+ def callfunc(self, name, returnType, args=()):
+ return self.realCursor.callfunc(name, returnType, args)
+
+
+
class DiagnosticConnectionWrapper(object):
"""
Diagnostic wrapper around a DB-API 2.0 connection for debugging connection
Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/current-oracle-dialect-extras.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/current-oracle-dialect-extras.sql 2015-09-21 14:29:03 UTC (rev 15141)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/current-oracle-dialect-extras.sql 2015-09-21 14:34:01 UTC (rev 15142)
@@ -15,3 +15,66 @@
----
-- Extra schema to add to current-oracle-dialect.sql
+
+create or replace function next_job_all(now timestamp)
+ return integer is
+ cursor c1 is
+ select JOB_ID from JOB
+ where ASSIGNED is NULL and PAUSE = 0 and NOT_BEFORE <= now
+ order by PRIORITY desc
+ for update skip locked;
+ result integer;
+begin
+ open c1;
+ fetch c1 into result;
+ close c1;
+ return result;
+end;
+/
+
+create or replace function next_job_medium_high(now timestamp)
+ return integer is
+ cursor c1 is
+ select JOB_ID from JOB
+ where PRIORITY != 0 and ASSIGNED is NULL and PAUSE = 0 and NOT_BEFORE <= now
+ order by PRIORITY desc
+ for update skip locked;
+ result integer;
+begin
+ open c1;
+ fetch c1 into result;
+ close c1;
+ return result;
+end;
+/
+
+create or replace function next_job_high(now timestamp)
+ return integer is
+ cursor c1 is
+ select JOB_ID from JOB
+ where PRIORITY = 2 and ASSIGNED is NULL and PAUSE = 0 and NOT_BEFORE <= now
+ order by PRIORITY desc
+ for update skip locked;
+ result integer;
+begin
+ open c1;
+ fetch c1 into result;
+ close c1;
+ return result;
+end;
+/
+
+create or replace function overdue_job(now timestamp)
+ return integer is
+ cursor c1 is
+ select JOB_ID from JOB
+ where ASSIGNED is not NULL and OVERDUE <= now
+ for update skip locked;
+ result integer;
+begin
+ open c1;
+ fetch c1 into result;
+ close c1;
+ return result;
+end;
+/
Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/current-oracle-dialect.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/current-oracle-dialect.sql 2015-09-21 14:29:03 UTC (rev 15141)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/current-oracle-dialect.sql 2015-09-21 14:34:01 UTC (rev 15142)
@@ -1052,3 +1052,66 @@
);
-- Extra schema to add to current-oracle-dialect.sql
+
+create or replace function next_job_all(now timestamp)
+ return integer is
+ cursor c1 is
+ select JOB_ID from JOB
+ where ASSIGNED is NULL and PAUSE = 0 and NOT_BEFORE <= now
+ order by PRIORITY desc
+ for update skip locked;
+ result integer;
+begin
+ open c1;
+ fetch c1 into result;
+ close c1;
+ return result;
+end;
+/
+
+create or replace function next_job_medium_high(now timestamp)
+ return integer is
+ cursor c1 is
+ select JOB_ID from JOB
+ where PRIORITY != 0 and ASSIGNED is NULL and PAUSE = 0 and NOT_BEFORE <= now
+ order by PRIORITY desc
+ for update skip locked;
+ result integer;
+begin
+ open c1;
+ fetch c1 into result;
+ close c1;
+ return result;
+end;
+/
+
+create or replace function next_job_high(now timestamp)
+ return integer is
+ cursor c1 is
+ select JOB_ID from JOB
+ where PRIORITY = 2 and ASSIGNED is NULL and PAUSE = 0 and NOT_BEFORE <= now
+ order by PRIORITY desc
+ for update skip locked;
+ result integer;
+begin
+ open c1;
+ fetch c1 into result;
+ close c1;
+ return result;
+end;
+/
+
+create or replace function overdue_job(now timestamp)
+ return integer is
+ cursor c1 is
+ select JOB_ID from JOB
+ where ASSIGNED is not NULL and OVERDUE <= now
+ for update skip locked;
+ result integer;
+begin
+ open c1;
+ fetch c1 into result;
+ close c1;
+ return result;
+end;
+/
Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_58_to_59.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_58_to_59.sql 2015-09-21 14:29:03 UTC (rev 15141)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_58_to_59.sql 2015-09-21 14:34:01 UTC (rev 15142)
@@ -37,6 +37,68 @@
"OVERDUE"
);
+create or replace function next_job_all(now timestamp)
+ return integer is
+ cursor c1 is
+ select JOB_ID from JOB
+ where ASSIGNED is NULL and PAUSE = 0 and NOT_BEFORE <= now
+ order by PRIORITY desc
+ for update skip locked;
+ result integer;
+begin
+ open c1;
+ fetch c1 into result;
+ close c1;
+ return result;
+end;
+/
+create or replace function next_job_medium_high(now timestamp)
+ return integer is
+ cursor c1 is
+ select JOB_ID from JOB
+ where PRIORITY != 0 and ASSIGNED is NULL and PAUSE = 0 and NOT_BEFORE <= now
+ order by PRIORITY desc
+ for update skip locked;
+ result integer;
+begin
+ open c1;
+ fetch c1 into result;
+ close c1;
+ return result;
+end;
+/
+
+create or replace function next_job_high(now timestamp)
+ return integer is
+ cursor c1 is
+ select JOB_ID from JOB
+ where PRIORITY = 2 and ASSIGNED is NULL and PAUSE = 0 and NOT_BEFORE <= now
+ order by PRIORITY desc
+ for update skip locked;
+ result integer;
+begin
+ open c1;
+ fetch c1 into result;
+ close c1;
+ return result;
+end;
+/
+
+create or replace function overdue_job(now timestamp)
+ return integer is
+ cursor c1 is
+ select JOB_ID from JOB
+ where ASSIGNED is not NULL and OVERDUE <= now
+ for update skip locked;
+ result integer;
+begin
+ open c1;
+ fetch c1 into result;
+ close c1;
+ return result;
+end;
+/
+
-- update the version
update CALENDARSERVER set VALUE = '59' where NAME = 'VERSION';
Modified: CalendarServer/trunk/txdav/common/datastore/test/test_sql_schema_files.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/test/test_sql_schema_files.py 2015-09-21 14:29:03 UTC (rev 15141)
+++ CalendarServer/trunk/txdav/common/datastore/test/test_sql_schema_files.py 2015-09-21 14:34:01 UTC (rev 15142)
@@ -114,6 +114,10 @@
if constraint.affectsColumns[0].type.name in ("text", "char", "varchar"):
table.constraints.remove(constraint)
+ # Remove stored procedures which we only use on Oracle
+ schema_oracle.functions = []
+
+
mismatched = schema_current.compare(schema_oracle)
self.assertEqual(len(mismatched), 0, msg=", ".join(mismatched))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150921/11e8223c/attachment.html>
More information about the calendarserver-changes
mailing list