annotate _mysql_results.c @ 54:6e31278d3433 MySQLdb

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