@@ -756,6 +756,16 @@ static int _mysql_ConnectionObject_clear(
756
756
return 0 ;
757
757
}
758
758
759
+ static char _mysql_ConnectionObject_fileno__doc__ [] =
760
+ "Return underlaying fd for connection" ;
761
+
762
+ static PyObject *
763
+ _mysql_ConnectionObject_fileno (
764
+ _mysql_ConnectionObject * self )
765
+ {
766
+ return PyInt_FromLong (self -> connection .net .fd );
767
+ }
768
+
759
769
static char _mysql_ConnectionObject_close__doc__ [] =
760
770
"Close the connection. No further activity possible." ;
761
771
@@ -1963,8 +1973,10 @@ _mysql_ConnectionObject_query(
1963
1973
{
1964
1974
char * query ;
1965
1975
int len , r ;
1976
+ MYSQL * mysql = & (self -> connection );
1966
1977
if (!PyArg_ParseTuple (args , "s#:query" , & query , & len )) return NULL ;
1967
1978
check_connection (self );
1979
+
1968
1980
Py_BEGIN_ALLOW_THREADS
1969
1981
r = mysql_real_query (& (self -> connection ), query , len );
1970
1982
Py_END_ALLOW_THREADS
@@ -1974,6 +1986,50 @@ _mysql_ConnectionObject_query(
1974
1986
}
1975
1987
1976
1988
1989
+ static char _mysql_ConnectionObject_send_query__doc__ [] =
1990
+ "Send a query. Same to query() except not wait response.\n\n\
1991
+ Use read_query_result() before calling store_result() or use_result()\n" ;
1992
+
1993
+ static PyObject *
1994
+ _mysql_ConnectionObject_send_query (
1995
+ _mysql_ConnectionObject * self ,
1996
+ PyObject * args )
1997
+ {
1998
+ char * query ;
1999
+ int len , r ;
2000
+ MYSQL * mysql = & (self -> connection );
2001
+ if (!PyArg_ParseTuple (args , "s#:query" , & query , & len )) return NULL ;
2002
+ check_connection (self );
2003
+
2004
+ Py_BEGIN_ALLOW_THREADS
2005
+ r = mysql_send_query (mysql , query , len );
2006
+ Py_END_ALLOW_THREADS
2007
+ if (r ) return _mysql_Exception (self );
2008
+ Py_INCREF (Py_None );
2009
+ return Py_None ;
2010
+ }
2011
+
2012
+
2013
+ static char _mysql_ConnectionObject_read_query_result__doc__ [] =
2014
+ "Read result of query sent by send_query().\n" ;
2015
+
2016
+ static PyObject *
2017
+ _mysql_ConnectionObject_read_query_result (
2018
+ _mysql_ConnectionObject * self )
2019
+ {
2020
+ char * query ;
2021
+ int len , r ;
2022
+ MYSQL * mysql = & (self -> connection );
2023
+ check_connection (self );
2024
+
2025
+ Py_BEGIN_ALLOW_THREADS
2026
+ r = (int )mysql_read_query_result (mysql );
2027
+ Py_END_ALLOW_THREADS
2028
+ if (r ) return _mysql_Exception (self );
2029
+ Py_INCREF (Py_None );
2030
+ return Py_None ;
2031
+ }
2032
+
1977
2033
static char _mysql_ConnectionObject_select_db__doc__ [] =
1978
2034
"Causes the database specified by db to become the default\n\
1979
2035
(current) database on the connection specified by mysql. In subsequent\n\
@@ -2344,6 +2400,12 @@ static PyMethodDef _mysql_ConnectionObject_methods[] = {
2344
2400
METH_VARARGS ,
2345
2401
_mysql_ConnectionObject_close__doc__
2346
2402
},
2403
+ {
2404
+ "fileno" ,
2405
+ (PyCFunction )_mysql_ConnectionObject_fileno ,
2406
+ METH_NOARGS ,
2407
+ _mysql_ConnectionObject_fileno__doc__
2408
+ },
2347
2409
{
2348
2410
"dump_debug_info" ,
2349
2411
(PyCFunction )_mysql_ConnectionObject_dump_debug_info ,
@@ -2428,6 +2490,18 @@ static PyMethodDef _mysql_ConnectionObject_methods[] = {
2428
2490
METH_VARARGS ,
2429
2491
_mysql_ConnectionObject_query__doc__
2430
2492
},
2493
+ {
2494
+ "send_query" ,
2495
+ (PyCFunction )_mysql_ConnectionObject_send_query ,
2496
+ METH_VARARGS ,
2497
+ _mysql_ConnectionObject_send_query__doc__ ,
2498
+ },
2499
+ {
2500
+ "read_query_result" ,
2501
+ (PyCFunction )_mysql_ConnectionObject_read_query_result ,
2502
+ METH_NOARGS ,
2503
+ _mysql_ConnectionObject_read_query_result__doc__ ,
2504
+ },
2431
2505
{
2432
2506
"select_db" ,
2433
2507
(PyCFunction )_mysql_ConnectionObject_select_db ,
0 commit comments