@@ -677,9 +677,7 @@ PyObject *MrdbCursor_execute(MrdbCursor *self,
677
677
static char * key_words []= {"" , "" , "buffered" , NULL };
678
678
char errmsg [128 ];
679
679
680
- MARIADB_CHECK_STMT (self );
681
- if (PyErr_Occurred ())
682
- return NULL ;
680
+ MARIADB_CHECK_STMT (self , NULL );
683
681
684
682
if (!PyArg_ParseTupleAndKeywords (args , kwargs ,
685
683
"s#|Ob" , key_words , & statement , & statement_len , & Data , & is_buffered ))
@@ -871,8 +869,7 @@ PyObject *MrdbCursor_execute(MrdbCursor *self,
871
869
/* {{{ MrdbCursor_fieldcount() */
872
870
PyObject * MrdbCursor_fieldcount (MrdbCursor * self )
873
871
{
874
- if (PyErr_Occurred ())
875
- return NULL ;
872
+ MARIADB_CHECK_STMT (self , NULL );
876
873
877
874
return PyLong_FromLong ((long )self -> field_count );
878
875
}
@@ -890,9 +887,7 @@ PyObject *MrdbCursor_description(MrdbCursor *self)
890
887
PyObject * obj = NULL ;
891
888
unsigned int field_count = self -> field_count ;
892
889
893
- if (PyErr_Occurred ())
894
- return NULL ;
895
-
890
+ MARIADB_CHECK_STMT (self , NULL );
896
891
897
892
if (self -> fields && field_count )
898
893
{
@@ -996,12 +991,7 @@ MrdbCursor_fetchone(MrdbCursor *self)
996
991
uint32_t i ;
997
992
unsigned int field_count = self -> field_count ;
998
993
999
- if (self -> cursor_type == CURSOR_TYPE_READ_ONLY )
1000
- MARIADB_CHECK_STMT (self );
1001
- if (PyErr_Occurred ())
1002
- {
1003
- return NULL ;
1004
- }
994
+ MARIADB_CHECK_STMT (self , NULL );
1005
995
1006
996
if (!field_count )
1007
997
{
@@ -1042,11 +1032,7 @@ MrdbCursor_scroll(MrdbCursor *self,
1042
1032
const char * scroll_modes []= {"relative" , "absolute" , NULL };
1043
1033
1044
1034
1045
- MARIADB_CHECK_STMT (self );
1046
- if (PyErr_Occurred ())
1047
- {
1048
- return NULL ;
1049
- }
1035
+ MARIADB_CHECK_STMT (self , NULL );
1050
1036
1051
1037
if (!self -> field_count )
1052
1038
{
@@ -1133,11 +1119,7 @@ MrdbCursor_fetchmany(MrdbCursor *self,
1133
1119
static char * kw_list []= {"size" , NULL };
1134
1120
unsigned int field_count = self -> field_count ;
1135
1121
1136
- MARIADB_CHECK_STMT (self );
1137
- if (PyErr_Occurred ())
1138
- {
1139
- return NULL ;
1140
- }
1122
+ MARIADB_CHECK_STMT (self , NULL );
1141
1123
1142
1124
if (!field_count )
1143
1125
{
@@ -1211,11 +1193,8 @@ MrdbCursor_fetchall(MrdbCursor *self)
1211
1193
{
1212
1194
PyObject * List ;
1213
1195
unsigned int field_count = self -> field_count ;
1214
- MARIADB_CHECK_STMT (self );
1215
- if (PyErr_Occurred ())
1216
- {
1217
- return NULL ;
1218
- }
1196
+
1197
+ MARIADB_CHECK_STMT (self , NULL );
1219
1198
1220
1199
if (!field_count )
1221
1200
{
@@ -1332,12 +1311,7 @@ MrdbCursor_executemany(MrdbCursor *self,
1332
1311
uint8_t do_prepare = 1 ;
1333
1312
char errmsg [128 ];
1334
1313
1335
- MARIADB_CHECK_STMT (self );
1336
-
1337
- if (PyErr_Occurred ())
1338
- {
1339
- return NULL ;
1340
- }
1314
+ MARIADB_CHECK_STMT (self , NULL );
1341
1315
1342
1316
self -> data = NULL ;
1343
1317
@@ -1447,13 +1421,8 @@ static PyObject *
1447
1421
MrdbCursor_nextset (MrdbCursor * self )
1448
1422
{
1449
1423
int rc ;
1450
- MARIADB_CHECK_STMT (self );
1424
+ MARIADB_CHECK_STMT (self , NULL );
1451
1425
1452
- if (PyErr_Occurred ())
1453
- {
1454
- return NULL ;
1455
- }
1456
- /* hmmm */
1457
1426
if (!self -> field_count )
1458
1427
{
1459
1428
mariadb_throw_exception (NULL , Mariadb_ProgrammingError , 0 ,
@@ -1519,14 +1488,15 @@ Mariadb_row_number(MrdbCursor *self)
1519
1488
static PyObject *
1520
1489
MrdbCursor_warnings (MrdbCursor * self )
1521
1490
{
1522
- MARIADB_CHECK_STMT (self );
1491
+ MARIADB_CHECK_STMT (self , NULL );
1523
1492
1524
1493
return PyLong_FromLong ((long )CURSOR_WARNING_COUNT (self ));
1525
1494
}
1526
1495
1527
1496
static PyObject *
1528
1497
MrdbCursor_getbuffered (MrdbCursor * self )
1529
1498
{
1499
+ MARIADB_CHECK_STMT (self , NULL );
1530
1500
if (self -> is_buffered )
1531
1501
{
1532
1502
Py_RETURN_TRUE ;
@@ -1537,6 +1507,7 @@ MrdbCursor_getbuffered(MrdbCursor *self)
1537
1507
static int
1538
1508
MrdbCursor_setbuffered (MrdbCursor * self , PyObject * arg )
1539
1509
{
1510
+ MARIADB_CHECK_STMT (self , -1 );
1540
1511
if (!arg || !CHECK_TYPE (arg , & PyBool_Type ))
1541
1512
{
1542
1513
PyErr_SetString (PyExc_TypeError , "Argument must be boolean" );
@@ -1550,6 +1521,7 @@ MrdbCursor_setbuffered(MrdbCursor *self, PyObject *arg)
1550
1521
static PyObject *
1551
1522
MrdbCursor_lastrowid (MrdbCursor * self )
1552
1523
{
1524
+ MARIADB_CHECK_STMT (self , NULL );
1553
1525
if (!self -> lastrow_id )
1554
1526
{
1555
1527
Py_INCREF (Py_None );
@@ -1563,7 +1535,7 @@ MrdbCursor_lastrowid(MrdbCursor *self)
1563
1535
static PyObject *
1564
1536
MrdbCursor_iter (PyObject * self )
1565
1537
{
1566
- MARIADB_CHECK_STMT ((( MrdbCursor * )self ) );
1538
+ MARIADB_CHECK_STMT ((MrdbCursor * )self , NULL );
1567
1539
Py_INCREF (self );
1568
1540
return self ;
1569
1541
}
@@ -1573,6 +1545,8 @@ MrdbCursor_iternext(PyObject *self)
1573
1545
{
1574
1546
PyObject * res ;
1575
1547
1548
+ MARIADB_CHECK_STMT ((MrdbCursor * )self , NULL );
1549
+
1576
1550
res = MrdbCursor_fetchone ((MrdbCursor * )self );
1577
1551
1578
1552
if (res && res == Py_None )
@@ -1594,15 +1568,14 @@ static PyObject
1594
1568
static PyObject *
1595
1569
MrdbCursor_sp_outparams (MrdbCursor * self )
1596
1570
{
1597
- if (!self -> closed && self -> stmt &&
1598
- self -> stmt -> mysql )
1571
+ uint32_t server_status ;
1572
+
1573
+ MARIADB_CHECK_STMT (self , NULL );
1574
+
1575
+ mariadb_get_infov (self -> stmt -> mysql , MARIADB_CONNECTION_SERVER_STATUS , & server_status );
1576
+ if (server_status & SERVER_PS_OUT_PARAMS )
1599
1577
{
1600
- uint32_t server_status ;
1601
- mariadb_get_infov (self -> stmt -> mysql , MARIADB_CONNECTION_SERVER_STATUS , & server_status );
1602
- if (server_status & SERVER_PS_OUT_PARAMS )
1603
- {
1604
- Py_RETURN_TRUE ;
1605
- }
1578
+ Py_RETURN_TRUE ;
1606
1579
}
1607
1580
Py_RETURN_FALSE ;
1608
1581
}
@@ -1619,7 +1592,7 @@ MrdbCursor_callproc(MrdbCursor *self, PyObject *args)
1619
1592
PyObject * new_args = NULL ;
1620
1593
PyObject * rc = NULL ;
1621
1594
1622
- MARIADB_CHECK_STMT ((( MrdbCursor * ) self ) );
1595
+ MARIADB_CHECK_STMT (self , NULL );
1623
1596
1624
1597
if (!PyArg_ParseTuple (args , "s#|O" , & sp , & sp_len , & data ))
1625
1598
return NULL ;
0 commit comments