[CalendarServer-changes] [8170] CalendarServer/branches/users/glyph/shared-pool-take2/calendarserver /tap
source_changes at macosforge.org
source_changes at macosforge.org
Mon Oct 10 08:05:08 PDT 2011
Revision: 8170
http://trac.macosforge.org/projects/calendarserver/changeset/8170
Author: glyph at apple.com
Date: 2011-10-10 08:05:08 -0700 (Mon, 10 Oct 2011)
Log Message:
-----------
Relay configured dialect and paramstyle to shared connection pool.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/shared-pool-take2/calendarserver/tap/caldav.py
CalendarServer/branches/users/glyph/shared-pool-take2/calendarserver/tap/util.py
Modified: CalendarServer/branches/users/glyph/shared-pool-take2/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/shared-pool-take2/calendarserver/tap/caldav.py 2011-10-10 15:04:52 UTC (rev 8169)
+++ CalendarServer/branches/users/glyph/shared-pool-take2/calendarserver/tap/caldav.py 2011-10-10 15:05:08 UTC (rev 8170)
@@ -638,14 +638,20 @@
L{makeService_Combined}, which does the work of actually handling
CalDAV and CardDAV requests.
"""
+ if config.DBType == 'oracle':
+ dialect = ORACLE_DIALECT
+ paramstyle = 'numeric'
+ else:
+ dialect = POSTGRES_DIALECT
+ paramstyle = 'pyformat'
pool = None
if config.DBAMPFD:
- txnFactory = transactionFactoryFromFD(int(config.DBAMPFD))
+ txnFactory = transactionFactoryFromFD(
+ int(config.DBAMPFD), dialect, paramstyle
+ )
elif not config.UseDatabase:
txnFactory = None
elif not config.SharedConnectionPool:
- dialect = POSTGRES_DIALECT
- paramstyle = 'pyformat'
if config.DBType == '':
# get a PostgresService to tell us what the local connection
# info is, but *don't* start it (that would start one postgres
@@ -655,8 +661,6 @@
elif config.DBType == 'postgres':
connectionFactory = pgConnectorFromConfig(config)
elif config.DBType == 'oracle':
- dialect = ORACLE_DIALECT
- paramstyle = 'numeric'
connectionFactory = oracleConnectorFromConfig(config)
else:
raise UsageError("unknown DB type: %r" % (config.DBType,))
Modified: CalendarServer/branches/users/glyph/shared-pool-take2/calendarserver/tap/util.py
===================================================================
--- CalendarServer/branches/users/glyph/shared-pool-take2/calendarserver/tap/util.py 2011-10-10 15:04:52 UTC (rev 8169)
+++ CalendarServer/branches/users/glyph/shared-pool-take2/calendarserver/tap/util.py 2011-10-10 15:05:08 UTC (rev 8170)
@@ -156,13 +156,13 @@
-def transactionFactoryFromFD(dbampfd):
+def transactionFactoryFromFD(dbampfd, dialect, paramstyle):
"""
Create a transaction factory from an inherited file descriptor.
"""
skt = fromfd(dbampfd, AF_UNIX, SOCK_STREAM)
os.close(dbampfd)
- protocol = ConnectionPoolClient()
+ protocol = ConnectionPoolClient(dialect=dialect, paramstyle=paramstyle)
transport = ConnectionWithPeer(skt, protocol)
protocol.makeConnection(transport)
transport.startReading()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20111010/73b5572f/attachment-0001.html>
More information about the calendarserver-changes
mailing list