Change line endings to canonical type (using eol extension).
This commit is contained in:
parent
20cc12d160
commit
d72e31ff7e
136
doc/Makefile
136
doc/Makefile
@ -1,68 +1,68 @@
|
||||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d .build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
|
||||
.PHONY: help clean html web htmlhelp latex changes linkcheck
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " web to make files usable by Sphinx.web"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " changes to make an overview over all changed/added/deprecated items"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
|
||||
clean:
|
||||
-rm -rf .build/*
|
||||
|
||||
html:
|
||||
mkdir -p .build/doctrees
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) ../html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in ../html."
|
||||
|
||||
web:
|
||||
mkdir -p .build/web .build/doctrees
|
||||
$(SPHINXBUILD) -b web $(ALLSPHINXOPTS) .build/web
|
||||
@echo
|
||||
@echo "Build finished; now you can run"
|
||||
@echo " python -m sphinx.web .build/web"
|
||||
@echo "to start the server."
|
||||
|
||||
htmlhelp:
|
||||
mkdir -p .build/htmlhelp .build/doctrees
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) .build/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in .build/htmlhelp."
|
||||
|
||||
latex:
|
||||
mkdir -p .build/latex .build/doctrees
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) .build/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in .build/latex."
|
||||
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
|
||||
"run these through (pdf)latex."
|
||||
|
||||
changes:
|
||||
mkdir -p .build/changes .build/doctrees
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) .build/changes
|
||||
@echo
|
||||
@echo "The overview file is in .build/changes."
|
||||
|
||||
linkcheck:
|
||||
mkdir -p .build/linkcheck .build/doctrees
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) .build/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in .build/linkcheck/output.txt."
|
||||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d .build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
|
||||
.PHONY: help clean html web htmlhelp latex changes linkcheck
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " web to make files usable by Sphinx.web"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " changes to make an overview over all changed/added/deprecated items"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
|
||||
clean:
|
||||
-rm -rf .build/*
|
||||
|
||||
html:
|
||||
mkdir -p .build/doctrees
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) ../html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in ../html."
|
||||
|
||||
web:
|
||||
mkdir -p .build/web .build/doctrees
|
||||
$(SPHINXBUILD) -b web $(ALLSPHINXOPTS) .build/web
|
||||
@echo
|
||||
@echo "Build finished; now you can run"
|
||||
@echo " python -m sphinx.web .build/web"
|
||||
@echo "to start the server."
|
||||
|
||||
htmlhelp:
|
||||
mkdir -p .build/htmlhelp .build/doctrees
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) .build/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in .build/htmlhelp."
|
||||
|
||||
latex:
|
||||
mkdir -p .build/latex .build/doctrees
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) .build/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in .build/latex."
|
||||
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
|
||||
"run these through (pdf)latex."
|
||||
|
||||
changes:
|
||||
mkdir -p .build/changes .build/doctrees
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) .build/changes
|
||||
@echo
|
||||
@echo "The overview file is in .build/changes."
|
||||
|
||||
linkcheck:
|
||||
mkdir -p .build/linkcheck .build/doctrees
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) .build/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in .build/linkcheck/output.txt."
|
||||
|
||||
@ -1,144 +1,144 @@
|
||||
.. _subscrobj:
|
||||
|
||||
*******************
|
||||
Subscription Object
|
||||
*******************
|
||||
|
||||
.. note::
|
||||
|
||||
This object is an extension the DB API and is only available in Oracle 10g
|
||||
Release 2 and higher.
|
||||
|
||||
|
||||
.. attribute:: Subscription.callback
|
||||
|
||||
This read-only attribute returns the callback that was registered when the
|
||||
subscription was created.
|
||||
|
||||
|
||||
.. attribute:: Subscription.connection
|
||||
|
||||
This read-only attribute returns the connection that was used to register
|
||||
the subscription when it was created.
|
||||
|
||||
|
||||
.. attribute:: Subscription.namespace
|
||||
|
||||
This read-only attribute returns the namespace used to register the
|
||||
subscription when it was created.
|
||||
|
||||
|
||||
.. attribute:: Subscription.operations
|
||||
|
||||
This read-only attribute returns the operations that will send notifications
|
||||
for each table that is registered using this subscription.
|
||||
|
||||
|
||||
.. attribute:: Subscription.port
|
||||
|
||||
This read-only attribute returns the port used for callback notifications
|
||||
from the database server. If not set during construction, this value is
|
||||
zero.
|
||||
|
||||
|
||||
.. attribute:: Subscription.protocol
|
||||
|
||||
This read-only attribute returns the protocol used to register the
|
||||
subscription when it was created.
|
||||
|
||||
|
||||
.. method:: Subscription.registerquery(statement, [args])
|
||||
|
||||
Register the query for subsequent notification when tables referenced by the
|
||||
query are changed. This behaves similarly to cursor.execute() but only
|
||||
queries are permitted and the arguments must be a sequence or dictionary.
|
||||
|
||||
|
||||
.. attribute:: Subscription.rowids
|
||||
|
||||
This read-only attribute returns True or False specifying if rowids will be
|
||||
included in notifications sent using this subscription.
|
||||
|
||||
|
||||
.. attribute:: Subscription.timeout
|
||||
|
||||
This read-only attribute returns the timeout (in seconds) used to register
|
||||
the subscription when it was created. A timeout value of 0 indicates that
|
||||
there is no timeout.
|
||||
|
||||
|
||||
Message Objects
|
||||
===============
|
||||
|
||||
.. note::
|
||||
|
||||
This object is created internally when notification is received and passed
|
||||
to the callback procedure specified when a subscription is created.
|
||||
|
||||
|
||||
.. attribute:: Message.dbname
|
||||
|
||||
This read-only attribute returns the name of the database that generated the
|
||||
notification.
|
||||
|
||||
|
||||
.. attribute:: Message.tables
|
||||
|
||||
This read-only attribute returns a list of message table objects that give
|
||||
information about the tables changed for this notification.
|
||||
|
||||
|
||||
.. attribute:: Message.type
|
||||
|
||||
This read-only attribute returns the type of message that has been sent.
|
||||
See the constants section on database change notification for additional
|
||||
information.
|
||||
|
||||
|
||||
Message Table Objects
|
||||
=====================
|
||||
|
||||
.. note::
|
||||
|
||||
This object is created internally for each table changed when notification
|
||||
is received and is found in the tables attribute of message objects.
|
||||
|
||||
|
||||
.. attribute:: MessageTable.name
|
||||
|
||||
This read-only attribute returns the name of the table that was changed.
|
||||
|
||||
|
||||
.. attribute:: MessageTable.operation
|
||||
|
||||
This read-only attribute returns the operation that took place on the table
|
||||
that was changed.
|
||||
|
||||
|
||||
.. attribute:: MessageTable.rows
|
||||
|
||||
This read-only attribute returns a list of message row objects that give
|
||||
information about the rows changed on the table. This value is only filled
|
||||
in if the rowids argument to the Connection.subscribe() method is True.
|
||||
|
||||
|
||||
Message Row Objects
|
||||
===================
|
||||
|
||||
.. note::
|
||||
|
||||
This object is created internally for each row changed on a table when
|
||||
notification is received and is found in the rows attribute of message table
|
||||
objects.
|
||||
|
||||
|
||||
.. attribute:: MessageRow.operation
|
||||
|
||||
This read-only attribute returns the operation that took place on the row
|
||||
that was changed.
|
||||
|
||||
|
||||
.. attribute:: MessageRow.rowid
|
||||
|
||||
This read-only attribute returns the rowid of the row that was changed.
|
||||
|
||||
.. _subscrobj:
|
||||
|
||||
*******************
|
||||
Subscription Object
|
||||
*******************
|
||||
|
||||
.. note::
|
||||
|
||||
This object is an extension the DB API and is only available in Oracle 10g
|
||||
Release 2 and higher.
|
||||
|
||||
|
||||
.. attribute:: Subscription.callback
|
||||
|
||||
This read-only attribute returns the callback that was registered when the
|
||||
subscription was created.
|
||||
|
||||
|
||||
.. attribute:: Subscription.connection
|
||||
|
||||
This read-only attribute returns the connection that was used to register
|
||||
the subscription when it was created.
|
||||
|
||||
|
||||
.. attribute:: Subscription.namespace
|
||||
|
||||
This read-only attribute returns the namespace used to register the
|
||||
subscription when it was created.
|
||||
|
||||
|
||||
.. attribute:: Subscription.operations
|
||||
|
||||
This read-only attribute returns the operations that will send notifications
|
||||
for each table that is registered using this subscription.
|
||||
|
||||
|
||||
.. attribute:: Subscription.port
|
||||
|
||||
This read-only attribute returns the port used for callback notifications
|
||||
from the database server. If not set during construction, this value is
|
||||
zero.
|
||||
|
||||
|
||||
.. attribute:: Subscription.protocol
|
||||
|
||||
This read-only attribute returns the protocol used to register the
|
||||
subscription when it was created.
|
||||
|
||||
|
||||
.. method:: Subscription.registerquery(statement, [args])
|
||||
|
||||
Register the query for subsequent notification when tables referenced by the
|
||||
query are changed. This behaves similarly to cursor.execute() but only
|
||||
queries are permitted and the arguments must be a sequence or dictionary.
|
||||
|
||||
|
||||
.. attribute:: Subscription.rowids
|
||||
|
||||
This read-only attribute returns True or False specifying if rowids will be
|
||||
included in notifications sent using this subscription.
|
||||
|
||||
|
||||
.. attribute:: Subscription.timeout
|
||||
|
||||
This read-only attribute returns the timeout (in seconds) used to register
|
||||
the subscription when it was created. A timeout value of 0 indicates that
|
||||
there is no timeout.
|
||||
|
||||
|
||||
Message Objects
|
||||
===============
|
||||
|
||||
.. note::
|
||||
|
||||
This object is created internally when notification is received and passed
|
||||
to the callback procedure specified when a subscription is created.
|
||||
|
||||
|
||||
.. attribute:: Message.dbname
|
||||
|
||||
This read-only attribute returns the name of the database that generated the
|
||||
notification.
|
||||
|
||||
|
||||
.. attribute:: Message.tables
|
||||
|
||||
This read-only attribute returns a list of message table objects that give
|
||||
information about the tables changed for this notification.
|
||||
|
||||
|
||||
.. attribute:: Message.type
|
||||
|
||||
This read-only attribute returns the type of message that has been sent.
|
||||
See the constants section on database change notification for additional
|
||||
information.
|
||||
|
||||
|
||||
Message Table Objects
|
||||
=====================
|
||||
|
||||
.. note::
|
||||
|
||||
This object is created internally for each table changed when notification
|
||||
is received and is found in the tables attribute of message objects.
|
||||
|
||||
|
||||
.. attribute:: MessageTable.name
|
||||
|
||||
This read-only attribute returns the name of the table that was changed.
|
||||
|
||||
|
||||
.. attribute:: MessageTable.operation
|
||||
|
||||
This read-only attribute returns the operation that took place on the table
|
||||
that was changed.
|
||||
|
||||
|
||||
.. attribute:: MessageTable.rows
|
||||
|
||||
This read-only attribute returns a list of message row objects that give
|
||||
information about the rows changed on the table. This value is only filled
|
||||
in if the rowids argument to the Connection.subscribe() method is True.
|
||||
|
||||
|
||||
Message Row Objects
|
||||
===================
|
||||
|
||||
.. note::
|
||||
|
||||
This object is created internally for each row changed on a table when
|
||||
notification is received and is found in the rows attribute of message table
|
||||
objects.
|
||||
|
||||
|
||||
.. attribute:: MessageRow.operation
|
||||
|
||||
This read-only attribute returns the operation that took place on the row
|
||||
that was changed.
|
||||
|
||||
|
||||
.. attribute:: MessageRow.rowid
|
||||
|
||||
This read-only attribute returns the rowid of the row that was changed.
|
||||
|
||||
|
||||
@ -1,121 +1,121 @@
|
||||
"""Module for testing interval variables."""
|
||||
|
||||
import datetime
|
||||
|
||||
class TestIntervalVar(BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
BaseTestCase.setUp(self)
|
||||
self.rawData = []
|
||||
self.dataByKey = {}
|
||||
for i in range(1, 11):
|
||||
delta = datetime.timedelta(days = i, hours = i, minutes = i * 2,
|
||||
seconds = i * 3)
|
||||
if i % 2 == 0:
|
||||
nullableDelta = None
|
||||
else:
|
||||
nullableDelta = datetime.timedelta(days = i + 5, hours = i + 2,
|
||||
minutes = i * 2 + 5, seconds = i * 3 + 5)
|
||||
tuple = (i, delta, nullableDelta)
|
||||
self.rawData.append(tuple)
|
||||
self.dataByKey[i] = tuple
|
||||
|
||||
def testBindInterval(self):
|
||||
"test binding in an interval"
|
||||
self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute("""
|
||||
select * from TestIntervals
|
||||
where IntervalCol = :value""",
|
||||
value = datetime.timedelta(days = 5, hours = 5, minutes = 10,
|
||||
seconds = 15))
|
||||
self.failUnlessEqual(self.cursor.fetchall(), [self.dataByKey[5]])
|
||||
|
||||
def testBindNull(self):
|
||||
"test binding in a null"
|
||||
self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute("""
|
||||
select * from TestIntervals
|
||||
where IntervalCol = :value""",
|
||||
value = None)
|
||||
self.failUnlessEqual(self.cursor.fetchall(), [])
|
||||
|
||||
def testBindOutSetInputSizes(self):
|
||||
"test binding out with set input sizes defined"
|
||||
vars = self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute("""
|
||||
begin
|
||||
:value := to_dsinterval('8 09:24:18.123789');
|
||||
end;""")
|
||||
self.failUnlessEqual(vars["value"].getvalue(),
|
||||
datetime.timedelta(days = 8, hours = 9, minutes = 24,
|
||||
seconds = 18, microseconds = 123789))
|
||||
|
||||
def testBindInOutSetInputSizes(self):
|
||||
"test binding in/out with set input sizes defined"
|
||||
vars = self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute("""
|
||||
begin
|
||||
:value := :value + to_dsinterval('5 08:30:00');
|
||||
end;""",
|
||||
value = datetime.timedelta(days = 5, hours = 2, minutes = 15))
|
||||
self.failUnlessEqual(vars["value"].getvalue(),
|
||||
datetime.timedelta(days = 10, hours = 10, minutes = 45))
|
||||
|
||||
def testBindOutVar(self):
|
||||
"test binding out with cursor.var() method"
|
||||
var = self.cursor.var(cx_Oracle.INTERVAL)
|
||||
self.cursor.execute("""
|
||||
begin
|
||||
:value := to_dsinterval('15 18:35:45.586');
|
||||
end;""",
|
||||
value = var)
|
||||
self.failUnlessEqual(var.getvalue(),
|
||||
datetime.timedelta(days = 15, hours = 18, minutes = 35,
|
||||
seconds = 45, milliseconds = 586))
|
||||
|
||||
def testBindInOutVarDirectSet(self):
|
||||
"test binding in/out with cursor.var() method"
|
||||
var = self.cursor.var(cx_Oracle.INTERVAL)
|
||||
var.setvalue(0, datetime.timedelta(days = 1, minutes = 50))
|
||||
self.cursor.execute("""
|
||||
begin
|
||||
:value := :value + to_dsinterval('8 05:15:00');
|
||||
end;""",
|
||||
value = var)
|
||||
self.failUnlessEqual(var.getvalue(),
|
||||
datetime.timedelta(days = 9, hours = 6, minutes = 5))
|
||||
|
||||
def testCursorDescription(self):
|
||||
"test cursor description is accurate"
|
||||
self.cursor.execute("select * from TestIntervals")
|
||||
self.failUnlessEqual(self.cursor.description,
|
||||
[ ('INTCOL', cx_Oracle.NUMBER, 10, 22, 9, 0, 0),
|
||||
('INTERVALCOL', cx_Oracle.INTERVAL, -1, 11, 0, 0, 0),
|
||||
('NULLABLECOL', cx_Oracle.INTERVAL, -1, 11, 0, 0, 1) ])
|
||||
|
||||
def testFetchAll(self):
|
||||
"test that fetching all of the data returns the correct results"
|
||||
self.cursor.execute("select * From TestIntervals order by IntCol")
|
||||
self.failUnlessEqual(self.cursor.fetchall(), self.rawData)
|
||||
self.failUnlessEqual(self.cursor.fetchall(), [])
|
||||
|
||||
def testFetchMany(self):
|
||||
"test that fetching data in chunks returns the correct results"
|
||||
self.cursor.execute("select * From TestIntervals order by IntCol")
|
||||
self.failUnlessEqual(self.cursor.fetchmany(3), self.rawData[0:3])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(2), self.rawData[3:5])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(4), self.rawData[5:9])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(3), self.rawData[9:])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(3), [])
|
||||
|
||||
def testFetchOne(self):
|
||||
"test that fetching a single row returns the correct results"
|
||||
self.cursor.execute("""
|
||||
select *
|
||||
from TestIntervals
|
||||
where IntCol in (3, 4)
|
||||
order by IntCol""")
|
||||
self.failUnlessEqual(self.cursor.fetchone(), self.dataByKey[3])
|
||||
self.failUnlessEqual(self.cursor.fetchone(), self.dataByKey[4])
|
||||
self.failUnlessEqual(self.cursor.fetchone(), None)
|
||||
|
||||
"""Module for testing interval variables."""
|
||||
|
||||
import datetime
|
||||
|
||||
class TestIntervalVar(BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
BaseTestCase.setUp(self)
|
||||
self.rawData = []
|
||||
self.dataByKey = {}
|
||||
for i in range(1, 11):
|
||||
delta = datetime.timedelta(days = i, hours = i, minutes = i * 2,
|
||||
seconds = i * 3)
|
||||
if i % 2 == 0:
|
||||
nullableDelta = None
|
||||
else:
|
||||
nullableDelta = datetime.timedelta(days = i + 5, hours = i + 2,
|
||||
minutes = i * 2 + 5, seconds = i * 3 + 5)
|
||||
tuple = (i, delta, nullableDelta)
|
||||
self.rawData.append(tuple)
|
||||
self.dataByKey[i] = tuple
|
||||
|
||||
def testBindInterval(self):
|
||||
"test binding in an interval"
|
||||
self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute("""
|
||||
select * from TestIntervals
|
||||
where IntervalCol = :value""",
|
||||
value = datetime.timedelta(days = 5, hours = 5, minutes = 10,
|
||||
seconds = 15))
|
||||
self.failUnlessEqual(self.cursor.fetchall(), [self.dataByKey[5]])
|
||||
|
||||
def testBindNull(self):
|
||||
"test binding in a null"
|
||||
self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute("""
|
||||
select * from TestIntervals
|
||||
where IntervalCol = :value""",
|
||||
value = None)
|
||||
self.failUnlessEqual(self.cursor.fetchall(), [])
|
||||
|
||||
def testBindOutSetInputSizes(self):
|
||||
"test binding out with set input sizes defined"
|
||||
vars = self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute("""
|
||||
begin
|
||||
:value := to_dsinterval('8 09:24:18.123789');
|
||||
end;""")
|
||||
self.failUnlessEqual(vars["value"].getvalue(),
|
||||
datetime.timedelta(days = 8, hours = 9, minutes = 24,
|
||||
seconds = 18, microseconds = 123789))
|
||||
|
||||
def testBindInOutSetInputSizes(self):
|
||||
"test binding in/out with set input sizes defined"
|
||||
vars = self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute("""
|
||||
begin
|
||||
:value := :value + to_dsinterval('5 08:30:00');
|
||||
end;""",
|
||||
value = datetime.timedelta(days = 5, hours = 2, minutes = 15))
|
||||
self.failUnlessEqual(vars["value"].getvalue(),
|
||||
datetime.timedelta(days = 10, hours = 10, minutes = 45))
|
||||
|
||||
def testBindOutVar(self):
|
||||
"test binding out with cursor.var() method"
|
||||
var = self.cursor.var(cx_Oracle.INTERVAL)
|
||||
self.cursor.execute("""
|
||||
begin
|
||||
:value := to_dsinterval('15 18:35:45.586');
|
||||
end;""",
|
||||
value = var)
|
||||
self.failUnlessEqual(var.getvalue(),
|
||||
datetime.timedelta(days = 15, hours = 18, minutes = 35,
|
||||
seconds = 45, milliseconds = 586))
|
||||
|
||||
def testBindInOutVarDirectSet(self):
|
||||
"test binding in/out with cursor.var() method"
|
||||
var = self.cursor.var(cx_Oracle.INTERVAL)
|
||||
var.setvalue(0, datetime.timedelta(days = 1, minutes = 50))
|
||||
self.cursor.execute("""
|
||||
begin
|
||||
:value := :value + to_dsinterval('8 05:15:00');
|
||||
end;""",
|
||||
value = var)
|
||||
self.failUnlessEqual(var.getvalue(),
|
||||
datetime.timedelta(days = 9, hours = 6, minutes = 5))
|
||||
|
||||
def testCursorDescription(self):
|
||||
"test cursor description is accurate"
|
||||
self.cursor.execute("select * from TestIntervals")
|
||||
self.failUnlessEqual(self.cursor.description,
|
||||
[ ('INTCOL', cx_Oracle.NUMBER, 10, 22, 9, 0, 0),
|
||||
('INTERVALCOL', cx_Oracle.INTERVAL, -1, 11, 0, 0, 0),
|
||||
('NULLABLECOL', cx_Oracle.INTERVAL, -1, 11, 0, 0, 1) ])
|
||||
|
||||
def testFetchAll(self):
|
||||
"test that fetching all of the data returns the correct results"
|
||||
self.cursor.execute("select * From TestIntervals order by IntCol")
|
||||
self.failUnlessEqual(self.cursor.fetchall(), self.rawData)
|
||||
self.failUnlessEqual(self.cursor.fetchall(), [])
|
||||
|
||||
def testFetchMany(self):
|
||||
"test that fetching data in chunks returns the correct results"
|
||||
self.cursor.execute("select * From TestIntervals order by IntCol")
|
||||
self.failUnlessEqual(self.cursor.fetchmany(3), self.rawData[0:3])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(2), self.rawData[3:5])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(4), self.rawData[5:9])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(3), self.rawData[9:])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(3), [])
|
||||
|
||||
def testFetchOne(self):
|
||||
"test that fetching a single row returns the correct results"
|
||||
self.cursor.execute("""
|
||||
select *
|
||||
from TestIntervals
|
||||
where IntCol in (3, 4)
|
||||
order by IntCol""")
|
||||
self.failUnlessEqual(self.cursor.fetchone(), self.dataByKey[3])
|
||||
self.failUnlessEqual(self.cursor.fetchone(), self.dataByKey[4])
|
||||
self.failUnlessEqual(self.cursor.fetchone(), None)
|
||||
|
||||
|
||||
@ -1,121 +1,121 @@
|
||||
"""Module for testing interval variables."""
|
||||
|
||||
import datetime
|
||||
|
||||
class TestIntervalVar(BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
BaseTestCase.setUp(self)
|
||||
self.rawData = []
|
||||
self.dataByKey = {}
|
||||
for i in range(1, 11):
|
||||
delta = datetime.timedelta(days = i, hours = i, minutes = i * 2,
|
||||
seconds = i * 3)
|
||||
if i % 2 == 0:
|
||||
nullableDelta = None
|
||||
else:
|
||||
nullableDelta = datetime.timedelta(days = i + 5, hours = i + 2,
|
||||
minutes = i * 2 + 5, seconds = i * 3 + 5)
|
||||
tuple = (i, delta, nullableDelta)
|
||||
self.rawData.append(tuple)
|
||||
self.dataByKey[i] = tuple
|
||||
|
||||
def testBindInterval(self):
|
||||
"test binding in an interval"
|
||||
self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute(u"""
|
||||
select * from TestIntervals
|
||||
where IntervalCol = :value""",
|
||||
value = datetime.timedelta(days = 5, hours = 5, minutes = 10,
|
||||
seconds = 15))
|
||||
self.failUnlessEqual(self.cursor.fetchall(), [self.dataByKey[5]])
|
||||
|
||||
def testBindNull(self):
|
||||
"test binding in a null"
|
||||
self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute(u"""
|
||||
select * from TestIntervals
|
||||
where IntervalCol = :value""",
|
||||
value = None)
|
||||
self.failUnlessEqual(self.cursor.fetchall(), [])
|
||||
|
||||
def testBindOutSetInputSizes(self):
|
||||
"test binding out with set input sizes defined"
|
||||
vars = self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute(u"""
|
||||
begin
|
||||
:value := to_dsinterval('8 09:24:18.123789');
|
||||
end;""")
|
||||
self.failUnlessEqual(vars["value"].getvalue(),
|
||||
datetime.timedelta(days = 8, hours = 9, minutes = 24,
|
||||
seconds = 18, microseconds = 123789))
|
||||
|
||||
def testBindInOutSetInputSizes(self):
|
||||
"test binding in/out with set input sizes defined"
|
||||
vars = self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute(u"""
|
||||
begin
|
||||
:value := :value + to_dsinterval('5 08:30:00');
|
||||
end;""",
|
||||
value = datetime.timedelta(days = 5, hours = 2, minutes = 15))
|
||||
self.failUnlessEqual(vars["value"].getvalue(),
|
||||
datetime.timedelta(days = 10, hours = 10, minutes = 45))
|
||||
|
||||
def testBindOutVar(self):
|
||||
"test binding out with cursor.var() method"
|
||||
var = self.cursor.var(cx_Oracle.INTERVAL)
|
||||
self.cursor.execute(u"""
|
||||
begin
|
||||
:value := to_dsinterval('15 18:35:45.586');
|
||||
end;""",
|
||||
value = var)
|
||||
self.failUnlessEqual(var.getvalue(),
|
||||
datetime.timedelta(days = 15, hours = 18, minutes = 35,
|
||||
seconds = 45, milliseconds = 586))
|
||||
|
||||
def testBindInOutVarDirectSet(self):
|
||||
"test binding in/out with cursor.var() method"
|
||||
var = self.cursor.var(cx_Oracle.INTERVAL)
|
||||
var.setvalue(0, datetime.timedelta(days = 1, minutes = 50))
|
||||
self.cursor.execute(u"""
|
||||
begin
|
||||
:value := :value + to_dsinterval('8 05:15:00');
|
||||
end;""",
|
||||
value = var)
|
||||
self.failUnlessEqual(var.getvalue(),
|
||||
datetime.timedelta(days = 9, hours = 6, minutes = 5))
|
||||
|
||||
def testCursorDescription(self):
|
||||
"test cursor description is accurate"
|
||||
self.cursor.execute(u"select * from TestIntervals")
|
||||
self.failUnlessEqual(self.cursor.description,
|
||||
[ ('INTCOL', cx_Oracle.NUMBER, 10, 22, 9, 0, 0),
|
||||
('INTERVALCOL', cx_Oracle.INTERVAL, -1, 11, 0, 0, 0),
|
||||
('NULLABLECOL', cx_Oracle.INTERVAL, -1, 11, 0, 0, 1) ])
|
||||
|
||||
def testFetchAll(self):
|
||||
"test that fetching all of the data returns the correct results"
|
||||
self.cursor.execute(u"select * From TestIntervals order by IntCol")
|
||||
self.failUnlessEqual(self.cursor.fetchall(), self.rawData)
|
||||
self.failUnlessEqual(self.cursor.fetchall(), [])
|
||||
|
||||
def testFetchMany(self):
|
||||
"test that fetching data in chunks returns the correct results"
|
||||
self.cursor.execute(u"select * From TestIntervals order by IntCol")
|
||||
self.failUnlessEqual(self.cursor.fetchmany(3), self.rawData[0:3])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(2), self.rawData[3:5])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(4), self.rawData[5:9])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(3), self.rawData[9:])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(3), [])
|
||||
|
||||
def testFetchOne(self):
|
||||
"test that fetching a single row returns the correct results"
|
||||
self.cursor.execute(u"""
|
||||
select *
|
||||
from TestIntervals
|
||||
where IntCol in (3, 4)
|
||||
order by IntCol""")
|
||||
self.failUnlessEqual(self.cursor.fetchone(), self.dataByKey[3])
|
||||
self.failUnlessEqual(self.cursor.fetchone(), self.dataByKey[4])
|
||||
self.failUnlessEqual(self.cursor.fetchone(), None)
|
||||
|
||||
"""Module for testing interval variables."""
|
||||
|
||||
import datetime
|
||||
|
||||
class TestIntervalVar(BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
BaseTestCase.setUp(self)
|
||||
self.rawData = []
|
||||
self.dataByKey = {}
|
||||
for i in range(1, 11):
|
||||
delta = datetime.timedelta(days = i, hours = i, minutes = i * 2,
|
||||
seconds = i * 3)
|
||||
if i % 2 == 0:
|
||||
nullableDelta = None
|
||||
else:
|
||||
nullableDelta = datetime.timedelta(days = i + 5, hours = i + 2,
|
||||
minutes = i * 2 + 5, seconds = i * 3 + 5)
|
||||
tuple = (i, delta, nullableDelta)
|
||||
self.rawData.append(tuple)
|
||||
self.dataByKey[i] = tuple
|
||||
|
||||
def testBindInterval(self):
|
||||
"test binding in an interval"
|
||||
self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute(u"""
|
||||
select * from TestIntervals
|
||||
where IntervalCol = :value""",
|
||||
value = datetime.timedelta(days = 5, hours = 5, minutes = 10,
|
||||
seconds = 15))
|
||||
self.failUnlessEqual(self.cursor.fetchall(), [self.dataByKey[5]])
|
||||
|
||||
def testBindNull(self):
|
||||
"test binding in a null"
|
||||
self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute(u"""
|
||||
select * from TestIntervals
|
||||
where IntervalCol = :value""",
|
||||
value = None)
|
||||
self.failUnlessEqual(self.cursor.fetchall(), [])
|
||||
|
||||
def testBindOutSetInputSizes(self):
|
||||
"test binding out with set input sizes defined"
|
||||
vars = self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute(u"""
|
||||
begin
|
||||
:value := to_dsinterval('8 09:24:18.123789');
|
||||
end;""")
|
||||
self.failUnlessEqual(vars["value"].getvalue(),
|
||||
datetime.timedelta(days = 8, hours = 9, minutes = 24,
|
||||
seconds = 18, microseconds = 123789))
|
||||
|
||||
def testBindInOutSetInputSizes(self):
|
||||
"test binding in/out with set input sizes defined"
|
||||
vars = self.cursor.setinputsizes(value = cx_Oracle.INTERVAL)
|
||||
self.cursor.execute(u"""
|
||||
begin
|
||||
:value := :value + to_dsinterval('5 08:30:00');
|
||||
end;""",
|
||||
value = datetime.timedelta(days = 5, hours = 2, minutes = 15))
|
||||
self.failUnlessEqual(vars["value"].getvalue(),
|
||||
datetime.timedelta(days = 10, hours = 10, minutes = 45))
|
||||
|
||||
def testBindOutVar(self):
|
||||
"test binding out with cursor.var() method"
|
||||
var = self.cursor.var(cx_Oracle.INTERVAL)
|
||||
self.cursor.execute(u"""
|
||||
begin
|
||||
:value := to_dsinterval('15 18:35:45.586');
|
||||
end;""",
|
||||
value = var)
|
||||
self.failUnlessEqual(var.getvalue(),
|
||||
datetime.timedelta(days = 15, hours = 18, minutes = 35,
|
||||
seconds = 45, milliseconds = 586))
|
||||
|
||||
def testBindInOutVarDirectSet(self):
|
||||
"test binding in/out with cursor.var() method"
|
||||
var = self.cursor.var(cx_Oracle.INTERVAL)
|
||||
var.setvalue(0, datetime.timedelta(days = 1, minutes = 50))
|
||||
self.cursor.execute(u"""
|
||||
begin
|
||||
:value := :value + to_dsinterval('8 05:15:00');
|
||||
end;""",
|
||||
value = var)
|
||||
self.failUnlessEqual(var.getvalue(),
|
||||
datetime.timedelta(days = 9, hours = 6, minutes = 5))
|
||||
|
||||
def testCursorDescription(self):
|
||||
"test cursor description is accurate"
|
||||
self.cursor.execute(u"select * from TestIntervals")
|
||||
self.failUnlessEqual(self.cursor.description,
|
||||
[ ('INTCOL', cx_Oracle.NUMBER, 10, 22, 9, 0, 0),
|
||||
('INTERVALCOL', cx_Oracle.INTERVAL, -1, 11, 0, 0, 0),
|
||||
('NULLABLECOL', cx_Oracle.INTERVAL, -1, 11, 0, 0, 1) ])
|
||||
|
||||
def testFetchAll(self):
|
||||
"test that fetching all of the data returns the correct results"
|
||||
self.cursor.execute(u"select * From TestIntervals order by IntCol")
|
||||
self.failUnlessEqual(self.cursor.fetchall(), self.rawData)
|
||||
self.failUnlessEqual(self.cursor.fetchall(), [])
|
||||
|
||||
def testFetchMany(self):
|
||||
"test that fetching data in chunks returns the correct results"
|
||||
self.cursor.execute(u"select * From TestIntervals order by IntCol")
|
||||
self.failUnlessEqual(self.cursor.fetchmany(3), self.rawData[0:3])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(2), self.rawData[3:5])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(4), self.rawData[5:9])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(3), self.rawData[9:])
|
||||
self.failUnlessEqual(self.cursor.fetchmany(3), [])
|
||||
|
||||
def testFetchOne(self):
|
||||
"test that fetching a single row returns the correct results"
|
||||
self.cursor.execute(u"""
|
||||
select *
|
||||
from TestIntervals
|
||||
where IntCol in (3, 4)
|
||||
order by IntCol""")
|
||||
self.failUnlessEqual(self.cursor.fetchone(), self.dataByKey[3])
|
||||
self.failUnlessEqual(self.cursor.fetchone(), self.dataByKey[4])
|
||||
self.failUnlessEqual(self.cursor.fetchone(), None)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user