annotate _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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
1 #include "_mysql.h"
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
2
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
3 static char _mysql_ResultObject__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
4 "result(connection, use=0, converter={}) -- Result set from a query.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
5 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
6 Creating instances of this class directly is an excellent way to\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
7 shoot yourself in the foot. If using _mysql.connection directly,\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
8 use connection.store_result() or connection.use_result() instead.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
9 If using MySQLdb.Connection, this is done by the cursor class.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
10 Just forget you ever saw this. Forget... FOR-GET...";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
11
2
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
12 int
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
13 _mysql_ResultObject_Initialize(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
14 _mysql_ResultObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
15 PyObject *args,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
16 PyObject *kwargs)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
17 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
18 static char *kwlist[] = {"connection", "use", "converter", NULL};
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
19 MYSQL_RES *result;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
20 _mysql_ConnectionObject *conn=NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
21 int use=0;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
22 PyObject *conv=NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
23 int n, i;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
24 MYSQL_FIELD *fields;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
25
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
26 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|iO", kwlist,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
27 &conn, &use, &conv))
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
28 return -1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
29 if (!conv) conv = PyDict_New();
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
30 if (!conv) return -1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
31 self->conn = (PyObject *) conn;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
32 Py_INCREF(conn);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
33 self->use = use;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
34 Py_BEGIN_ALLOW_THREADS ;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
35 if (use)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
36 result = mysql_use_result(&(conn->connection));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
37 else
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
38 result = mysql_store_result(&(conn->connection));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
39 self->result = result;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
40 Py_END_ALLOW_THREADS ;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
41 if (!result) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
42 self->converter = PyTuple_New(0);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
43 return 0;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
44 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
45 n = mysql_num_fields(result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
46 self->nfields = n;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
47 if (!(self->converter = PyTuple_New(n))) return -1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
48 fields = mysql_fetch_fields(result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
49 for (i=0; i<n; i++) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
50 PyObject *tmp, *fun;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
51 tmp = PyInt_FromLong((long) fields[i].type);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
52 if (!tmp) return -1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
53 fun = PyObject_GetItem(conv, tmp);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
54 Py_DECREF(tmp);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
55 if (!fun) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
56 PyErr_Clear();
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
57 fun = Py_None;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
58 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
59 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
60 if (PySequence_Check(fun)) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
61 int j, n2=PySequence_Size(fun);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
62 PyObject *fun2=NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
63 for (j=0; j<n2; j++) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
64 PyObject *t = PySequence_GetItem(fun, j);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
65 if (!t) continue;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
66 if (!PyTuple_Check(t)) goto cleanup;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
67 if (PyTuple_GET_SIZE(t) == 2) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
68 long mask;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
69 PyObject *pmask=NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
70 pmask = PyTuple_GET_ITEM(t, 0);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
71 fun2 = PyTuple_GET_ITEM(t, 1);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
72 if (PyInt_Check(pmask)) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
73 mask = PyInt_AS_LONG(pmask);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
74 if (mask & fields[i].flags) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
75 break;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
76 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
77 else {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
78 continue;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
79 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
80 } else {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
81 break;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
82 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
83 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
84 cleanup:
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
85 Py_DECREF(t);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
86 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
87 if (!fun2) fun2 = Py_None;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
88 Py_INCREF(fun2);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
89 Py_DECREF(fun);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
90 fun = fun2;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
91 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
92 PyTuple_SET_ITEM(self->converter, i, fun);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
93 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
94 return 0;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
95 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
96
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
97 #if PY_VERSION_HEX >= 0x02020000
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
98 static int _mysql_ResultObject_traverse(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
99 _mysql_ResultObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
100 visitproc visit,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
101 void *arg)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
102 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
103 int r;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
104 if (self->converter) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
105 if (!(r = visit(self->converter, arg))) return r;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
106 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
107 if (self->conn)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
108 return visit(self->conn, arg);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
109 return 0;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
110 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
111 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
112
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
113 static int _mysql_ResultObject_clear(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
114 _mysql_ResultObject *self)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
115 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
116 Py_XDECREF(self->converter);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
117 self->converter = NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
118 Py_XDECREF(self->conn);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
119 self->conn = NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
120 return 0;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
121 }
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
122
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
123 static char _mysql_ResultObject_describe__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
124 "Returns the sequence of 7-tuples required by the DB-API for\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
125 the Cursor.description attribute.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
126 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
127
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
128 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
129 _mysql_ResultObject_describe(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
130 _mysql_ResultObject *self,
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
131 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
132 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
133 PyObject *d;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
134 MYSQL_FIELD *fields;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
135 unsigned int i, n;
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
136
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
137 check_result_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
138 n = mysql_num_fields(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
139 fields = mysql_fetch_fields(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
140 if (!(d = PyTuple_New(n))) return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
141 for (i=0; i<n; i++) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
142 PyObject *t;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
143 t = Py_BuildValue("(siiiiii)",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
144 fields[i].name,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
145 (long) fields[i].type,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
146 (long) fields[i].max_length,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
147 (long) fields[i].length,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
148 (long) fields[i].length,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
149 (long) fields[i].decimals,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
150 (long) !(IS_NOT_NULL(fields[i].flags)));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
151 if (!t) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
152 PyTuple_SET_ITEM(d, i, t);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
153 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
154 return d;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
155 error:
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
156 Py_XDECREF(d);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
157 return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
158 }
18
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
159
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
160 static char _mysql_ResultObject_fields__doc__[] =
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
161 "Returns the sequence of 7-tuples required by the DB-API for\n\
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
162 the Cursor.description attribute.\n\
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
163 ";
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
164
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
165 static PyObject *
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
166 _mysql_ResultObject_fields(
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
167 _mysql_ResultObject *self,
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
168 PyObject *unused)
18
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
169 {
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
170 PyObject *arglist=NULL, *kwarglist=NULL;
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
171 PyObject *fields=NULL;
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
172 _mysql_FieldObject *field=NULL;
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
173 unsigned int i, n;
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
174
18
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
175 check_result_connection(self);
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
176 kwarglist = PyDict_New();
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
177 if (!kwarglist) goto error;
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
178 n = mysql_num_fields(self->result);
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
179 if (!(fields = PyTuple_New(n))) return NULL;
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
180 for (i=0; i<n; i++) {
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
181 arglist = Py_BuildValue("(Oi)", self, i);
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
182 if (!arglist) goto error;
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
183 field = MyAlloc(_mysql_FieldObject, _mysql_FieldObject_Type);
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
184 if (!field) goto error;
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
185 if (_mysql_FieldObject_Initialize(field, arglist, kwarglist))
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
186 goto error;
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
187 Py_DECREF(arglist);
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
188 PyTuple_SET_ITEM(fields, i, (PyObject *) field);
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
189 }
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
190 Py_DECREF(kwarglist);
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
191 return fields;
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
192 error:
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
193 Py_XDECREF(arglist);
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
194 Py_XDECREF(kwarglist);
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
195 Py_XDECREF(fields);
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
196 return NULL;
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
197 }
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
198
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
199 static char _mysql_ResultObject_field_flags__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
200 "Returns a tuple of field flags, one for each column in the result.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
201 " ;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
202
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
203 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
204 _mysql_ResultObject_field_flags(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
205 _mysql_ResultObject *self,
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
206 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
207 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
208 PyObject *d;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
209 MYSQL_FIELD *fields;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
210 unsigned int i, n;
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
211
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
212 check_result_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
213 n = mysql_num_fields(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
214 fields = mysql_fetch_fields(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
215 if (!(d = PyTuple_New(n))) return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
216 for (i=0; i<n; i++) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
217 PyObject *f;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
218 if (!(f = PyInt_FromLong((long)fields[i].flags))) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
219 PyTuple_SET_ITEM(d, i, f);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
220 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
221 return d;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
222 error:
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
223 Py_XDECREF(d);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
224 return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
225 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
226
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
227 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
228 _mysql_field_to_python(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
229 PyObject *converter,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
230 char *rowitem,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
231 unsigned long length)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
232 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
233 PyObject *v;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
234 if (rowitem) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
235 if (converter != Py_None)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
236 v = PyObject_CallFunction(converter,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
237 "s#",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
238 rowitem,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
239 (int)length);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
240 else
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
241 v = PyString_FromStringAndSize(rowitem,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
242 (int)length);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
243 if (!v)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
244 return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
245 } else {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
246 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
247 v = Py_None;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
248 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
249 return v;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
250 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
251
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
252 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
253 _mysql_row_to_tuple(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
254 _mysql_ResultObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
255 MYSQL_ROW row)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
256 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
257 unsigned int n, i;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
258 unsigned long *length;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
259 PyObject *r, *c;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
260
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
261 n = mysql_num_fields(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
262 if (!(r = PyTuple_New(n))) return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
263 length = mysql_fetch_lengths(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
264 for (i=0; i<n; i++) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
265 PyObject *v;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
266 c = PyTuple_GET_ITEM(self->converter, i);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
267 v = _mysql_field_to_python(c, row[i], length[i]);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
268 if (!v) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
269 PyTuple_SET_ITEM(r, i, v);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
270 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
271 return r;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
272 error:
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
273 Py_XDECREF(r);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
274 return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
275 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
276
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
277 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
278 _mysql_row_to_dict(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
279 _mysql_ResultObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
280 MYSQL_ROW row)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
281 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
282 unsigned int n, i;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
283 unsigned long *length;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
284 PyObject *r, *c;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
285 MYSQL_FIELD *fields;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
286
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
287 n = mysql_num_fields(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
288 if (!(r = PyDict_New())) return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
289 length = mysql_fetch_lengths(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
290 fields = mysql_fetch_fields(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
291 for (i=0; i<n; i++) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
292 PyObject *v;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
293 c = PyTuple_GET_ITEM(self->converter, i);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
294 v = _mysql_field_to_python(c, row[i], length[i]);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
295 if (!v) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
296 if (!PyMapping_HasKeyString(r, fields[i].name)) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
297 PyMapping_SetItemString(r, fields[i].name, v);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
298 } else {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
299 int len;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
300 char buf[256];
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
301 strncpy(buf, fields[i].table, 256);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
302 len = strlen(buf);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
303 strncat(buf, ".", 256-len);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
304 len = strlen(buf);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
305 strncat(buf, fields[i].name, 256-len);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
306 PyMapping_SetItemString(r, buf, v);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
307 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
308 Py_DECREF(v);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
309 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
310 return r;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
311 error:
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
312 Py_XDECREF(r);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
313 return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
314 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
315
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
316 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
317 _mysql_row_to_dict_old(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
318 _mysql_ResultObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
319 MYSQL_ROW row)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
320 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
321 unsigned int n, i;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
322 unsigned long *length;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
323 PyObject *r, *c;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
324 MYSQL_FIELD *fields;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
325
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
326 n = mysql_num_fields(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
327 if (!(r = PyDict_New())) return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
328 length = mysql_fetch_lengths(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
329 fields = mysql_fetch_fields(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
330 for (i=0; i<n; i++) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
331 PyObject *v;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
332 c = PyTuple_GET_ITEM(self->converter, i);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
333 v = _mysql_field_to_python(c, row[i], length[i]);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
334 if (!v) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
335 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
336 int len=0;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
337 char buf[256]="";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
338 if (strlen(fields[i].table)) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
339 strncpy(buf, fields[i].table, 256);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
340 len = strlen(buf);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
341 strncat(buf, ".", 256-len);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
342 len = strlen(buf);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
343 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
344 strncat(buf, fields[i].name, 256-len);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
345 PyMapping_SetItemString(r, buf, v);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
346 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
347 Py_DECREF(v);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
348 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
349 return r;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
350 error:
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
351 Py_XDECREF(r);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
352 return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
353 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
354
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
355 typedef PyObject *_PYFUNC(_mysql_ResultObject *, MYSQL_ROW);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
356
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
357 int
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
358 _mysql__fetch_row(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
359 _mysql_ResultObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
360 PyObject **r,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
361 int skiprows,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
362 int maxrows,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
363 _PYFUNC *convert_row)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
364 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
365 unsigned int i;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
366 MYSQL_ROW row;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
367
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
368 for (i = skiprows; i<(skiprows+maxrows); i++) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
369 PyObject *v;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
370 if (!self->use)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
371 row = mysql_fetch_row(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
372 else {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
373 Py_BEGIN_ALLOW_THREADS;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
374 row = mysql_fetch_row(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
375 Py_END_ALLOW_THREADS;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
376 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
377 if (!row && mysql_errno(&(((_mysql_ConnectionObject *)(self->conn))->connection))) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
378 _mysql_Exception((_mysql_ConnectionObject *)self->conn);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
379 goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
380 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
381 if (!row) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
382 if (MyTuple_Resize(r, i, 0) == -1) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
383 break;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
384 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
385 v = convert_row(self, row);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
386 if (!v) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
387 PyTuple_SET_ITEM(*r, i, v);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
388 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
389 return i-skiprows;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
390 error:
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
391 return -1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
392 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
393
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
394 static char _mysql_ResultObject_fetch_row__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
395 "fetch_row([maxrows, how]) -- Fetches up to maxrows as a tuple.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
396 The rows are formatted according to how:\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
397 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
398 0 -- tuples (default)\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
399 1 -- dictionaries, key=column or table.column if duplicated\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
400 2 -- dictionaries, key=table.column\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
401 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
402
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
403 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
404 _mysql_ResultObject_fetch_row(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
405 _mysql_ResultObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
406 PyObject *args,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
407 PyObject *kwargs)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
408 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
409 typedef PyObject *_PYFUNC(_mysql_ResultObject *, MYSQL_ROW);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
410 static char *kwlist[] = { "maxrows", "how", NULL };
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
411 static _PYFUNC *row_converters[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
412 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
413 _mysql_row_to_tuple,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
414 _mysql_row_to_dict,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
415 _mysql_row_to_dict_old
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
416 };
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
417 _PYFUNC *convert_row;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
418 unsigned int maxrows=1, how=0, skiprows=0, rowsadded;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
419 PyObject *r=NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
420
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
421 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ii:fetch_row", kwlist,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
422 &maxrows, &how))
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
423 return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
424 check_result_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
425 if (how < 0 || how >= sizeof(row_converters)) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
426 PyErr_SetString(PyExc_ValueError, "how out of range");
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
427 return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
428 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
429 convert_row = row_converters[how];
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
430 if (maxrows) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
431 if (!(r = PyTuple_New(maxrows))) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
432 rowsadded = _mysql__fetch_row(self, &r, skiprows, maxrows,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
433 convert_row);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
434 if (rowsadded == -1) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
435 } else {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
436 if (self->use) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
437 maxrows = 1000;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
438 if (!(r = PyTuple_New(maxrows))) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
439 while (1) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
440 rowsadded = _mysql__fetch_row(self, &r, skiprows,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
441 maxrows, convert_row);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
442 if (rowsadded == -1) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
443 skiprows += rowsadded;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
444 if (rowsadded < maxrows) break;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
445 if (MyTuple_Resize(&r, skiprows+maxrows, 0) == -1)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
446 goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
447 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
448 } else {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
449 /* XXX if overflow, maxrows<0? */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
450 maxrows = (int) mysql_num_rows(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
451 if (!(r = PyTuple_New(maxrows))) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
452 rowsadded = _mysql__fetch_row(self, &r, 0,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
453 maxrows, convert_row);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
454 if (rowsadded == -1) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
455 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
456 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
457 return r;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
458 error:
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
459 Py_XDECREF(r);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
460 return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
461 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
462
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
463
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
464 static char _mysql_ResultObject_num_fields__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
465 "Returns the number of fields (column) in the result." ;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
466
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
467 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
468 _mysql_ResultObject_num_fields(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
469 _mysql_ResultObject *self,
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
470 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
471 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
472 check_result_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
473 return PyInt_FromLong((long)mysql_num_fields(self->result));
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
474 }
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
475
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
476 static char _mysql_ResultObject_num_rows__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
477 "Returns the number of rows in the result set. Note that if\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
478 use=1, this will not return a valid value until the entire result\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
479 set has been read.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
480 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
481
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
482 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
483 _mysql_ResultObject_num_rows(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
484 _mysql_ResultObject *self,
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
485 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
486 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
487 check_result_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
488 return PyLong_FromUnsignedLongLong(mysql_num_rows(self->result));
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
489 }
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
490
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
491
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
492 static char _mysql_ResultObject_data_seek__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
493 "data_seek(n) -- seek to row n of result set";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
494 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
495 _mysql_ResultObject_data_seek(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
496 _mysql_ResultObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
497 PyObject *args)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
498 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
499 unsigned int row;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
500 if (!PyArg_ParseTuple(args, "i:data_seek", &row)) return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
501 check_result_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
502 mysql_data_seek(self->result, row);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
503 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
504 return Py_None;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
505 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
506
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
507 static char _mysql_ResultObject_row_seek__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
508 "row_seek(n) -- seek by offset n rows of result set";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
509 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
510 _mysql_ResultObject_row_seek(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
511 _mysql_ResultObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
512 PyObject *args)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
513 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
514 int offset;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
515 MYSQL_ROW_OFFSET r;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
516 if (!PyArg_ParseTuple(args, "i:row_seek", &offset)) return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
517 check_result_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
518 if (self->use) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
519 PyErr_SetString(_mysql_ProgrammingError,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
520 "cannot be used with connection.use_result()");
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
521 return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
522 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
523 r = mysql_row_tell(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
524 mysql_row_seek(self->result, r+offset);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
525 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
526 return Py_None;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
527 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
528
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
529 static char _mysql_ResultObject_row_tell__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
530 "row_tell() -- return the current row number of the result set.";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
531 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
532 _mysql_ResultObject_row_tell(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
533 _mysql_ResultObject *self,
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
534 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
535 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
536 MYSQL_ROW_OFFSET r;
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
537
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
538 check_result_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
539 if (self->use) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
540 PyErr_SetString(_mysql_ProgrammingError,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
541 "cannot be used with connection.use_result()");
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
542 return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
543 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
544 r = mysql_row_tell(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
545 return PyInt_FromLong(r-self->result->data->data);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
546 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
547
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
548 static void
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
549 _mysql_ResultObject_dealloc(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
550 _mysql_ResultObject *self)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
551 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
552 PyObject_GC_UnTrack((PyObject *)self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
553 mysql_free_result(self->result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
554 _mysql_ResultObject_clear(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
555 MyFree(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
556 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
557
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
558 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
559 _mysql_ResultObject_repr(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
560 _mysql_ResultObject *self)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
561 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
562 char buf[300];
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
563 sprintf(buf, "<_mysql.result object at %lx>",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
564 (long)self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
565 return PyString_FromString(buf);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
566 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
567
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
568 static PyMethodDef _mysql_ResultObject_methods[] = {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
569 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
570 "data_seek",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
571 (PyCFunction)_mysql_ResultObject_data_seek,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
572 METH_VARARGS,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
573 _mysql_ResultObject_data_seek__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
574 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
575 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
576 "row_seek",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
577 (PyCFunction)_mysql_ResultObject_row_seek,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
578 METH_VARARGS,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
579 _mysql_ResultObject_row_seek__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
580 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
581 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
582 "row_tell",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
583 (PyCFunction)_mysql_ResultObject_row_tell,
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
584 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
585 _mysql_ResultObject_row_tell__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
586 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
587 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
588 "describe",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
589 (PyCFunction)_mysql_ResultObject_describe,
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
590 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
591 _mysql_ResultObject_describe__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
592 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
593 {
18
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
594 "fields",
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
595 (PyCFunction)_mysql_ResultObject_fields,
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
596 METH_NOARGS,
18
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
597 _mysql_ResultObject_fields__doc__
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
598 },
d55bfb1a4701 Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents: 2
diff changeset
599 {
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
600 "fetch_row",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
601 (PyCFunction)_mysql_ResultObject_fetch_row,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
602 METH_VARARGS | METH_KEYWORDS,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
603 _mysql_ResultObject_fetch_row__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
604 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
605 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
606 "field_flags",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
607 (PyCFunction)_mysql_ResultObject_field_flags,
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
608 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
609 _mysql_ResultObject_field_flags__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
610 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
611 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
612 "num_fields",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
613 (PyCFunction)_mysql_ResultObject_num_fields,
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
614 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
615 _mysql_ResultObject_num_fields__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
616 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
617 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
618 "num_rows",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
619 (PyCFunction)_mysql_ResultObject_num_rows,
26
9863f08a337c Last of the METH_NOARGS conversions.
kylev
parents: 18
diff changeset
620 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
621 _mysql_ResultObject_num_rows__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
622 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
623 {NULL, NULL} /* sentinel */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
624 };
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
625
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
626 static MyMemberlist(_mysql_ResultObject_memberlist)[] = {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
627 MyMember(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
628 "converter",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
629 T_OBJECT,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
630 offsetof(_mysql_ResultObject,converter),
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
631 RO,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
632 "Type conversion mapping"
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
633 ),
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
634 {NULL} /* Sentinel */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
635 };
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
636
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
637 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
638 _mysql_ResultObject_getattr(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
639 _mysql_ResultObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
640 char *name)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
641 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
642 PyObject *res;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
643
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
644 res = Py_FindMethod(_mysql_ResultObject_methods, (PyObject *)self, name);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
645 if (res != NULL)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
646 return res;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
647 PyErr_Clear();
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
648 #if PY_VERSION_HEX < 0x02020000
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
649 return PyMember_Get((char *)self, _mysql_ResultObject_memberlist, name);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
650 #else
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
651 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
652 MyMemberlist(*l);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
653 for (l = _mysql_ResultObject_memberlist; l->name != NULL; l++) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
654 if (strcmp(l->name, name) == 0)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
655 return PyMember_GetOne((char *)self, l);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
656 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
657 PyErr_SetString(PyExc_AttributeError, name);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
658 return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
659 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
660 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
661 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
662
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
663 static int
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
664 _mysql_ResultObject_setattr(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
665 _mysql_ResultObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
666 char *name,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
667 PyObject *v)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
668 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
669 if (v == NULL) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
670 PyErr_SetString(PyExc_AttributeError,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
671 "can't delete connection attributes");
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
672 return -1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
673 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
674 #if PY_VERSION_HEX < 0x02020000
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
675 return PyMember_Set((char *)self, _mysql_ResultObject_memberlist, name, v);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
676 #else
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
677 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
678 MyMemberlist(*l);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
679 for (l = _mysql_ResultObject_memberlist; l->name != NULL; l++)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
680 if (strcmp(l->name, name) == 0)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
681 return PyMember_SetOne((char *)self, l, v);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
682 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
683 PyErr_SetString(PyExc_AttributeError, name);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
684 return -1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
685 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
686 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
687
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
688 PyTypeObject _mysql_ResultObject_Type = {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
689 PyObject_HEAD_INIT(NULL)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
690 0,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
691 "_mysql.result",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
692 sizeof(_mysql_ResultObject),
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
693 0,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
694 (destructor)_mysql_ResultObject_dealloc, /* tp_dealloc */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
695 0, /*tp_print*/
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
696 (getattrfunc)_mysql_ResultObject_getattr, /* tp_getattr */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
697 (setattrfunc)_mysql_ResultObject_setattr, /* tp_setattr */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
698 0, /*tp_compare*/
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
699 (reprfunc)_mysql_ResultObject_repr, /* tp_repr */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
700
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
701 /* Method suites for standard classes */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
702
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
703 0, /* (PyNumberMethods *) tp_as_number */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
704 0, /* (PySequenceMethods *) tp_as_sequence */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
705 0, /* (PyMappingMethods *) tp_as_mapping */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
706
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
707 /* More standard operations (here for binary compatibility) */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
708
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
709 0, /* (hashfunc) tp_hash */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
710 0, /* (ternaryfunc) tp_call */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
711 0, /* (reprfunc) tp_str */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
712 0, /* (getattrofunc) tp_getattro */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
713 0, /* (setattrofunc) tp_setattro */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
714
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
715 /* Functions to access object as input/output buffer */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
716 0, /* (PyBufferProcs *) tp_as_buffer */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
717
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
718 /* Flags to define presence of optional/expanded features */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
719 #if PY_VERSION_HEX < 0x02020000
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
720 Py_TPFLAGS_DEFAULT, /* (long) tp_flags */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
721 #else
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
722 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
723 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
724
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
725 _mysql_ResultObject__doc__, /* (char *) tp_doc Documentation string */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
726 #if PY_VERSION_HEX >= 0x02000000
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
727 /* Assigned meaning in release 2.0 */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
728 #if PY_VERSION_HEX >= 0x02020000
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
729 /* call function for all accessible objects */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
730 (traverseproc) _mysql_ResultObject_traverse, /* tp_traverse */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
731
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
732 /* delete references to contained objects */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
733 (inquiry) _mysql_ResultObject_clear, /* tp_clear */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
734 #else
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
735 /* not supporting pre-2.2 GC */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
736 0,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
737 0,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
738 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
739 #if PY_VERSION_HEX >= 0x02010000
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
740 /* Assigned meaning in release 2.1 */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
741 /* rich comparisons */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
742 0, /* (richcmpfunc) tp_richcompare */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
743
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
744 /* weak reference enabler */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
745 0, /* (long) tp_weaklistoffset */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
746 #if PY_VERSION_HEX >= 0x02020000
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
747 /* Added in release 2.2 */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
748 /* Iterators */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
749 0, /* (getiterfunc) tp_iter */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
750 0, /* (iternextfunc) tp_iternext */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
751
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
752 /* Attribute descriptor and subclassing stuff */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
753 (struct PyMethodDef *) _mysql_ResultObject_methods, /* tp_methods */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
754 (MyMemberlist(*)) _mysql_ResultObject_memberlist, /*tp_members */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
755 0, /* (struct getsetlist *) tp_getset; */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
756 0, /* (struct _typeobject *) tp_base; */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
757 0, /* (PyObject *) tp_dict */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
758 0, /* (descrgetfunc) tp_descr_get */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
759 0, /* (descrsetfunc) tp_descr_set */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
760 0, /* (long) tp_dictoffset */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
761 (initproc)_mysql_ResultObject_Initialize, /* tp_init */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
762 NULL, /* tp_alloc */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
763 NULL, /* tp_new */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
764 NULL, /* tp_free Low-level free-memory routine */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
765 0, /* (PyObject *) tp_bases */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
766 0, /* (PyObject *) tp_mro method resolution order */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
767 0, /* (PyObject *) tp_defined */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
768 #endif /* python 2.2 */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
769 #endif /* python 2.1 */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
770 #endif /* python 2.0 */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
771 };