This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SQLObject development repository".
The branch, master has been updated
via 0ff26ed5b30d7834e310d3c8adbf91f17c23323d (commit)
via 2a7d28573d1e4f07250da1d30209304fdb6de90d (commit)
via 38a83488fc97663409afdceb51d0ccecf6f22ebd (commit)
via 4ec83426e3c13505026f411cfcccbf0d82cdb3c5 (commit)
via 2a1839364d1a3b4ba260ede53886526ee8cd4860 (commit)
via f08401c205e30d8c8eb70978f850577cff8598a9 (commit)
via 96a66ecdfa7cdc630de0ad057ce7d3a33e401c2a (commit)
via d86fbb9597160f3495566dd28a5dd291d445525f (commit)
from bc58c615babc7a170989e074a6af956e67fe0f1b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceforge.net/p/sqlobject/sqlobject/ci/0ff26ed5b30d7834e310d3c8adbf91f17c23323d
commit 0ff26ed5b30d7834e310d3c8adbf91f17c23323d
Author: Oleg Broytman <ph...@ph...>
Date: Fri Feb 23 09:56:23 2018 +0300
Docs: Update News
[skip ci]
diff --git a/docs/News.rst b/docs/News.rst
index cb50657..35c78f1 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -14,17 +14,22 @@ Minor features
* Close cursors after using to free resources immediately
instead of waiting for gc.
+Bug fixes
+---------
+
+* Fix for TypeError using selectBy on a BLOBCol. PR by Michael S. Root.
+
Drivers
-------
-* Extend support for oursql and Python 3 (require our fork of the driver).
+* Extend support for oursql and Python 3 (requires our fork of the driver).
* Fix cursor.arraysize - pymssql doesn't have arraysize.
-* Fix _setAutoCommit for MSSQL.
-
* Set timeout for ODBC with MSSQL.
+* Fix _setAutoCommit for MSSQL.
+
Documentation
-------------
http://sourceforge.net/p/sqlobject/sqlobject/ci/2a7d28573d1e4f07250da1d30209304fdb6de90d
commit 2a7d28573d1e4f07250da1d30209304fdb6de90d
Author: Oleg Broytman <ph...@ph...>
Date: Fri Feb 23 09:55:38 2018 +0300
Tests(blob): Use byte string for test
diff --git a/sqlobject/tests/test_blob.py b/sqlobject/tests/test_blob.py
index 9d135d1..2c9b20f 100644
--- a/sqlobject/tests/test_blob.py
+++ b/sqlobject/tests/test_blob.py
@@ -22,8 +22,7 @@ def test_BLOBCol():
else:
data = bytes(range(256))
- prof = ImageData()
- prof.image = data
+ prof = ImageData(image=data)
iid = prof.id
ImageData._connection.cache.clear()
@@ -31,5 +30,5 @@ def test_BLOBCol():
prof2 = ImageData.get(iid)
assert prof2.image == data
- ImageData(image='string')
- assert ImageData.selectBy(image='string').count() == 1
+ ImageData(image=b'string')
+ assert ImageData.selectBy(image=b'string').count() == 1
http://sourceforge.net/p/sqlobject/sqlobject/ci/38a83488fc97663409afdceb51d0ccecf6f22ebd
commit 38a83488fc97663409afdceb51d0ccecf6f22ebd
Author: Oleg Broytman <ph...@ph...>
Date: Sun Feb 18 00:22:41 2018 +0300
Feat(mssql): Set timeout for ODBC with MSSQL
diff --git a/docs/News.rst b/docs/News.rst
index 4756455..cb50657 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -19,9 +19,11 @@ Drivers
* Extend support for oursql and Python 3 (require our fork of the driver).
+* Fix cursor.arraysize - pymssql doesn't have arraysize.
+
* Fix _setAutoCommit for MSSQL.
-* Fix cursor.arraysize - pymssql doesn't have arraysize.
+* Set timeout for ODBC with MSSQL.
Documentation
-------------
diff --git a/sqlobject/mssql/mssqlconnection.py b/sqlobject/mssql/mssqlconnection.py
index 9079d31..b135fe4 100644
--- a/sqlobject/mssql/mssqlconnection.py
+++ b/sqlobject/mssql/mssqlconnection.py
@@ -51,6 +51,11 @@ class MSSQLConnection(DBAPI):
raise ImportError(
'Cannot find an MSSQL driver, tried %s' % drivers)
+ timeout = kw.pop('timeout', None)
+ if timeout:
+ timeout = int(timeout)
+ self.timeout = timeout
+
if driver in ('odbc', 'pyodbc', 'pypyodbc'):
self.make_odbc_conn_str(kw.pop('odbcdrv', 'SQL Server'),
db, host, port, user, password
@@ -91,11 +96,6 @@ class MSSQLConnection(DBAPI):
# don't know whether pymssql uses unicode
self.usingUnicodeStrings = False
- timeout = kw.pop('timeout', None)
- if timeout:
- timeout = int(timeout)
- self.timeout = timeout
-
def _make_conn_str(keys):
keys_dict = {}
for attr, value in (
@@ -145,7 +145,14 @@ class MSSQLConnection(DBAPI):
if self.driver in ('odbc', 'pyodbc', 'pypyodbc'):
self.debugWriter.write(
"ODBC connect string: " + self.odbc_conn_str)
- conn = self.module.connect(self.odbc_conn_str)
+ timeout = self.timeout
+ if timeout:
+ kw = dict(timeout=timeout)
+ else:
+ kw = dict()
+ conn = self.module.connect(self.odbc_conn_str, **kw)
+ if timeout:
+ conn.timeout = timeout
else:
conn_descr = self.make_conn_str(self)
if isinstance(conn_descr, dict):
diff --git a/tox.ini b/tox.ini
index 54498f6..c902edb 100644
--- a/tox.ini
+++ b/tox.ini
@@ -17,7 +17,6 @@ commands =
deps =
-rdevscripts/requirements/requirements_tests.txt
py27: egenix-mx-base
- mssql-pyodbc: pytest-timeout
mysqldb: mysql-python
mysqlclient: mysqlclient
mysql-connector: mysql-connector <= 2.2.2
@@ -396,7 +395,7 @@ commands =
{envpython} -c "import pyodbc; print(pyodbc.drivers())"
-sqlcmd -U sa -P "Password12!" -S .\SQL2014 -Q "DROP DATABASE sqlobject_test"
sqlcmd -U sa -P "Password12!" -S .\SQL2014 -Q "CREATE DATABASE sqlobject_test"
- pytest --cov=sqlobject -D "mssql://sa:Password12!@localhost\SQL2014/sqlobject_test?driver=pyodbc&odbcdrv=SQL%20Server&debug=1" --timeout=30
+ pytest --cov=sqlobject -D "mssql://sa:Password12!@localhost\SQL2014/sqlobject_test?driver=pyodbc&odbcdrv=SQL%20Server&timeout=30&debug=1"
sqlcmd -U sa -P "Password12!" -S .\SQL2014 -Q "DROP DATABASE sqlobject_test"
[testenv:py27-mssql-pyodbc-w32]
http://sourceforge.net/p/sqlobject/sqlobject/ci/4ec83426e3c13505026f411cfcccbf0d82cdb3c5
commit 4ec83426e3c13505026f411cfcccbf0d82cdb3c5
Author: Michael S. Root <mi...@ti...>
Date: Thu Feb 22 17:39:35 2018 -0800
Added test for 2a1839364d1a3b4ba260ede53886526ee8cd4860
diff --git a/sqlobject/tests/test_blob.py b/sqlobject/tests/test_blob.py
index 8c43d8a..9d135d1 100644
--- a/sqlobject/tests/test_blob.py
+++ b/sqlobject/tests/test_blob.py
@@ -30,3 +30,6 @@ def test_BLOBCol():
prof2 = ImageData.get(iid)
assert prof2.image == data
+
+ ImageData(image='string')
+ assert ImageData.selectBy(image='string').count() == 1
http://sourceforge.net/p/sqlobject/sqlobject/ci/2a1839364d1a3b4ba260ede53886526ee8cd4860
commit 2a1839364d1a3b4ba260ede53886526ee8cd4860
Author: Michael S. Root <mi...@ti...>
Date: Thu Feb 22 16:38:31 2018 -0800
Bugfix for TypeError using selectBy on a BLOBCol
diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py
index 3bde3cc..2dfa45e 100644
--- a/sqlobject/dbconnection.py
+++ b/sqlobject/dbconnection.py
@@ -666,7 +666,6 @@ class DBAPI(DBConnection):
def _SO_columnClause(self, soClass, kw):
from . import main
- ops = {None: "IS"}
data = []
if 'id' in kw:
data.append((soClass.sqlmeta.idName, kw.pop('id')))
@@ -694,7 +693,7 @@ class DBAPI(DBConnection):
return None
return ' AND '.join(
['%s %s %s' %
- (dbName, ops.get(value, "="), self.sqlrepr(value))
+ (dbName, "IS" if value is None else "=", self.sqlrepr(value))
for dbName, value
in data])
http://sourceforge.net/p/sqlobject/sqlobject/ci/f08401c205e30d8c8eb70978f850577cff8598a9
commit f08401c205e30d8c8eb70978f850577cff8598a9
Author: Oleg Broytman <ph...@ph...>
Date: Sun Feb 11 22:46:15 2018 +0300
Fix cursor.arraysize - pymssql doesn't have arraysize
diff --git a/docs/News.rst b/docs/News.rst
index 82517ad..4756455 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -21,6 +21,8 @@ Drivers
* Fix _setAutoCommit for MSSQL.
+* Fix cursor.arraysize - pymssql doesn't have arraysize.
+
Documentation
-------------
diff --git a/sqlobject/inheritance/iteration.py b/sqlobject/inheritance/iteration.py
index fd7b78f..558700e 100644
--- a/sqlobject/inheritance/iteration.py
+++ b/sqlobject/inheritance/iteration.py
@@ -11,7 +11,11 @@ class InheritableIteration(Iteration):
super(InheritableIteration, self).__init__(dbconn, rawconn, select,
keepConnection)
self.lazyColumns = select.ops.get('lazyColumns', False)
- self.cursor.arraysize = self.defaultArraySize
+ try:
+ self.cursor.arraysize = self.defaultArraySize
+ self.use_arraysize = True
+ except AttributeError: # pymssql doesn't have arraysize
+ self.use_arraysize = False
self._results = []
# Find the index of the childName column
childNameIdx = None
@@ -24,7 +28,11 @@ class InheritableIteration(Iteration):
def next(self):
if not self._results:
- self._results = list(self.cursor.fetchmany())
+ if self.use_arraysize:
+ _results = self.cursor.fetchmany()
+ else:
+ _results = self.cursor.fetchmany(size=self.defaultArraySize)
+ self._results = list(_results)
if not self.lazyColumns:
self.fetchChildren()
if not self._results:
http://sourceforge.net/p/sqlobject/sqlobject/ci/96a66ecdfa7cdc630de0ad057ce7d3a33e401c2a
commit 96a66ecdfa7cdc630de0ad057ce7d3a33e401c2a
Author: Oleg Broytman <ph...@ph...>
Date: Sun Feb 11 21:58:02 2018 +0300
Fix(mssqlconnection): Fix _setAutoCommit
diff --git a/docs/News.rst b/docs/News.rst
index 1bb32ce..82517ad 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -19,6 +19,8 @@ Drivers
* Extend support for oursql and Python 3 (require our fork of the driver).
+* Fix _setAutoCommit for MSSQL.
+
Documentation
-------------
diff --git a/sqlobject/mssql/mssqlconnection.py b/sqlobject/mssql/mssqlconnection.py
index 0a53670..9079d31 100644
--- a/sqlobject/mssql/mssqlconnection.py
+++ b/sqlobject/mssql/mssqlconnection.py
@@ -159,6 +159,20 @@ class MSSQLConnection(DBAPI):
cur.close()
return conn
+ def _setAutoCommit(self, conn, auto):
+ auto = bool(auto)
+ if self.driver in ('adodb', 'adodbapi'):
+ if auto:
+ option = "ON"
+ else:
+ option = "OFF"
+ c = conn.cursor()
+ c.execute("SET AUTOCOMMIT " + option)
+ elif self.driver == 'pymssql':
+ conn.autocommit(auto)
+ elif self.driver in ('odbc', 'pyodbc', 'pypyodbc'):
+ conn.autocommit = auto
+
HAS_IDENTITY = """
select 1
from INFORMATION_SCHEMA.COLUMNS
@@ -324,17 +338,6 @@ class MSSQLConnection(DBAPI):
results.append(colClass(**kw))
return results
- def _setAutoCommit(self, conn, auto):
- # raise Exception(repr(auto))
- return
- # conn.auto_commit = auto
- option = "ON"
- if auto == 0:
- option = "OFF"
- c = conn.cursor()
- c.execute("SET AUTOCOMMIT " + option)
- c.close()
-
# precision and scale is needed for decimal columns
def guessClass(self, t, size, precision, scale):
"""
http://sourceforge.net/p/sqlobject/sqlobject/ci/d86fbb9597160f3495566dd28a5dd291d445525f
commit d86fbb9597160f3495566dd28a5dd291d445525f
Author: Oleg Broytman <ph...@ph...>
Date: Sat Feb 17 01:48:58 2018 +0300
Feat: Close cursors after using
Free resources immediately instead of waiting for gc.
diff --git a/docs/News.rst b/docs/News.rst
index 9ce26cf..1bb32ce 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -8,6 +8,12 @@ News
SQLObject 3.6.0 (master)
========================
+Minor features
+--------------
+
+* Close cursors after using to free resources immediately
+ instead of waiting for gc.
+
Drivers
-------
diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py
index 41e9b6a..3bde3cc 100644
--- a/sqlobject/dbconnection.py
+++ b/sqlobject/dbconnection.py
@@ -427,7 +427,9 @@ class DBAPI(DBConnection):
def _query(self, conn, s):
if self.debug:
self.printDebug(conn, s, 'Query')
- self._executeRetry(conn, conn.cursor(), s)
+ c = conn.cursor()
+ self._executeRetry(conn, c, s)
+ c.close()
def query(self, s):
return self._runWithConnection(self._query, s)
@@ -438,6 +440,7 @@ class DBAPI(DBConnection):
c = conn.cursor()
self._executeRetry(conn, c, s)
value = c.fetchall()
+ c.close()
if self.debugOutput:
self.printDebug(conn, value, 'QueryAll', 'result')
return value
@@ -455,6 +458,7 @@ class DBAPI(DBConnection):
c = conn.cursor()
self._executeRetry(conn, c, s)
value = c.fetchall()
+ c.close()
if self.debugOutput:
self.printDebug(conn, value, 'QueryAll', 'result')
return c.description, value
@@ -468,6 +472,7 @@ class DBAPI(DBConnection):
c = conn.cursor()
self._executeRetry(conn, c, s)
value = c.fetchone()
+ c.close()
if self.debugOutput:
self.printDebug(conn, value, 'QueryOne', 'result')
return value
@@ -778,10 +783,11 @@ class Iteration(object):
if getattr(self, 'query', None) is None:
# already cleaned up
return
- self.query = None
+ self.cursor.close()
if not self.keepConnection:
self.dbconn.releaseConnection(self.rawconn)
- self.dbconn = self.rawconn = self.select = self.cursor = None
+ self.query = self.dbconn = self.rawconn = \
+ self.select = self.cursor = None
def __del__(self):
self._cleanup()
diff --git a/sqlobject/firebird/firebirdconnection.py b/sqlobject/firebird/firebirdconnection.py
index 3bf3fb5..4624b48 100644
--- a/sqlobject/firebird/firebirdconnection.py
+++ b/sqlobject/firebird/firebirdconnection.py
@@ -135,6 +135,7 @@ class FirebirdConnection(DBAPI):
if self.debug:
self.printDebug(conn, q, 'QueryIns')
c.execute(q)
+ c.close()
if self.debugOutput:
self.printDebug(conn, id, 'QueryIns', 'result')
return id
diff --git a/sqlobject/maxdb/maxdbconnection.py b/sqlobject/maxdb/maxdbconnection.py
index c46c3ea..4fd53b1 100644
--- a/sqlobject/maxdb/maxdbconnection.py
+++ b/sqlobject/maxdb/maxdbconnection.py
@@ -138,6 +138,7 @@ class MaxdbConnection(DBAPI):
if self.debug:
self.printDebug(conn, q, 'QueryIns')
c.execute(q)
+ c.close()
if self.debugOutput:
self.printDebug(conn, id, 'QueryIns', 'result')
return id
diff --git a/sqlobject/mssql/mssqlconnection.py b/sqlobject/mssql/mssqlconnection.py
index 0201031..0a53670 100644
--- a/sqlobject/mssql/mssqlconnection.py
+++ b/sqlobject/mssql/mssqlconnection.py
@@ -137,7 +137,9 @@ class MSSQLConnection(DBAPI):
# converting the identity to an int is ugly, but it gets returned
# as a decimal otherwise :S
c.execute('SELECT CONVERT(INT, @@IDENTITY)')
- return c.fetchone()[0]
+ result = c.fetchone()[0]
+ c.close()
+ return result
def makeConnection(self):
if self.driver in ('odbc', 'pyodbc', 'pypyodbc'):
@@ -169,6 +171,7 @@ class MSSQLConnection(DBAPI):
c = conn.cursor()
c.execute(query)
r = c.fetchone()
+ c.close()
return r is not None
def _queryInsertID(self, conn, soInstance, id, names, values):
@@ -206,6 +209,7 @@ class MSSQLConnection(DBAPI):
c.execute(q)
if has_identity:
c.execute('SET IDENTITY_INSERT %s OFF' % table)
+ c.close()
if id is None:
id = self.insert_id(conn)
@@ -329,6 +333,7 @@ class MSSQLConnection(DBAPI):
option = "OFF"
c = conn.cursor()
c.execute("SET AUTOCOMMIT " + option)
+ c.close()
# precision and scale is needed for decimal columns
def guessClass(self, t, size, precision, scale):
diff --git a/sqlobject/mysql/mysqlconnection.py b/sqlobject/mysql/mysqlconnection.py
index 96517dd..51cbde4 100644
--- a/sqlobject/mysql/mysqlconnection.py
+++ b/sqlobject/mysql/mysqlconnection.py
@@ -300,6 +300,7 @@ class MySQLConnection(DBAPI):
id = c.fetchone()[0]
else:
id = c.insert_id()
+ c.close()
if self.debugOutput:
self.printDebug(conn, id, 'QueryIns', 'result')
return id
... 80 lines suppressed ...
hooks/post-receive
--
SQLObject development repository
|