@@ -68,7 +68,7 @@ static PyObject *_mysql_IntegrityError;
68
68
static PyObject * _mysql_InternalError ;
69
69
static PyObject * _mysql_ProgrammingError ;
70
70
static PyObject * _mysql_NotSupportedError ;
71
-
71
+
72
72
typedef struct {
73
73
PyObject_HEAD
74
74
MYSQL connection ;
@@ -88,6 +88,7 @@ typedef struct {
88
88
MYSQL_RES * result ;
89
89
int nfields ;
90
90
int use ;
91
+ char has_next ;
91
92
PyObject * converter ;
92
93
} _mysql_ResultObject ;
93
94
@@ -226,7 +227,7 @@ _mysql_Exception(_mysql_ConnectionObject *c)
226
227
Py_DECREF (t );
227
228
return NULL ;
228
229
}
229
-
230
+
230
231
static char _mysql_server_init__doc__ [] =
231
232
"Initialize embedded server. If this client is not linked against\n\
232
233
the embedded server library, this function does nothing.\n\
@@ -249,7 +250,7 @@ static PyObject *_mysql_server_init(
249
250
"already initialized" );
250
251
return NULL ;
251
252
}
252
-
253
+
253
254
if (!PyArg_ParseTupleAndKeywords (args , kwargs , "|OO" , kwlist ,
254
255
& cmd_args , & groups ))
255
256
return NULL ;
@@ -348,7 +349,7 @@ static PyObject *_mysql_server_end(
348
349
}
349
350
return _mysql_Exception (NULL );
350
351
}
351
-
352
+
352
353
#if MYSQL_VERSION_ID >= 32314
353
354
static char _mysql_thread_safe__doc__ [] =
354
355
"Indicates whether the client is compiled as thread-safe." ;
@@ -406,6 +407,7 @@ _mysql_ResultObject_Initialize(
406
407
else
407
408
result = mysql_store_result (& (conn -> connection ));
408
409
self -> result = result ;
410
+ self -> has_next = (char )mysql_more_results (& (conn -> connection ));
409
411
Py_END_ALLOW_THREADS ;
410
412
if (!result ) {
411
413
if (mysql_errno (& (conn -> connection ))) {
@@ -555,7 +557,7 @@ _mysql_ConnectionObject_Initialize(
555
557
char * init_command = NULL ,
556
558
* read_default_file = NULL ,
557
559
* read_default_group = NULL ;
558
-
560
+
559
561
self -> converter = NULL ;
560
562
self -> open = 0 ;
561
563
check_server_init (-1 );
@@ -739,7 +741,7 @@ _mysql_connect(
739
741
PyObject * kwargs )
740
742
{
741
743
_mysql_ConnectionObject * c = NULL ;
742
-
744
+
743
745
c = MyAlloc (_mysql_ConnectionObject , _mysql_ConnectionObject_Type );
744
746
if (c == NULL ) return NULL ;
745
747
if (_mysql_ConnectionObject_Initialize (c , args , kwargs )) {
@@ -1289,7 +1291,7 @@ _mysql_escape_dict(
1289
1291
Py_XDECREF (r );
1290
1292
return NULL ;
1291
1293
}
1292
-
1294
+
1293
1295
static char _mysql_ResultObject_describe__doc__ [] =
1294
1296
"Returns the sequence of 7-tuples required by the DB-API for\n\
1295
1297
the Cursor.description attribute.\n\
@@ -1326,7 +1328,7 @@ _mysql_ResultObject_describe(
1326
1328
Py_XDECREF (d );
1327
1329
return NULL ;
1328
1330
}
1329
-
1331
+
1330
1332
static char _mysql_ResultObject_field_flags__doc__ [] =
1331
1333
"Returns a tuple of field flags, one for each column in the result.\n\
1332
1334
" ;
@@ -1520,7 +1522,7 @@ _mysql__fetch_row(
1520
1522
int maxrows ,
1521
1523
_PYFUNC * convert_row )
1522
1524
{
1523
- unsigned int i ;
1525
+ int i ;
1524
1526
MYSQL_ROW row ;
1525
1527
1526
1528
for (i = skiprows ; i < (skiprows + maxrows ); i ++ ) {
@@ -1573,14 +1575,14 @@ _mysql_ResultObject_fetch_row(
1573
1575
_mysql_row_to_dict_old
1574
1576
};
1575
1577
_PYFUNC * convert_row ;
1576
- unsigned int maxrows = 1 , how = 0 , skiprows = 0 , rowsadded ;
1578
+ int maxrows = 1 , how = 0 , skiprows = 0 , rowsadded ;
1577
1579
PyObject * r = NULL ;
1578
1580
1579
1581
if (!PyArg_ParseTupleAndKeywords (args , kwargs , "|ii:fetch_row" , kwlist ,
1580
1582
& maxrows , & how ))
1581
1583
return NULL ;
1582
1584
check_result_connection (self );
1583
- if (how >= sizeof (row_converters )) {
1585
+ if (how >= ( int ) sizeof (row_converters )) {
1584
1586
PyErr_SetString (PyExc_ValueError , "how out of range" );
1585
1587
return NULL ;
1586
1588
}
@@ -1734,7 +1736,7 @@ _mysql_ConnectionObject_get_character_set_info(
1734
1736
{
1735
1737
PyObject * result ;
1736
1738
MY_CHARSET_INFO cs ;
1737
-
1739
+
1738
1740
if (!PyArg_ParseTuple (args , "" )) return NULL ;
1739
1741
check_connection (self );
1740
1742
mysql_get_character_set_info (& (self -> connection ), & cs );
@@ -2653,6 +2655,13 @@ static struct PyMemberDef _mysql_ResultObject_memberlist[] = {
2653
2655
READONLY ,
2654
2656
"Type conversion mapping"
2655
2657
},
2658
+ {
2659
+ "has_next" ,
2660
+ T_BOOL ,
2661
+ offsetof(_mysql_ResultObject , has_next ),
2662
+ READONLY ,
2663
+ "Has next result"
2664
+ },
2656
2665
{NULL } /* Sentinel */
2657
2666
};
2658
2667
@@ -2717,44 +2726,44 @@ PyTypeObject _mysql_ConnectionObject_Type = {
2717
2726
0 , /* tp_setattr */
2718
2727
0 , /*tp_compare*/
2719
2728
(reprfunc )_mysql_ConnectionObject_repr , /* tp_repr */
2720
-
2729
+
2721
2730
/* Method suites for standard classes */
2722
-
2731
+
2723
2732
0 , /* (PyNumberMethods *) tp_as_number */
2724
2733
0 , /* (PySequenceMethods *) tp_as_sequence */
2725
2734
0 , /* (PyMappingMethods *) tp_as_mapping */
2726
-
2735
+
2727
2736
/* More standard operations (here for binary compatibility) */
2728
-
2737
+
2729
2738
0 , /* (hashfunc) tp_hash */
2730
2739
0 , /* (ternaryfunc) tp_call */
2731
2740
0 , /* (reprfunc) tp_str */
2732
2741
(getattrofunc )_mysql_ConnectionObject_getattro , /* tp_getattro */
2733
2742
(setattrofunc )_mysql_ConnectionObject_setattro , /* tp_setattro */
2734
-
2743
+
2735
2744
/* Functions to access object as input/output buffer */
2736
2745
0 , /* (PyBufferProcs *) tp_as_buffer */
2737
-
2746
+
2738
2747
/* (tp_flags) Flags to define presence of optional/expanded features */
2739
2748
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE ,
2740
2749
_mysql_connect__doc__ , /* (char *) tp_doc Documentation string */
2741
2750
2742
2751
/* call function for all accessible objects */
2743
2752
(traverseproc ) _mysql_ConnectionObject_traverse , /* tp_traverse */
2744
-
2753
+
2745
2754
/* delete references to contained objects */
2746
2755
(inquiry ) _mysql_ConnectionObject_clear , /* tp_clear */
2747
2756
2748
2757
/* rich comparisons */
2749
2758
0 , /* (richcmpfunc) tp_richcompare */
2750
-
2759
+
2751
2760
/* weak reference enabler */
2752
2761
0 , /* (long) tp_weaklistoffset */
2753
2762
2754
2763
/* Iterators */
2755
2764
0 , /* (getiterfunc) tp_iter */
2756
2765
0 , /* (iternextfunc) tp_iternext */
2757
-
2766
+
2758
2767
/* Attribute descriptor and subclassing stuff */
2759
2768
(struct PyMethodDef * )_mysql_ConnectionObject_methods , /* tp_methods */
2760
2769
(struct PyMemberDef * )_mysql_ConnectionObject_memberlist , /* tp_members */
@@ -2789,45 +2798,45 @@ PyTypeObject _mysql_ResultObject_Type = {
2789
2798
0 , /* tp_setattr */
2790
2799
0 , /*tp_compare*/
2791
2800
(reprfunc )_mysql_ResultObject_repr , /* tp_repr */
2792
-
2801
+
2793
2802
/* Method suites for standard classes */
2794
-
2803
+
2795
2804
0 , /* (PyNumberMethods *) tp_as_number */
2796
2805
0 , /* (PySequenceMethods *) tp_as_sequence */
2797
2806
0 , /* (PyMappingMethods *) tp_as_mapping */
2798
-
2807
+
2799
2808
/* More standard operations (here for binary compatibility) */
2800
-
2809
+
2801
2810
0 , /* (hashfunc) tp_hash */
2802
2811
0 , /* (ternaryfunc) tp_call */
2803
2812
0 , /* (reprfunc) tp_str */
2804
2813
(getattrofunc )PyObject_GenericGetAttr , /* tp_getattro */
2805
2814
(setattrofunc )_mysql_ResultObject_setattro , /* tp_setattr */
2806
-
2815
+
2807
2816
/* Functions to access object as input/output buffer */
2808
2817
0 , /* (PyBufferProcs *) tp_as_buffer */
2809
-
2818
+
2810
2819
/* Flags to define presence of optional/expanded features */
2811
2820
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE ,
2812
-
2821
+
2813
2822
_mysql_ResultObject__doc__ , /* (char *) tp_doc Documentation string */
2814
2823
2815
2824
/* call function for all accessible objects */
2816
2825
(traverseproc ) _mysql_ResultObject_traverse , /* tp_traverse */
2817
-
2826
+
2818
2827
/* delete references to contained objects */
2819
2828
(inquiry ) _mysql_ResultObject_clear , /* tp_clear */
2820
2829
2821
2830
/* rich comparisons */
2822
2831
0 , /* (richcmpfunc) tp_richcompare */
2823
-
2832
+
2824
2833
/* weak reference enabler */
2825
2834
0 , /* (long) tp_weaklistoffset */
2826
2835
2827
2836
/* Iterators */
2828
2837
0 , /* (getiterfunc) tp_iter */
2829
2838
0 , /* (iternextfunc) tp_iternext */
2830
-
2839
+
2831
2840
/* Attribute descriptor and subclassing stuff */
2832
2841
(struct PyMethodDef * ) _mysql_ResultObject_methods , /* tp_methods */
2833
2842
(struct PyMemberDef * ) _mysql_ResultObject_memberlist , /*tp_members */
0 commit comments