Mercurial > p > mysql-python > mysqldb-2
comparison _mysql_connections.c @ 5:b70cce9bd065 MySQLdb
Merge changes from 1.2 branch r456-468
author | adustman |
---|---|
date | Sun, 11 Feb 2007 04:37:29 +0000 |
parents | c0d1fc0429ce |
children | bb552e789992 |
comparison
equal
deleted
inserted
replaced
4:b5a377255eea | 5:b70cce9bd065 |
---|---|
864 \n\ | 864 \n\ |
865 This function can be used by clients that remain idle for a\n\ | 865 This function can be used by clients that remain idle for a\n\ |
866 long while, to check whether or not the server has closed the\n\ | 866 long while, to check whether or not the server has closed the\n\ |
867 connection and reconnect if necessary.\n\ | 867 connection and reconnect if necessary.\n\ |
868 \n\ | 868 \n\ |
869 Non-standard.\n\ | 869 New in 1.2.2: Accepts an optional reconnect parameter. If True,\n\ |
870 then the client will attempt reconnection. Note that this setting\n\ | |
871 is persistent. By default, this is on in MySQL<5.0.3, and off\n\ | |
872 thereafter.\n\ | |
873 \n\ | |
874 Non-standard. You should assume that ping() performs an\n\ | |
875 implicit rollback; use only when starting a new transaction.\n\ | |
876 You have been warned.\n\ | |
870 "; | 877 "; |
871 | 878 |
872 static PyObject * | 879 static PyObject * |
873 _mysql_ConnectionObject_ping( | 880 _mysql_ConnectionObject_ping( |
874 _mysql_ConnectionObject *self, | 881 _mysql_ConnectionObject *self, |
875 PyObject *args) | 882 PyObject *args) |
876 { | 883 { |
877 int r; | 884 int r, reconnect = -1; |
878 if (!PyArg_ParseTuple(args, "")) return NULL; | 885 if (!PyArg_ParseTuple(args, "|I", &reconnect)) return NULL; |
879 check_connection(self); | 886 check_connection(self); |
887 if ( reconnect != -1 ) self->connection.reconnect = reconnect; | |
880 Py_BEGIN_ALLOW_THREADS | 888 Py_BEGIN_ALLOW_THREADS |
881 r = mysql_ping(&(self->connection)); | 889 r = mysql_ping(&(self->connection)); |
882 Py_END_ALLOW_THREADS | 890 Py_END_ALLOW_THREADS |
883 if (r) return _mysql_Exception(self); | 891 if (r) return _mysql_Exception(self); |
884 Py_INCREF(Py_None); | 892 Py_INCREF(Py_None); |