Test and documentation enhancements.

master
baztian 2011-01-27 15:37:42 +01:00
parent 2695c9fe42
commit 1197f43558
4 changed files with 39 additions and 10 deletions

View File

@ -85,8 +85,9 @@ in memory database on my Ubuntu machine I'm starting Python by running ::
Now I have to configure JPype Now I have to configure JPype
>>> import jpype >>> import jpype
>>> jar = '/path/to/my/driver/hsqldb.jar' >>> jar = r'/path/to/my/driver/hsqldb.jar'
>>> args='-Djava.class.path=%s' % jar >>> args='-Djava.class.path=%s' % jar
>>> jvm_path = jpype.getDefaultJVMPath()
>>> jpype.startJVM(jvm_path, args) >>> jpype.startJVM(jvm_path, args)
or in Jython I have to or in Jython I have to
@ -101,12 +102,35 @@ Supported databases
In theory every database with a suitable JDBC driver should work. It In theory every database with a suitable JDBC driver should work. It
is known to work with the following databases: is known to work with the following databases:
* `SQLite 3 <http://www.sqlite.org/>`_ using `SqliteJDBC +-----------------------------------------+------------------------------------------------+---------------+----------------------+
<http://www.zentus.com/sqlitejdbc/>`_ v056 |Database |JDBC driver |Supported |Remarks |
* `Hypersonic SQL (HSQLDB) <http://hsqldb.org/>`_ 1.8.1.3 +=========================================+================================================+===============+======================+
* `IBM DB2 <http://www.ibm.com/software/data/db2/>`_ for z/OS using |`SQLite |`SqliteJDBC |Good |Can't interpret |
JDBC type 4 drivers. |<http://www.sqlite.org/>`_ |<http://www.zentus.com/sqlitejdbc/>`_ v056 | |selected BLOBs |
|3 | | |correctly. |
+-----------------------------------------+------------------------------------------------+---------------+----------------------+
| |`Sqlite Java Wrapper |Medium |Weird type handling. |
| |<http://www.ch-werner.de/javasqlite/>`_ | | |
| |javasqlite-20110106-win32 | | |
+-----------------------------------------+------------------------------------------------+---------------+----------------------+
|`Hypersonic SQL (HSQLDB) |Builtin |Very Good |No BLOB support |
|<http://hsqldb.org/>`_ 1.8.1.3 | | |by database. |
| | | | |
+-----------------------------------------+------------------------------------------------+---------------+----------------------+
|`Hypersonic SQL (HSQLDB) |Builtin |Medium |Weird decimal |
|<http://hsqldb.org/>`_ 2 | | |type |
| | | |conversions. No |
| | | |BLOB support. |
+-----------------------------------------+------------------------------------------------+---------------+----------------------+
|`IBM DB2 |JDBC type 4 drivers from IBM (``db2jcc.jar``) |Medium. |Not thoroughly tested |
|<http://www.ibm.com/software/data/db2/>`_| | |but seems to work |
|for z/OS | | |without problems. |
+-----------------------------------------+------------------------------------------------+---------------+----------------------+
|Oracle 11g |Oracle Thin Driver |Medium |Not thooughly |
| | | |testst. No support for|
| | | |rading of timestamps |
| | | |yet. |
+-----------------------------------------+------------------------------------------------+---------------+----------------------+
Contributing Contributing
============ ============

View File

@ -291,6 +291,8 @@ class Cursor(object):
for col in range(1, self._meta.getColumnCount() + 1): for col in range(1, self._meta.getColumnCount() + 1):
sqltype = self._meta.getColumnType(col) sqltype = self._meta.getColumnType(col)
# print sqltype # print sqltype
# TODO: Oracle 11 will read a oracle.sql.TIMESTAMP
# which can't be converted to string easyly
v = self._rs.getObject(col) v = self._rs.getObject(col)
if v: if v:
converter = _converters.get(sqltype) converter = _converters.get(sqltype)

View File

@ -6,7 +6,7 @@ create table Account (
"DBL_COL" DOUBLE, "DBL_COL" DOUBLE,
"OPENED_AT" DATE, "OPENED_AT" DATE,
"VALID" BOOLEAN, "VALID" BOOLEAN,
"PRODUCT_NAME" VARCHAR, "PRODUCT_NAME" VARCHAR(50),
"STUFF" BLOB, "STUFF" BLOB,
primary key ("ACCOUNT_ID") primary key ("ACCOUNT_ID")
); );

View File

@ -91,12 +91,15 @@ class IntegrationTest(TestCase):
# 'jdbc:hsqldb:mem', 'SA', '') # 'jdbc:hsqldb:mem', 'SA', '')
# conn = jaydebeapi.connect('com.ibm.db2.jcc.DB2Driver', # conn = jaydebeapi.connect('com.ibm.db2.jcc.DB2Driver',
# 'jdbc:db2://4.100.73.81:50000/db2t', # 'jdbc:db2://4.100.73.81:50000/db2t',
# getpass.getuser(), # user, passwd)
# getpass.getpass())
# driver from http://www.ch-werner.de/javasqlite/ seems to be # driver from http://www.ch-werner.de/javasqlite/ seems to be
# crap as it returns decimal values as VARCHAR type # crap as it returns decimal values as VARCHAR type
# conn = jaydebeapi.connect('SQLite.JDBCDriver', # conn = jaydebeapi.connect('SQLite.JDBCDriver',
# 'jdbc:sqlite:/:memory:') # 'jdbc:sqlite:/:memory:')
# Oracle Thin Driver
# conn = jaydebeapi.connect('oracle.jdbc.OracleDriver',
# 'jdbc:oracle:thin:@//hh-cluster-scan:1521/HH_TPP',
# user, passwd)
return jaydebeapi, conn return jaydebeapi, conn
def setUp(self): def setUp(self):