зеркало из https://github.com/mozilla/PyHive.git
Родитель
5b846ed921
Коммит
276e272821
|
@ -238,7 +238,9 @@ class ParamEscaper(object):
|
|||
return "'{}'".format(item.replace("'", "''"))
|
||||
|
||||
def escape_item(self, item):
|
||||
if isinstance(item, (int, float)):
|
||||
if item is None:
|
||||
return 'NULL'
|
||||
elif isinstance(item, (int, float)):
|
||||
return self.escape_number(item)
|
||||
elif isinstance(item, basestring):
|
||||
return self.escape_string(item)
|
||||
|
|
|
@ -45,6 +45,11 @@ class DBAPITestCase(with_metaclass(abc.ABCMeta, object)):
|
|||
cursor.execute('SELECT a FROM many_rows ORDER BY a')
|
||||
self.assertEqual(cursor.fetchall(), [(i,) for i in range(10000)])
|
||||
|
||||
@with_cursor
|
||||
def test_null_param(self, cursor):
|
||||
cursor.execute('SELECT %s FROM one_row', (None,))
|
||||
self.assertEqual(cursor.fetchall(), [(None,)])
|
||||
|
||||
@with_cursor
|
||||
def test_iterator(self, cursor):
|
||||
cursor.execute('SELECT * FROM one_row')
|
||||
|
|
Загрузка…
Ссылка в новой задаче