mirror of
https://github.com/mariadb-corporation/mariadb-connector-python.git
synced 2025-08-15 23:42:40 +00:00
Test fixes for testing against MySQL server
This commit is contained in:
@ -1299,8 +1299,9 @@ mariadb_param_to_bind(MrdbCursor *self,
|
||||
}
|
||||
|
||||
if (!value->value)
|
||||
{
|
||||
bind->buffer_type= MYSQL_TYPE_NULL;
|
||||
|
||||
} else {
|
||||
if (IS_NUM(bind->buffer_type))
|
||||
{
|
||||
bind->buffer= value->num;
|
||||
@ -1311,6 +1312,7 @@ mariadb_param_to_bind(MrdbCursor *self,
|
||||
if (_PyLong_Sign(value->value) < 0)
|
||||
is_negative= 1;
|
||||
}
|
||||
}
|
||||
|
||||
switch(bind->buffer_type)
|
||||
{
|
||||
@ -1435,11 +1437,6 @@ mariadb_param_update(void *data, MYSQL_BIND *bind, uint32_t row_nr)
|
||||
uint32_t i;
|
||||
uint8_t rc= 1;
|
||||
|
||||
/* if (!self)
|
||||
{
|
||||
return 1;
|
||||
} */
|
||||
|
||||
MARIADB_UNBLOCK_THREADS(self);
|
||||
|
||||
for (i=0; i < self->param_count; i++)
|
||||
|
@ -24,6 +24,7 @@ def long_minus(s):
|
||||
conversions = {
|
||||
**{FIELD_TYPE.TIME: timedelta_to_time},
|
||||
**{FIELD_TYPE.LONG: long_minus},
|
||||
**{FIELD_TYPE.LONGLONG: long_minus},
|
||||
}
|
||||
|
||||
class TestConversion(unittest.TestCase):
|
||||
@ -46,7 +47,7 @@ class TestConversion(unittest.TestCase):
|
||||
def test_convert_long(self):
|
||||
cursor= self.connection.cursor()
|
||||
a= 12345
|
||||
cursor.execute("SELECT CAST(? AS INT)", (12345,))
|
||||
cursor.execute("SELECT CAST(? AS SIGNED)", (12345,))
|
||||
row= cursor.fetchone()
|
||||
self.assertEqual(row[0],a-1)
|
||||
del cursor
|
||||
|
@ -16,6 +16,18 @@ from test.base_test import create_connection
|
||||
|
||||
server_indicator_version= 100206
|
||||
|
||||
def is_mysql():
|
||||
mysql_server= 1
|
||||
conn= create_connection()
|
||||
cursor= conn.cursor()
|
||||
cursor.execute("select version()")
|
||||
row= cursor.fetchone()
|
||||
print(row[0].upper())
|
||||
if "MARIADB" in row[0].upper():
|
||||
mysql_server= 0
|
||||
del cursor, conn
|
||||
return mysql_server
|
||||
|
||||
class foo(int):
|
||||
def bar(self):pass
|
||||
|
||||
@ -243,7 +255,7 @@ class TestCursor(unittest.TestCase):
|
||||
self.assertEqual(fieldinfo.type(info[7]), "STRING")
|
||||
self.assertEqual(fieldinfo.type(info[8]), "VAR_STRING")
|
||||
self.assertEqual(fieldinfo.type(info[9]), "BLOB")
|
||||
if self.connection.server_version_info > (10, 5, 1):
|
||||
if self.connection.server_version_info > (10, 5, 1) or is_mysql():
|
||||
self.assertEqual(fieldinfo.type(info[10]), "JSON")
|
||||
else:
|
||||
self.assertEqual(fieldinfo.type(info[10]), "BLOB")
|
||||
@ -764,6 +776,8 @@ class TestCursor(unittest.TestCase):
|
||||
del cursor, con
|
||||
|
||||
def test_conpy42(self):
|
||||
if is_mysql():
|
||||
self.skipTest("Skip (MySQL)")
|
||||
con= create_connection()
|
||||
cursor = con.cursor()
|
||||
cursor.execute("CREATE TEMPORARY TABLE conpy42(a GEOMETRY)")
|
||||
|
Reference in New Issue
Block a user