Mercurial > p > mysql-python > mysqldb-2
comparison _mysql_results.c @ 26:9863f08a337c MySQLdb
Last of the METH_NOARGS conversions.
author | kylev |
---|---|
date | Sat, 07 Feb 2009 20:54:30 +0000 |
parents | d55bfb1a4701 |
children | fdf0cabb27be |
comparison
equal
deleted
inserted
replaced
25:25c5d3b241ba | 26:9863f08a337c |
---|---|
117 self->converter = NULL; | 117 self->converter = NULL; |
118 Py_XDECREF(self->conn); | 118 Py_XDECREF(self->conn); |
119 self->conn = NULL; | 119 self->conn = NULL; |
120 return 0; | 120 return 0; |
121 } | 121 } |
122 | 122 |
123 static char _mysql_ResultObject_describe__doc__[] = | 123 static char _mysql_ResultObject_describe__doc__[] = |
124 "Returns the sequence of 7-tuples required by the DB-API for\n\ | 124 "Returns the sequence of 7-tuples required by the DB-API for\n\ |
125 the Cursor.description attribute.\n\ | 125 the Cursor.description attribute.\n\ |
126 "; | 126 "; |
127 | 127 |
128 static PyObject * | 128 static PyObject * |
129 _mysql_ResultObject_describe( | 129 _mysql_ResultObject_describe( |
130 _mysql_ResultObject *self, | 130 _mysql_ResultObject *self, |
131 PyObject *args) | 131 PyObject *unused) |
132 { | 132 { |
133 PyObject *d; | 133 PyObject *d; |
134 MYSQL_FIELD *fields; | 134 MYSQL_FIELD *fields; |
135 unsigned int i, n; | 135 unsigned int i, n; |
136 if (!PyArg_ParseTuple(args, "")) return NULL; | 136 |
137 check_result_connection(self); | 137 check_result_connection(self); |
138 n = mysql_num_fields(self->result); | 138 n = mysql_num_fields(self->result); |
139 fields = mysql_fetch_fields(self->result); | 139 fields = mysql_fetch_fields(self->result); |
140 if (!(d = PyTuple_New(n))) return NULL; | 140 if (!(d = PyTuple_New(n))) return NULL; |
141 for (i=0; i<n; i++) { | 141 for (i=0; i<n; i++) { |
163 "; | 163 "; |
164 | 164 |
165 static PyObject * | 165 static PyObject * |
166 _mysql_ResultObject_fields( | 166 _mysql_ResultObject_fields( |
167 _mysql_ResultObject *self, | 167 _mysql_ResultObject *self, |
168 PyObject *args) | 168 PyObject *unused) |
169 { | 169 { |
170 PyObject *arglist=NULL, *kwarglist=NULL; | 170 PyObject *arglist=NULL, *kwarglist=NULL; |
171 PyObject *fields=NULL; | 171 PyObject *fields=NULL; |
172 _mysql_FieldObject *field=NULL; | 172 _mysql_FieldObject *field=NULL; |
173 unsigned int i, n; | 173 unsigned int i, n; |
174 if (!PyArg_ParseTuple(args, "")) return NULL; | 174 |
175 check_result_connection(self); | 175 check_result_connection(self); |
176 kwarglist = PyDict_New(); | 176 kwarglist = PyDict_New(); |
177 if (!kwarglist) goto error; | 177 if (!kwarglist) goto error; |
178 n = mysql_num_fields(self->result); | 178 n = mysql_num_fields(self->result); |
179 if (!(fields = PyTuple_New(n))) return NULL; | 179 if (!(fields = PyTuple_New(n))) return NULL; |
193 Py_XDECREF(arglist); | 193 Py_XDECREF(arglist); |
194 Py_XDECREF(kwarglist); | 194 Py_XDECREF(kwarglist); |
195 Py_XDECREF(fields); | 195 Py_XDECREF(fields); |
196 return NULL; | 196 return NULL; |
197 } | 197 } |
198 | 198 |
199 static char _mysql_ResultObject_field_flags__doc__[] = | 199 static char _mysql_ResultObject_field_flags__doc__[] = |
200 "Returns a tuple of field flags, one for each column in the result.\n\ | 200 "Returns a tuple of field flags, one for each column in the result.\n\ |
201 " ; | 201 " ; |
202 | 202 |
203 static PyObject * | 203 static PyObject * |
204 _mysql_ResultObject_field_flags( | 204 _mysql_ResultObject_field_flags( |
205 _mysql_ResultObject *self, | 205 _mysql_ResultObject *self, |
206 PyObject *args) | 206 PyObject *unused) |
207 { | 207 { |
208 PyObject *d; | 208 PyObject *d; |
209 MYSQL_FIELD *fields; | 209 MYSQL_FIELD *fields; |
210 unsigned int i, n; | 210 unsigned int i, n; |
211 if (!PyArg_ParseTuple(args, "")) return NULL; | 211 |
212 check_result_connection(self); | 212 check_result_connection(self); |
213 n = mysql_num_fields(self->result); | 213 n = mysql_num_fields(self->result); |
214 fields = mysql_fetch_fields(self->result); | 214 fields = mysql_fetch_fields(self->result); |
215 if (!(d = PyTuple_New(n))) return NULL; | 215 if (!(d = PyTuple_New(n))) return NULL; |
216 for (i=0; i<n; i++) { | 216 for (i=0; i<n; i++) { |
465 "Returns the number of fields (column) in the result." ; | 465 "Returns the number of fields (column) in the result." ; |
466 | 466 |
467 static PyObject * | 467 static PyObject * |
468 _mysql_ResultObject_num_fields( | 468 _mysql_ResultObject_num_fields( |
469 _mysql_ResultObject *self, | 469 _mysql_ResultObject *self, |
470 PyObject *args) | 470 PyObject *unused) |
471 { | 471 { |
472 if (!PyArg_ParseTuple(args, "")) return NULL; | |
473 check_result_connection(self); | 472 check_result_connection(self); |
474 return PyInt_FromLong((long)mysql_num_fields(self->result)); | 473 return PyInt_FromLong((long)mysql_num_fields(self->result)); |
475 } | 474 } |
476 | 475 |
477 static char _mysql_ResultObject_num_rows__doc__[] = | 476 static char _mysql_ResultObject_num_rows__doc__[] = |
478 "Returns the number of rows in the result set. Note that if\n\ | 477 "Returns the number of rows in the result set. Note that if\n\ |
479 use=1, this will not return a valid value until the entire result\n\ | 478 use=1, this will not return a valid value until the entire result\n\ |
480 set has been read.\n\ | 479 set has been read.\n\ |
481 "; | 480 "; |
482 | 481 |
483 static PyObject * | 482 static PyObject * |
484 _mysql_ResultObject_num_rows( | 483 _mysql_ResultObject_num_rows( |
485 _mysql_ResultObject *self, | 484 _mysql_ResultObject *self, |
486 PyObject *args) | 485 PyObject *unused) |
487 { | 486 { |
488 if (!PyArg_ParseTuple(args, "")) return NULL; | |
489 check_result_connection(self); | 487 check_result_connection(self); |
490 return PyLong_FromUnsignedLongLong(mysql_num_rows(self->result)); | 488 return PyLong_FromUnsignedLongLong(mysql_num_rows(self->result)); |
491 } | 489 } |
492 | 490 |
493 | 491 |
494 static char _mysql_ResultObject_data_seek__doc__[] = | 492 static char _mysql_ResultObject_data_seek__doc__[] = |
495 "data_seek(n) -- seek to row n of result set"; | 493 "data_seek(n) -- seek to row n of result set"; |
496 static PyObject * | 494 static PyObject * |
531 static char _mysql_ResultObject_row_tell__doc__[] = | 529 static char _mysql_ResultObject_row_tell__doc__[] = |
532 "row_tell() -- return the current row number of the result set."; | 530 "row_tell() -- return the current row number of the result set."; |
533 static PyObject * | 531 static PyObject * |
534 _mysql_ResultObject_row_tell( | 532 _mysql_ResultObject_row_tell( |
535 _mysql_ResultObject *self, | 533 _mysql_ResultObject *self, |
536 PyObject *args) | 534 PyObject *unused) |
537 { | 535 { |
538 MYSQL_ROW_OFFSET r; | 536 MYSQL_ROW_OFFSET r; |
539 if (!PyArg_ParseTuple(args, "")) return NULL; | 537 |
540 check_result_connection(self); | 538 check_result_connection(self); |
541 if (self->use) { | 539 if (self->use) { |
542 PyErr_SetString(_mysql_ProgrammingError, | 540 PyErr_SetString(_mysql_ProgrammingError, |
543 "cannot be used with connection.use_result()"); | 541 "cannot be used with connection.use_result()"); |
544 return NULL; | 542 return NULL; |
581 _mysql_ResultObject_row_seek__doc__ | 579 _mysql_ResultObject_row_seek__doc__ |
582 }, | 580 }, |
583 { | 581 { |
584 "row_tell", | 582 "row_tell", |
585 (PyCFunction)_mysql_ResultObject_row_tell, | 583 (PyCFunction)_mysql_ResultObject_row_tell, |
586 METH_VARARGS, | 584 METH_NOARGS, |
587 _mysql_ResultObject_row_tell__doc__ | 585 _mysql_ResultObject_row_tell__doc__ |
588 }, | 586 }, |
589 { | 587 { |
590 "describe", | 588 "describe", |
591 (PyCFunction)_mysql_ResultObject_describe, | 589 (PyCFunction)_mysql_ResultObject_describe, |
592 METH_VARARGS, | 590 METH_NOARGS, |
593 _mysql_ResultObject_describe__doc__ | 591 _mysql_ResultObject_describe__doc__ |
594 }, | 592 }, |
595 { | 593 { |
596 "fields", | 594 "fields", |
597 (PyCFunction)_mysql_ResultObject_fields, | 595 (PyCFunction)_mysql_ResultObject_fields, |
598 METH_VARARGS, | 596 METH_NOARGS, |
599 _mysql_ResultObject_fields__doc__ | 597 _mysql_ResultObject_fields__doc__ |
600 }, | 598 }, |
601 { | 599 { |
602 "fetch_row", | 600 "fetch_row", |
603 (PyCFunction)_mysql_ResultObject_fetch_row, | 601 (PyCFunction)_mysql_ResultObject_fetch_row, |
605 _mysql_ResultObject_fetch_row__doc__ | 603 _mysql_ResultObject_fetch_row__doc__ |
606 }, | 604 }, |
607 { | 605 { |
608 "field_flags", | 606 "field_flags", |
609 (PyCFunction)_mysql_ResultObject_field_flags, | 607 (PyCFunction)_mysql_ResultObject_field_flags, |
610 METH_VARARGS, | 608 METH_NOARGS, |
611 _mysql_ResultObject_field_flags__doc__ | 609 _mysql_ResultObject_field_flags__doc__ |
612 }, | 610 }, |
613 { | 611 { |
614 "num_fields", | 612 "num_fields", |
615 (PyCFunction)_mysql_ResultObject_num_fields, | 613 (PyCFunction)_mysql_ResultObject_num_fields, |
616 METH_VARARGS, | 614 METH_NOARGS, |
617 _mysql_ResultObject_num_fields__doc__ | 615 _mysql_ResultObject_num_fields__doc__ |
618 }, | 616 }, |
619 { | 617 { |
620 "num_rows", | 618 "num_rows", |
621 (PyCFunction)_mysql_ResultObject_num_rows, | 619 (PyCFunction)_mysql_ResultObject_num_rows, |
622 METH_VARARGS, | 620 METH_NOARGS, |
623 _mysql_ResultObject_num_rows__doc__ | 621 _mysql_ResultObject_num_rows__doc__ |
624 }, | 622 }, |
625 {NULL, NULL} /* sentinel */ | 623 {NULL, NULL} /* sentinel */ |
626 }; | 624 }; |
627 | 625 |