Mercurial > p > mysql-python > mysqldb-2
comparison _mysql_results.c @ 18:d55bfb1a4701 MySQLdb
Tons of changes from major refactoring/cleanup. This is all really broken
right now. In particular, all results are returned as strings.
author | adustman |
---|---|
date | Fri, 14 Mar 2008 23:06:29 +0000 |
parents | c0d1fc0429ce |
children | 9863f08a337c |
comparison
equal
deleted
inserted
replaced
17:7c7a89123d65 | 18:d55bfb1a4701 |
---|---|
154 return d; | 154 return d; |
155 error: | 155 error: |
156 Py_XDECREF(d); | 156 Py_XDECREF(d); |
157 return NULL; | 157 return NULL; |
158 } | 158 } |
159 | 159 |
160 static char _mysql_ResultObject_fields__doc__[] = | |
161 "Returns the sequence of 7-tuples required by the DB-API for\n\ | |
162 the Cursor.description attribute.\n\ | |
163 "; | |
164 | |
165 static PyObject * | |
166 _mysql_ResultObject_fields( | |
167 _mysql_ResultObject *self, | |
168 PyObject *args) | |
169 { | |
170 PyObject *arglist=NULL, *kwarglist=NULL; | |
171 PyObject *fields=NULL; | |
172 _mysql_FieldObject *field=NULL; | |
173 unsigned int i, n; | |
174 if (!PyArg_ParseTuple(args, "")) return NULL; | |
175 check_result_connection(self); | |
176 kwarglist = PyDict_New(); | |
177 if (!kwarglist) goto error; | |
178 n = mysql_num_fields(self->result); | |
179 if (!(fields = PyTuple_New(n))) return NULL; | |
180 for (i=0; i<n; i++) { | |
181 arglist = Py_BuildValue("(Oi)", self, i); | |
182 if (!arglist) goto error; | |
183 field = MyAlloc(_mysql_FieldObject, _mysql_FieldObject_Type); | |
184 if (!field) goto error; | |
185 if (_mysql_FieldObject_Initialize(field, arglist, kwarglist)) | |
186 goto error; | |
187 Py_DECREF(arglist); | |
188 PyTuple_SET_ITEM(fields, i, (PyObject *) field); | |
189 } | |
190 Py_DECREF(kwarglist); | |
191 return fields; | |
192 error: | |
193 Py_XDECREF(arglist); | |
194 Py_XDECREF(kwarglist); | |
195 Py_XDECREF(fields); | |
196 return NULL; | |
197 } | |
198 | |
160 static char _mysql_ResultObject_field_flags__doc__[] = | 199 static char _mysql_ResultObject_field_flags__doc__[] = |
161 "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\ |
162 " ; | 201 " ; |
163 | 202 |
164 static PyObject * | 203 static PyObject * |
552 (PyCFunction)_mysql_ResultObject_describe, | 591 (PyCFunction)_mysql_ResultObject_describe, |
553 METH_VARARGS, | 592 METH_VARARGS, |
554 _mysql_ResultObject_describe__doc__ | 593 _mysql_ResultObject_describe__doc__ |
555 }, | 594 }, |
556 { | 595 { |
596 "fields", | |
597 (PyCFunction)_mysql_ResultObject_fields, | |
598 METH_VARARGS, | |
599 _mysql_ResultObject_fields__doc__ | |
600 }, | |
601 { | |
557 "fetch_row", | 602 "fetch_row", |
558 (PyCFunction)_mysql_ResultObject_fetch_row, | 603 (PyCFunction)_mysql_ResultObject_fetch_row, |
559 METH_VARARGS | METH_KEYWORDS, | 604 METH_VARARGS | METH_KEYWORDS, |
560 _mysql_ResultObject_fetch_row__doc__ | 605 _mysql_ResultObject_fetch_row__doc__ |
561 }, | 606 }, |