@@ -653,18 +653,20 @@ PyObject *MrdbCursor_InitResultSet(MrdbCursor *self)
653
653
self -> result = NULL ;
654
654
}
655
655
656
- if (Mrdb_GetFieldInfo (self ))
657
- return NULL ;
658
-
659
- if (!(self -> values = (PyObject * * )PyMem_RawCalloc (self -> field_count , sizeof (PyObject * ))))
660
- return NULL ;
661
- if (!self -> parseinfo .is_text )
662
- mysql_stmt_attr_set (self -> stmt , STMT_ATTR_CB_RESULT , field_fetch_callback );
663
-
664
656
if (self -> field_count )
665
657
{
666
- self -> row_count = CURSOR_NUM_ROWS (self );
667
- self -> affected_rows = 0 ;
658
+ if (Mrdb_GetFieldInfo (self ))
659
+ {
660
+ return NULL ;
661
+ }
662
+
663
+ if (!(self -> values = (PyObject * * )PyMem_RawCalloc (self -> field_count , sizeof (PyObject * ))))
664
+ return NULL ;
665
+ if (!self -> parseinfo .is_text )
666
+ mysql_stmt_attr_set (self -> stmt , STMT_ATTR_CB_RESULT , field_fetch_callback );
667
+
668
+ self -> row_count = CURSOR_NUM_ROWS (self );
669
+ self -> affected_rows = 0 ;
668
670
} else {
669
671
self -> row_count = self -> affected_rows = CURSOR_AFFECTED_ROWS (self );
670
672
}
@@ -1284,6 +1286,7 @@ static PyObject *
1284
1286
MrdbCursor_check_text_types (MrdbCursor * self )
1285
1287
{
1286
1288
PyDateTime_IMPORT ;
1289
+ Py_ssize_t ofs = 0 ;
1287
1290
1288
1291
if (!self || !self -> data || !self -> parseinfo .paramcount )
1289
1292
{
@@ -1292,7 +1295,14 @@ MrdbCursor_check_text_types(MrdbCursor *self)
1292
1295
1293
1296
for (uint32_t i = 0 ; i < self -> parseinfo .paramcount ; i ++ )
1294
1297
{
1295
- PyObject * obj = ListOrTuple_GetItem (self -> data , i );
1298
+ PyObject * obj ;
1299
+
1300
+ if (PyDict_Check (self -> data ))
1301
+ {
1302
+ PyDict_Next (self -> data , & ofs , NULL , & obj );
1303
+ }
1304
+ else
1305
+ obj = ListOrTuple_GetItem (self -> data , i );
1296
1306
if (PyBytes_Check (obj ) ||
1297
1307
PyByteArray_Check (obj ) ||
1298
1308
PyDate_Check (obj ))
0 commit comments