Changeset 883 for trunk


Ignore:
Timestamp:
Aug 10, 2016, 9:57:50 AM (3 years ago)
Author:
cito
Message:

Fix issue with adaptation of empty arrays in pg

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/contents/changelog.rst

    r882 r883  
    1616- Allow extra values that are not used in the command in the parameter dict
    1717  passed to the query_formatted() method (as suggested by Justin Pryzby).
     18- Improved handling of empty arrays in the classic module.
    1819- Unused classic connections were not properly garbage collected which could
    1920  cause memory leaks (reported by Justin Pryzby).
  • trunk/pg.py

    r880 r883  
    518518            return 'date'
    519519        if isinstance(value, list):
    520             return '%s[]' % cls.guess_simple_base_type(value)
     520            return '%s[]' % (cls.guess_simple_base_type(value) or 'text',)
    521521        if isinstance(value, tuple):
    522522            simple_type = cls.simple_type
  • trunk/tests/test_classic_dbwrapper.py

    r881 r883  
    929929        r = q.getresult()[0][0]
    930930        self.assertEqual(r, 'alphabetagammadeltaepsilon')
     931
     932    def testQueryFormattedWithAny(self):
     933        f = self.db.query_formatted
     934        q = "select 2 = any(%s)"
     935        r = f(q, [[1, 3]]).getresult()[0][0]
     936        self.assertEqual(r, False if pg.get_bool() else 'f')
     937        r = f(q, [[1, 2, 3]]).getresult()[0][0]
     938        self.assertEqual(r, True if pg.get_bool() else 't')
     939        r = f(q, [[]]).getresult()[0][0]
     940        self.assertEqual(r, False if pg.get_bool() else 'f')
     941        r = f(q, [[None]]).getresult()[0][0]
     942        self.assertIsNone(r)
    931943
    932944    def testPkey(self):
Note: See TracChangeset for help on using the changeset viewer.