Remove broken row_seek() and row_tell() (#220)

They are broken from long ago and making them safe is difficult.
So remove them rather than fix.
This commit is contained in:
INADA Naoki
2017-12-21 18:48:50 +09:00
committed by GitHub
parent d65e10e356
commit b10ecd0b46

View File

@ -2166,46 +2166,6 @@ _mysql_ResultObject_data_seek(
return Py_None;
}
static char _mysql_ResultObject_row_seek__doc__[] =
"row_seek(n) -- seek by offset n rows of result set";
static PyObject *
_mysql_ResultObject_row_seek(
_mysql_ResultObject *self,
PyObject *args)
{
int offset;
MYSQL_ROW_OFFSET r;
if (!PyArg_ParseTuple(args, "i:row_seek", &offset)) return NULL;
check_result_connection(self);
if (self->use) {
PyErr_SetString(_mysql_ProgrammingError,
"cannot be used with connection.use_result()");
return NULL;
}
r = mysql_row_tell(self->result);
mysql_row_seek(self->result, r+offset);
Py_INCREF(Py_None);
return Py_None;
}
static char _mysql_ResultObject_row_tell__doc__[] =
"row_tell() -- return the current row number of the result set.";
static PyObject *
_mysql_ResultObject_row_tell(
_mysql_ResultObject *self,
PyObject *noargs)
{
MYSQL_ROW_OFFSET r;
check_result_connection(self);
if (self->use) {
PyErr_SetString(_mysql_ProgrammingError,
"cannot be used with connection.use_result()");
return NULL;
}
r = mysql_row_tell(self->result);
return PyInt_FromLong(r-self->result->data->data);
}
static void
_mysql_ResultObject_dealloc(
_mysql_ResultObject *self)
@ -2504,18 +2464,6 @@ static PyMethodDef _mysql_ResultObject_methods[] = {
METH_VARARGS,
_mysql_ResultObject_data_seek__doc__
},
{
"row_seek",
(PyCFunction)_mysql_ResultObject_row_seek,
METH_VARARGS,
_mysql_ResultObject_row_seek__doc__
},
{
"row_tell",
(PyCFunction)_mysql_ResultObject_row_tell,
METH_NOARGS,
_mysql_ResultObject_row_tell__doc__
},
{
"describe",
(PyCFunction)_mysql_ResultObject_describe,