annotate _mysql_connections.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 fdf0cabb27be
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1 /* -*- mode: C; indent-tabs-mode: t; c-basic-offset: 8; -*- */
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
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 int
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
6 _mysql_ConnectionObject_Initialize(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
7 _mysql_ConnectionObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
8 PyObject *args,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
9 PyObject *kwargs)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
10 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
11 MYSQL *conn = NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
12 PyObject *conv = NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
13 PyObject *ssl = NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
14 #if HAVE_OPENSSL
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
15 char *key = NULL, *cert = NULL, *ca = NULL,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
16 *capath = NULL, *cipher = NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
17 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
18 char *host = NULL, *user = NULL, *passwd = NULL,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
19 *db = NULL, *unix_socket = NULL;
21
bb552e789992 Fix #1808476
adustman
parents: 5
diff changeset
20 unsigned int port = 0;
bb552e789992 Fix #1808476
adustman
parents: 5
diff changeset
21 unsigned int client_flag = 0;
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
22 static char *kwlist[] = { "host", "user", "passwd", "db", "port",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
23 "unix_socket", "conv",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
24 "connect_timeout", "compress",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
25 "named_pipe", "init_command",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
26 "read_default_file", "read_default_group",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
27 "client_flag", "ssl",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
28 "local_infile",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
29 NULL } ;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
30 int connect_timeout = 0;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
31 int compress = -1, named_pipe = -1, local_infile = -1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
32 char *init_command=NULL,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
33 *read_default_file=NULL,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
34 *read_default_group=NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
35
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
36 self->converter = NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
37 self->open = 0;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
38 check_server_init(-1);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
39 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ssssisOiiisssiOi:connect",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
40 kwlist,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
41 &host, &user, &passwd, &db,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
42 &port, &unix_socket, &conv,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
43 &connect_timeout,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
44 &compress, &named_pipe,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
45 &init_command, &read_default_file,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
46 &read_default_group,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
47 &client_flag, &ssl,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
48 &local_infile
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
49 ))
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
50 return -1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
51
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
52 /* Keep the converter mapping or a blank mapping dict */
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
53 if (!conv)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
54 conv = PyDict_New();
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
55 else
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
56 Py_INCREF(conv);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
57 if (!conv)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
58 return -1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
59 self->converter = conv;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
60
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
61 #define _stringsuck(d,t,s) {t=PyMapping_GetItemString(s,#d);\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
62 if(t){d=PyString_AsString(t);Py_DECREF(t);}\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
63 PyErr_Clear();}
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
64
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
65 if (ssl) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
66 #if HAVE_OPENSSL
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
67 PyObject *value = NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
68 _stringsuck(ca, value, ssl);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
69 _stringsuck(capath, value, ssl);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
70 _stringsuck(cert, value, ssl);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
71 _stringsuck(key, value, ssl);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
72 _stringsuck(cipher, value, ssl);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
73 #else
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
74 PyErr_SetString(_mysql_NotSupportedError,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
75 "client library does not have SSL support");
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
76 return -1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
77 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
78 }
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 Py_BEGIN_ALLOW_THREADS ;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
81 conn = mysql_init(&(self->connection));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
82 if (connect_timeout) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
83 unsigned int timeout = connect_timeout;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
84 mysql_options(&(self->connection), MYSQL_OPT_CONNECT_TIMEOUT,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
85 (char *)&timeout);
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 (compress != -1) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
88 mysql_options(&(self->connection), MYSQL_OPT_COMPRESS, 0);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
89 client_flag |= CLIENT_COMPRESS;
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 (named_pipe != -1)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
92 mysql_options(&(self->connection), MYSQL_OPT_NAMED_PIPE, 0);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
93 if (init_command != NULL)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
94 mysql_options(&(self->connection), MYSQL_INIT_COMMAND, init_command);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
95 if (read_default_file != NULL)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
96 mysql_options(&(self->connection), MYSQL_READ_DEFAULT_FILE, read_default_file);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
97 if (read_default_group != NULL)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
98 mysql_options(&(self->connection), MYSQL_READ_DEFAULT_GROUP, read_default_group);
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 if (local_infile != -1)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
101 mysql_options(&(self->connection), MYSQL_OPT_LOCAL_INFILE, (char *) &local_infile);
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 #if HAVE_OPENSSL
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
104 if (ssl)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
105 mysql_ssl_set(&(self->connection),
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
106 key, cert, ca, capath, cipher);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
107 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
108
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
109 conn = mysql_real_connect(&(self->connection), host, user, passwd, db,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
110 port, unix_socket, client_flag);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
111
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
112 Py_END_ALLOW_THREADS ;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
113
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
114 if (!conn) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
115 _mysql_Exception(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
116 return -1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
117 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
118 /*
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
119 PyType_GenericAlloc() automatically sets up GC allocation and
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
120 tracking for GC objects, at least in 2.2.1, so it does not need to
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
121 be done here. tp_dealloc still needs to call PyObject_GC_UnTrack(),
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
122 however.
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
123 */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
124 self->open = 1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
125 return 0;
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
2
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
128 char _mysql_connect__doc__[] =
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
129 "Returns a MYSQL connection object. Exclusive use of\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
130 keyword parameters strongly recommended. Consult the\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
131 MySQL C API documentation for more details.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
132 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
133 host\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
134 string, host to connect\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
135 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
136 user\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
137 string, user to connect as\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
138 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
139 passwd\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
140 string, password to use\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
141 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
142 db\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
143 string, database to use\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
144 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
145 port\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
146 integer, TCP/IP port to connect to\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
147 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
148 unix_socket\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
149 string, location of unix_socket (UNIX-ish only)\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
150 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
151 conv\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
152 mapping, maps MySQL FIELD_TYPE.* to Python functions which\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
153 convert a string to the appropriate Python type\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
154 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
155 connect_timeout\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
156 number of seconds to wait before the connection\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
157 attempt fails.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
158 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
159 compress\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
160 if set, gzip compression is enabled\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
161 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
162 named_pipe\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
163 if set, connect to server via named pipe (Windows only)\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
164 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
165 init_command\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
166 command which is run once the connection is created\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
167 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
168 read_default_file\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
169 see the MySQL documentation for mysql_options()\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
170 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
171 read_default_group\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
172 see the MySQL documentation for mysql_options()\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
173 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
174 client_flag\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
175 client flags from MySQLdb.constants.CLIENT\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
176 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
177 load_infile\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
178 int, non-zero enables LOAD LOCAL INFILE, zero disables\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
179 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
180 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
181
2
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
182 PyObject *
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
183 _mysql_connect(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
184 PyObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
185 PyObject *args,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
186 PyObject *kwargs)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
187 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
188 _mysql_ConnectionObject *c=NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
189
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
190 c = MyAlloc(_mysql_ConnectionObject, _mysql_ConnectionObject_Type);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
191 if (c == NULL) return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
192 if (_mysql_ConnectionObject_Initialize(c, args, kwargs)) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
193 Py_DECREF(c);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
194 c = NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
195 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
196 return (PyObject *) c;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
197 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
198
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
199 static int _mysql_ConnectionObject_traverse(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
200 _mysql_ConnectionObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
201 visitproc visit,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
202 void *arg)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
203 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
204 if (self->converter)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
205 return visit(self->converter, arg);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
206 return 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
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
209 static int _mysql_ConnectionObject_clear(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
210 _mysql_ConnectionObject *self)
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 Py_XDECREF(self->converter);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
213 self->converter = NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
214 return 0;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
215 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
216
2
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
217 extern PyObject *
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
218 _escape_item(
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
219 PyObject *item,
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
220 PyObject *d);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
221
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
222 char _mysql_escape__doc__[] =
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
223 "escape(obj, dict) -- escape any special characters in object obj\n\
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
224 using mapping dict to provide quoting functions for each type.\n\
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
225 Returns a SQL literal string.";
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
226 PyObject *
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
227 _mysql_escape(
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
228 PyObject *self,
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
229 PyObject *args)
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
230 {
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
231 PyObject *o=NULL, *d=NULL;
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
232 if (!PyArg_ParseTuple(args, "O|O:escape", &o, &d))
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
233 return NULL;
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
234 if (d) {
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
235 if (!PyMapping_Check(d)) {
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
236 PyErr_SetString(PyExc_TypeError,
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
237 "argument 2 must be a mapping");
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
238 return NULL;
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
239 }
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
240 return _escape_item(o, d);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
241 } else {
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
242 if (!self) {
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
243 PyErr_SetString(PyExc_TypeError,
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
244 "argument 2 must be a mapping");
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
245 return NULL;
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
246 }
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
247 return _escape_item(o,
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
248 ((_mysql_ConnectionObject *) self)->converter);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
249 }
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
250 }
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
251
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
252 char _mysql_escape_string__doc__[] =
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
253 "escape_string(s) -- quote any SQL-interpreted characters in string s.\n\
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
254 \n\
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
255 Use connection.escape_string(s), if you use it at all.\n\
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
256 _mysql.escape_string(s) cannot handle character sets. You are\n\
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
257 probably better off using connection.escape(o) instead, since\n\
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
258 it will escape entire sequences as well as strings.";
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
259
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
260 PyObject *
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
261 _mysql_escape_string(
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
262 _mysql_ConnectionObject *self,
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
263 PyObject *args)
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
264 {
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
265 PyObject *str;
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
266 char *in, *out;
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
267 int len, size;
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
268 if (!PyArg_ParseTuple(args, "s#:escape_string", &in, &size)) return NULL;
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
269 str = PyString_FromStringAndSize((char *) NULL, size*2+1);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
270 if (!str) return PyErr_NoMemory();
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
271 out = PyString_AS_STRING(str);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
272 #if MYSQL_VERSION_ID < 32321
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
273 len = mysql_escape_string(out, in, size);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
274 #else
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
275 check_server_init(NULL);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
276 if (self && self->open)
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
277 len = mysql_real_escape_string(&(self->connection), out, in, size);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
278 else
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
279 len = mysql_escape_string(out, in, size);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
280 #endif
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
281 if (_PyString_Resize(&str, len) < 0) return NULL;
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
282 return (str);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
283 }
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
284
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
285 char _mysql_string_literal__doc__[] =
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
286 "string_literal(obj) -- converts object obj into a SQL string literal.\n\
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
287 This means, any special SQL characters are escaped, and it is enclosed\n\
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
288 within single quotes. In other words, it performs:\n\
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
289 \n\
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
290 \"'%s'\" % escape_string(str(obj))\n\
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
291 \n\
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
292 Use connection.string_literal(obj), if you use it at all.\n\
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
293 _mysql.string_literal(obj) cannot handle character sets.";
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
294
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
295 PyObject *
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
296 _mysql_string_literal(
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
297 _mysql_ConnectionObject *self,
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
298 PyObject *args)
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
299 {
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
300 PyObject *str, *s, *o, *d;
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
301 char *in, *out;
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
302 int len, size;
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
303 if (!PyArg_ParseTuple(args, "O|O:string_literal", &o, &d)) return NULL;
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
304 s = PyObject_Str(o);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
305 if (!s) return NULL;
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
306 in = PyString_AsString(s);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
307 size = PyString_GET_SIZE(s);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
308 str = PyString_FromStringAndSize((char *) NULL, size*2+3);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
309 if (!str) return PyErr_NoMemory();
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
310 out = PyString_AS_STRING(str);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
311 #if MYSQL_VERSION_ID < 32321
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
312 len = mysql_escape_string(out+1, in, size);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
313 #else
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
314 check_server_init(NULL);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
315 if (self && self->open)
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
316 len = mysql_real_escape_string(&(self->connection), out+1, in, size);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
317 else
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
318 len = mysql_escape_string(out+1, in, size);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
319 #endif
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
320 *out = *(out+len+1) = '\'';
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
321 if (_PyString_Resize(&str, len+2) < 0) return NULL;
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
322 Py_DECREF(s);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
323 return (str);
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
324 }
c0d1fc0429ce Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents: 1
diff changeset
325
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
326 static char _mysql_ConnectionObject_close__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
327 "Close the connection. No further activity possible.";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
328
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
329 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
330 _mysql_ConnectionObject_close(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
331 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
332 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
333 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
334 if (self->open) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
335 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
336 mysql_close(&(self->connection));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
337 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
338 self->open = 0;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
339 } else {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
340 PyErr_SetString(_mysql_ProgrammingError,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
341 "closing a closed connection");
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
342 return NULL;
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 _mysql_ConnectionObject_clear(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
345 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
346 return Py_None;
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
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
349 static char _mysql_ConnectionObject_affected_rows__doc__ [] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
350 "Return number of rows affected by the last query.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
351 Non-standard. Use Cursor.rowcount.\n\
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
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
354 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
355 _mysql_ConnectionObject_affected_rows(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
356 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
357 PyObject *unused)
0
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 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
360 return PyLong_FromUnsignedLongLong(mysql_affected_rows(&(self->connection)));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
361 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
362
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
363 static char _mysql_ConnectionObject_dump_debug_info__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
364 "Instructs the server to write some debug information to the\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
365 log. The connected user must have the process privilege for\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
366 this to work. Non-standard.\n\
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
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
369 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
370 _mysql_ConnectionObject_dump_debug_info(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
371 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
372 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
373 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
374 int err;
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
375
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
376 check_connection(self);
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 err = mysql_dump_debug_info(&(self->connection));
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 if (err) return _mysql_Exception(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
381 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
382 return Py_None;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
383 }
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 static char _mysql_ConnectionObject_autocommit__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
386 "Set the autocommit mode. True values enable; False value disable.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
387 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
388 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
389 _mysql_ConnectionObject_autocommit(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
390 _mysql_ConnectionObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
391 PyObject *args)
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 int flag, err;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
394 if (!PyArg_ParseTuple(args, "i", &flag)) return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
395 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
396 #if MYSQL_VERSION_ID >= 40100
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
397 err = mysql_autocommit(&(self->connection), flag);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
398 #else
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
399 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
400 char query[256];
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
401 snprintf(query, 256, "SET AUTOCOMMIT=%d", flag);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
402 err = mysql_query(&(self->connection), query);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
403 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
404 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
405 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
406 if (err) return _mysql_Exception(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
407 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
408 return Py_None;
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
409 }
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
410
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
411 static char _mysql_ConnectionObject_commit__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
412 "Commits the current transaction\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
413 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
414 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
415 _mysql_ConnectionObject_commit(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
416 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
417 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
418 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
419 int err;
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
420
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
421 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
422 #if MYSQL_VERSION_ID >= 40100
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
423 err = mysql_commit(&(self->connection));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
424 #else
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
425 err = mysql_query(&(self->connection), "COMMIT");
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
426 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
427 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
428 if (err) return _mysql_Exception(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
429 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
430 return Py_None;
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
431 }
0
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 static char _mysql_ConnectionObject_rollback__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
434 "Rolls backs the current transaction\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
435 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
436 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
437 _mysql_ConnectionObject_rollback(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
438 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
439 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
440 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
441 int err;
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
442
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
443 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
444 #if MYSQL_VERSION_ID >= 40100
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
445 err = mysql_rollback(&(self->connection));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
446 #else
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
447 err = mysql_query(&(self->connection), "ROLLBACK");
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
448 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
449 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
450 if (err) return _mysql_Exception(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
451 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
452 return Py_None;
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
453 }
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
454
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
455 static char _mysql_ConnectionObject_next_result__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
456 "If more query results exist, next_result() reads the next query\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
457 results and returns the status back to application.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
458 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
459 After calling next_result() the state of the connection is as if\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
460 you had called query() for the next query. This means that you can\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
461 now call store_result(), warning_count(), affected_rows()\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
462 , and so forth. \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
463 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
464 Returns 0 if there are more results; -1 if there are no more results\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
465 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
466 Non-standard.\n\
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 PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
469 _mysql_ConnectionObject_next_result(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
470 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
471 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
472 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
473 int err;
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
474
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
475 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
476 #if MYSQL_VERSION_ID >= 40100
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
477 err = mysql_next_result(&(self->connection));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
478 #else
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
479 err = -1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
480 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
481 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
482 if (err > 0) return _mysql_Exception(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
483 return PyInt_FromLong(err);
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
484 }
0
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 #if MYSQL_VERSION_ID >= 40100
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
487
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
488 static char _mysql_ConnectionObject_set_server_option__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
489 "set_server_option(option) -- Enables or disables an option\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
490 for the connection.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
491 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
492 Non-standard.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
493 ";
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_ConnectionObject_set_server_option(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
496 _mysql_ConnectionObject *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 int err, flags=0;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
500 if (!PyArg_ParseTuple(args, "i", &flags))
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
501 return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
502 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
503 err = mysql_set_server_option(&(self->connection), flags);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
504 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
505 if (err) return _mysql_Exception(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
506 return PyInt_FromLong(err);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
507 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
508
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
509 static char _mysql_ConnectionObject_sqlstate__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
510 "Returns a string containing the SQLSTATE error code\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
511 for the last error. The error code consists of five characters.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
512 '00000' means \"no error.\" The values are specified by ANSI SQL\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
513 and ODBC. For a list of possible values, see section 23\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
514 Error Handling in MySQL in the MySQL Manual.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
515 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
516 Note that not all MySQL errors are yet mapped to SQLSTATE's.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
517 The value 'HY000' (general error) is used for unmapped errors.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
518 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
519 Non-standard.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
520 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
521 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
522 _mysql_ConnectionObject_sqlstate(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
523 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
524 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
525 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
526 return PyString_FromString(mysql_sqlstate(&(self->connection)));
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
527 }
0
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_ConnectionObject_warning_count__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
530 "Returns the number of warnings generated during execution\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
531 of the previous SQL statement.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
532 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
533 Non-standard.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
534 ";
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_ConnectionObject_warning_count(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
537 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
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 return PyInt_FromLong(mysql_warning_count(&(self->connection)));
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
541 }
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
542
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
543 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
544
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
545 static char _mysql_ConnectionObject_errno__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
546 "Returns the error code for the most recently invoked API function\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
547 that can succeed or fail. A return value of zero means that no error\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
548 occurred.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
549 ";
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 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
552 _mysql_ConnectionObject_errno(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
553 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
554 PyObject *unused)
0
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 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
557 return PyInt_FromLong((long)mysql_errno(&(self->connection)));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
558 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
559
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
560 static char _mysql_ConnectionObject_error__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
561 "Returns the error message for the most recently invoked API function\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
562 that can succeed or fail. An empty string ("") is returned if no error\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
563 occurred.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
564 ";
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 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
567 _mysql_ConnectionObject_error(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
568 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
569 PyObject *unused)
0
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 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
572 return PyString_FromString(mysql_error(&(self->connection)));
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
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
575 #if MYSQL_VERSION_ID >= 32303
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
576
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
577 static char _mysql_ConnectionObject_change_user__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
578 "Changes the user and causes the database specified by db to\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
579 become the default (current) database on the connection\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
580 specified by mysql. In subsequent queries, this database is\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
581 the default for table references that do not include an\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
582 explicit database specifier.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
583 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
584 This function was introduced in MySQL Version 3.23.3.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
585 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
586 Fails unless the connected user can be authenticated or if he\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
587 doesn't have permission to use the database. In this case the\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
588 user and database are not changed.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
589 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
590 The db parameter may be set to None if you don't want to have\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
591 a default database.\n\
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
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
594 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
595 _mysql_ConnectionObject_change_user(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
596 _mysql_ConnectionObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
597 PyObject *args,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
598 PyObject *kwargs)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
599 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
600 char *user, *pwd=NULL, *db=NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
601 int r;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
602 static char *kwlist[] = { "user", "passwd", "db", NULL } ;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
603
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
604 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|ss:change_user",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
605 kwlist, &user, &pwd, &db))
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
606 return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
607 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
608 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
609 r = mysql_change_user(&(self->connection), user, pwd, db);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
610 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
611 if (r) return _mysql_Exception(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
612 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
613 return Py_None;
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 #endif
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 static char _mysql_ConnectionObject_character_set_name__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
618 "Returns the default character set for the current connection.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
619 Non-standard.\n\
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 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
623 _mysql_ConnectionObject_character_set_name(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
624 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
625 PyObject *unused)
0
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 const char *s;
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
628
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
629 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
630 #if MYSQL_VERSION_ID >= 32321
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
631 s = mysql_character_set_name(&(self->connection));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
632 #else
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
633 s = "latin1";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
634 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
635 return PyString_FromString(s);
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
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
638 #if MYSQL_VERSION_ID >= 50007
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
639 static char _mysql_ConnectionObject_set_character_set__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
640 "Sets the default character set for the current connection.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
641 Non-standard.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
642 ";
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 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
645 _mysql_ConnectionObject_set_character_set(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
646 _mysql_ConnectionObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
647 PyObject *args)
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 const char *s;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
650 int err;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
651 if (!PyArg_ParseTuple(args, "s", &s)) return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
652 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
653 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
654 err = mysql_set_character_set(&(self->connection), s);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
655 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
656 if (err) return _mysql_Exception(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
657 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
658 return Py_None;
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 #if MYSQL_VERSION_ID >= 50010
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
663 static char _mysql_ConnectionObject_get_character_set_info__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
664 "Returns a dict with information about the current character set:\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
665 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
666 collation\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
667 collation name\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
668 name\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
669 character set name\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
670 comment\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
671 comment or descriptive name\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
672 dir\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
673 character set directory\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
674 mbminlen\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
675 min. length for multibyte string\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
676 mbmaxlen\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
677 max. length for multibyte string\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
678 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
679 Not all keys may be present, particularly dir.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
680 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
681 Non-standard.\n\
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
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
684 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
685 _mysql_ConnectionObject_get_character_set_info(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
686 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
687 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
688 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
689 PyObject *result;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
690 MY_CHARSET_INFO cs;
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
691
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
692 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
693 mysql_get_character_set_info(&(self->connection), &cs);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
694 if (!(result = PyDict_New())) return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
695 if (cs.csname)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
696 PyDict_SetItemString(result, "name", PyString_FromString(cs.csname));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
697 if (cs.name)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
698 PyDict_SetItemString(result, "collation", PyString_FromString(cs.name));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
699 if (cs.comment)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
700 PyDict_SetItemString(result, "comment", PyString_FromString(cs.comment));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
701 if (cs.dir)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
702 PyDict_SetItemString(result, "dir", PyString_FromString(cs.dir));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
703 PyDict_SetItemString(result, "mbminlen", PyInt_FromLong(cs.mbminlen));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
704 PyDict_SetItemString(result, "mbmaxlen", PyInt_FromLong(cs.mbmaxlen));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
705 return result;
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 #endif
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 static char _mysql_ConnectionObject_get_host_info__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
710 "Returns a string that represents the MySQL client library\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
711 version. Non-standard.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
712 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
713
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
714 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
715 _mysql_ConnectionObject_get_host_info(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
716 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
717 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
718 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
719 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
720 return PyString_FromString(mysql_get_host_info(&(self->connection)));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
721 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
722
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
723 static char _mysql_ConnectionObject_get_proto_info__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
724 "Returns an unsigned integer representing the protocol version\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
725 used by the current connection. Non-standard.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
726 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
727
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
728 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
729 _mysql_ConnectionObject_get_proto_info(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
730 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
731 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
732 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
733 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
734 return PyInt_FromLong((long)mysql_get_proto_info(&(self->connection)));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
735 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
736
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
737 static char _mysql_ConnectionObject_get_server_info__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
738 "Returns a string that represents the server version number.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
739 Non-standard.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
740 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
741
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
742 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
743 _mysql_ConnectionObject_get_server_info(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
744 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
745 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
746 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
747 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
748 return PyString_FromString(mysql_get_server_info(&(self->connection)));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
749 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
750
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
751 static char _mysql_ConnectionObject_info__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
752 "Retrieves a string providing information about the most\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
753 recently executed query. Non-standard. Use messages or\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
754 Cursor.messages.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
755 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
756
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
757 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
758 _mysql_ConnectionObject_info(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
759 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
760 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
761 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
762 const char *s;
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
763
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
764 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
765 s = mysql_info(&(self->connection));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
766 if (s) return PyString_FromString(s);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
767 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
768 return Py_None;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
769 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
770
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
771 static char _mysql_ConnectionObject_insert_id__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
772 "Returns the ID generated for an AUTO_INCREMENT column by the previous\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
773 query. Use this function after you have performed an INSERT query into a\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
774 table that contains an AUTO_INCREMENT field.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
775 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
776 Note that this returns 0 if the previous query does not\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
777 generate an AUTO_INCREMENT value. If you need to save the value for\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
778 later, be sure to call this immediately after the query\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
779 that generates the value.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
780 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
781 The ID is updated after INSERT and UPDATE statements that generate\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
782 an AUTO_INCREMENT value or that set a column value to\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
783 LAST_INSERT_ID(expr). See section 6.3.5.2 Miscellaneous Functions\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
784 in the MySQL documentation.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
785 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
786 Also note that the value of the SQL LAST_INSERT_ID() function always\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
787 contains the most recently generated AUTO_INCREMENT value, and is not\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
788 reset between queries because the value of that function is maintained\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
789 in the server.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
790 " ;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
791
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
792 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
793 _mysql_ConnectionObject_insert_id(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
794 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
795 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
796 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
797 my_ulonglong r;
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
798
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
799 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
800 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
801 r = mysql_insert_id(&(self->connection));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
802 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
803 return PyLong_FromUnsignedLongLong(r);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
804 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
805
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
806 static char _mysql_ConnectionObject_kill__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
807 "Asks the server to kill the thread specified by pid.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
808 Non-standard.";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
809
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
810 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
811 _mysql_ConnectionObject_kill(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
812 _mysql_ConnectionObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
813 PyObject *args)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
814 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
815 unsigned long pid;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
816 int r;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
817 if (!PyArg_ParseTuple(args, "i:kill", &pid)) return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
818 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
819 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
820 r = mysql_kill(&(self->connection), pid);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
821 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
822 if (r) return _mysql_Exception(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
823 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
824 return Py_None;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
825 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
826
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
827 static char _mysql_ConnectionObject_field_count__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
828 "Returns the number of columns for the most recent query on the\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
829 connection. Non-standard. Will probably give you bogus results\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
830 on most cursor classes. Use Cursor.rowcount.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
831 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
832
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
833 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
834 _mysql_ConnectionObject_field_count(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
835 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
836 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
837 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
838 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
839 #if MYSQL_VERSION_ID < 32224
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
840 return PyInt_FromLong((long)mysql_num_fields(&(self->connection)));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
841 #else
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
842 return PyInt_FromLong((long)mysql_field_count(&(self->connection)));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
843 #endif
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
844 }
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
845
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
846 static char _mysql_ConnectionObject_ping__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
847 "Checks whether or not the connection to the server is\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
848 working. If it has gone down, an automatic reconnection is\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
849 attempted.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
850 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
851 This function can be used by clients that remain idle for a\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
852 long while, to check whether or not the server has closed the\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
853 connection and reconnect if necessary.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
854 \n\
5
b70cce9bd065 Merge changes from 1.2 branch r456-468
adustman
parents: 2
diff changeset
855 New in 1.2.2: Accepts an optional reconnect parameter. If True,\n\
b70cce9bd065 Merge changes from 1.2 branch r456-468
adustman
parents: 2
diff changeset
856 then the client will attempt reconnection. Note that this setting\n\
b70cce9bd065 Merge changes from 1.2 branch r456-468
adustman
parents: 2
diff changeset
857 is persistent. By default, this is on in MySQL<5.0.3, and off\n\
b70cce9bd065 Merge changes from 1.2 branch r456-468
adustman
parents: 2
diff changeset
858 thereafter.\n\
b70cce9bd065 Merge changes from 1.2 branch r456-468
adustman
parents: 2
diff changeset
859 \n\
b70cce9bd065 Merge changes from 1.2 branch r456-468
adustman
parents: 2
diff changeset
860 Non-standard. You should assume that ping() performs an\n\
b70cce9bd065 Merge changes from 1.2 branch r456-468
adustman
parents: 2
diff changeset
861 implicit rollback; use only when starting a new transaction.\n\
b70cce9bd065 Merge changes from 1.2 branch r456-468
adustman
parents: 2
diff changeset
862 You have been warned.\n\
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
863 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
864
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
865 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
866 _mysql_ConnectionObject_ping(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
867 _mysql_ConnectionObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
868 PyObject *args)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
869 {
5
b70cce9bd065 Merge changes from 1.2 branch r456-468
adustman
parents: 2
diff changeset
870 int r, reconnect = -1;
b70cce9bd065 Merge changes from 1.2 branch r456-468
adustman
parents: 2
diff changeset
871 if (!PyArg_ParseTuple(args, "|I", &reconnect)) return NULL;
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
872 check_connection(self);
5
b70cce9bd065 Merge changes from 1.2 branch r456-468
adustman
parents: 2
diff changeset
873 if ( reconnect != -1 ) self->connection.reconnect = reconnect;
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
874 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
875 r = mysql_ping(&(self->connection));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
876 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
877 if (r) return _mysql_Exception(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
878 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
879 return Py_None;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
880 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
881
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
882 static char _mysql_ConnectionObject_query__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
883 "Execute a query. store_result() or use_result() will get the\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
884 result set, if any. Non-standard. Use cursor() to create a cursor,\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
885 then cursor.execute().\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
886 " ;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
887
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
888 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
889 _mysql_ConnectionObject_query(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
890 _mysql_ConnectionObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
891 PyObject *args)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
892 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
893 char *query;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
894 int len, r;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
895 if (!PyArg_ParseTuple(args, "s#:query", &query, &len)) return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
896 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
897 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
898 r = mysql_real_query(&(self->connection), query, len);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
899 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
900 if (r) return _mysql_Exception(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
901 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
902 return Py_None;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
903 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
904
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
905
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
906 static char _mysql_ConnectionObject_select_db__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
907 "Causes the database specified by db to become the default\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
908 (current) database on the connection specified by mysql. In subsequent\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
909 queries, this database is the default for table references that do not\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
910 include an explicit database specifier.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
911 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
912 Fails unless the connected user can be authenticated as having\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
913 permission to use the database.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
914 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
915 Non-standard.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
916 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
917
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
918 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
919 _mysql_ConnectionObject_select_db(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
920 _mysql_ConnectionObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
921 PyObject *args)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
922 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
923 char *db;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
924 int r;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
925 if (!PyArg_ParseTuple(args, "s:select_db", &db)) return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
926 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
927 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
928 r = mysql_select_db(&(self->connection), db);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
929 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
930 if (r) return _mysql_Exception(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
931 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
932 return Py_None;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
933 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
934
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
935 static char _mysql_ConnectionObject_shutdown__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
936 "Asks the database server to shut down. The connected user must\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
937 have shutdown privileges. Non-standard.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
938 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
939
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
940 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
941 _mysql_ConnectionObject_shutdown(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
942 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
943 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
944 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
945 int r;
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
946
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
947 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
948 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
949 r = mysql_shutdown(&(self->connection)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
950 #if MYSQL_VERSION_ID >= 40103
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
951 , SHUTDOWN_DEFAULT
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
952 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
953 );
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
954 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
955 if (r) return _mysql_Exception(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
956 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
957 return Py_None;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
958 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
959
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
960 static char _mysql_ConnectionObject_stat__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
961 "Returns a character string containing information similar to\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
962 that provided by the mysqladmin status command. This includes\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
963 uptime in seconds and the number of running threads,\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
964 questions, reloads, and open tables. Non-standard.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
965 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
966
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
967 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
968 _mysql_ConnectionObject_stat(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
969 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
970 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
971 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
972 const char *s;
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
973
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
974 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
975 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
976 s = mysql_stat(&(self->connection));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
977 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
978 if (!s) return _mysql_Exception(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
979 return PyString_FromString(s);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
980 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
981
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
982 static char _mysql_ConnectionObject_store_result__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
983 "Returns a result object acquired by mysql_store_result\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
984 (results stored in the client). If no results are available,\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
985 None is returned. Non-standard.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
986 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
987
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
988 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
989 _mysql_ConnectionObject_store_result(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
990 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
991 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
992 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
993 PyObject *arglist=NULL, *kwarglist=NULL, *result=NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
994 _mysql_ResultObject *r=NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
995
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
996 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
997 arglist = Py_BuildValue("(OiO)", self, 0, self->converter);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
998 if (!arglist) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
999 kwarglist = PyDict_New();
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1000 if (!kwarglist) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1001 r = MyAlloc(_mysql_ResultObject, _mysql_ResultObject_Type);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1002 if (!r) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1003 if (_mysql_ResultObject_Initialize(r, arglist, kwarglist))
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1004 goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1005 result = (PyObject *) r;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1006 if (!(r->result)) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1007 Py_DECREF(result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1008 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1009 result = Py_None;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1010 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1011 error:
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1012 Py_XDECREF(arglist);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1013 Py_XDECREF(kwarglist);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1014 return result;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1015 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1016
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1017 static char _mysql_ConnectionObject_thread_id__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1018 "Returns the thread ID of the current connection. This value\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1019 can be used as an argument to kill() to kill the thread.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1020 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1021 If the connection is lost and you reconnect with ping(), the\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1022 thread ID will change. This means you should not get the\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1023 thread ID and store it for later. You should get it when you\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1024 need it.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1025 \n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1026 Non-standard.";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1027
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1028 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1029 _mysql_ConnectionObject_thread_id(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1030 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1031 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1032 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1033 unsigned long pid;
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1034
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1035 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1036 Py_BEGIN_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1037 pid = mysql_thread_id(&(self->connection));
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1038 Py_END_ALLOW_THREADS
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1039 return PyInt_FromLong((long)pid);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1040 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1041
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1042 static char _mysql_ConnectionObject_use_result__doc__[] =
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1043 "Returns a result object acquired by mysql_use_result\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1044 (results stored in the server). If no results are available,\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1045 None is returned. Non-standard.\n\
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1046 ";
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1047
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1048 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1049 _mysql_ConnectionObject_use_result(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1050 _mysql_ConnectionObject *self,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1051 PyObject *unused)
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1052 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1053 PyObject *arglist=NULL, *kwarglist=NULL, *result=NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1054 _mysql_ResultObject *r=NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1055
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1056 check_connection(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1057 arglist = Py_BuildValue("(OiO)", self, 1, self->converter);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1058 if (!arglist) return NULL;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1059 kwarglist = PyDict_New();
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1060 if (!kwarglist) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1061 r = MyAlloc(_mysql_ResultObject, _mysql_ResultObject_Type);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1062 if (!r) goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1063 result = (PyObject *) r;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1064 if (_mysql_ResultObject_Initialize(r, arglist, kwarglist))
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1065 goto error;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1066 if (!(r->result)) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1067 Py_DECREF(result);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1068 Py_INCREF(Py_None);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1069 result = Py_None;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1070 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1071 error:
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1072 Py_DECREF(arglist);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1073 Py_XDECREF(kwarglist);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1074 return result;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1075 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1076
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1077 static void
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1078 _mysql_ConnectionObject_dealloc(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1079 _mysql_ConnectionObject *self)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1080 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1081 PyObject *o;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1082
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1083 PyObject_GC_UnTrack(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1084 if (self->open) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1085 o = _mysql_ConnectionObject_close(self, NULL);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1086 Py_XDECREF(o);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1087 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1088 MyFree(self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1089 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1090
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1091 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1092 _mysql_ConnectionObject_repr(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1093 _mysql_ConnectionObject *self)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1094 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1095 char buf[300];
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1096 if (self->open)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1097 sprintf(buf, "<_mysql.connection open to '%.256s' at %lx>",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1098 self->connection.host,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1099 (long)self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1100 else
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1101 sprintf(buf, "<_mysql.connection closed at %lx>",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1102 (long)self);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1103 return PyString_FromString(buf);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1104 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1105
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1106 static PyMethodDef _mysql_ConnectionObject_methods[] = {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1107 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1108 "affected_rows",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1109 (PyCFunction)_mysql_ConnectionObject_affected_rows,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1110 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1111 _mysql_ConnectionObject_affected_rows__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1112 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1113 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1114 "autocommit",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1115 (PyCFunction)_mysql_ConnectionObject_autocommit,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1116 METH_VARARGS,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1117 _mysql_ConnectionObject_autocommit__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1118 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1119 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1120 "commit",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1121 (PyCFunction)_mysql_ConnectionObject_commit,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1122 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1123 _mysql_ConnectionObject_commit__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1124 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1125 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1126 "rollback",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1127 (PyCFunction)_mysql_ConnectionObject_rollback,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1128 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1129 _mysql_ConnectionObject_rollback__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1130 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1131 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1132 "next_result",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1133 (PyCFunction)_mysql_ConnectionObject_next_result,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1134 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1135 _mysql_ConnectionObject_next_result__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1136 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1137 #if MYSQL_VERSION_ID >= 40100
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1138 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1139 "set_server_option",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1140 (PyCFunction)_mysql_ConnectionObject_set_server_option,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1141 METH_VARARGS,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1142 _mysql_ConnectionObject_set_server_option__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1143 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1144 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1145 "sqlstate",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1146 (PyCFunction)_mysql_ConnectionObject_sqlstate,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1147 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1148 _mysql_ConnectionObject_sqlstate__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1149 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1150 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1151 "warning_count",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1152 (PyCFunction)_mysql_ConnectionObject_warning_count,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1153 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1154 _mysql_ConnectionObject_warning_count__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1155 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1156 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1157 #if MYSQL_VERSION_ID >= 32303
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1158 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1159 "change_user",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1160 (PyCFunction)_mysql_ConnectionObject_change_user,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1161 METH_VARARGS | METH_KEYWORDS,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1162 _mysql_ConnectionObject_change_user__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1163 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1164 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1165 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1166 "character_set_name",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1167 (PyCFunction)_mysql_ConnectionObject_character_set_name,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1168 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1169 _mysql_ConnectionObject_character_set_name__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1170 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1171 #if MYSQL_VERSION_ID >= 50007
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1172 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1173 "set_character_set",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1174 (PyCFunction)_mysql_ConnectionObject_set_character_set,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1175 METH_VARARGS,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1176 _mysql_ConnectionObject_set_character_set__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1177 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1178 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1179 #if MYSQL_VERSION_ID >= 50010
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1180 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1181 "get_character_set_info",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1182 (PyCFunction)_mysql_ConnectionObject_get_character_set_info,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1183 METH_VARARGS,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1184 _mysql_ConnectionObject_get_character_set_info__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1185 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1186 #endif
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1187 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1188 "close",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1189 (PyCFunction)_mysql_ConnectionObject_close,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1190 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1191 _mysql_ConnectionObject_close__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1192 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1193 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1194 "dump_debug_info",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1195 (PyCFunction)_mysql_ConnectionObject_dump_debug_info,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1196 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1197 _mysql_ConnectionObject_dump_debug_info__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1198 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1199 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1200 "escape",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1201 (PyCFunction)_mysql_escape,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1202 METH_VARARGS,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1203 _mysql_escape__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1204 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1205 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1206 "escape_string",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1207 (PyCFunction)_mysql_escape_string,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1208 METH_VARARGS,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1209 _mysql_escape_string__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1210 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1211 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1212 "error",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1213 (PyCFunction)_mysql_ConnectionObject_error,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1214 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1215 _mysql_ConnectionObject_error__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1216 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1217 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1218 "errno",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1219 (PyCFunction)_mysql_ConnectionObject_errno,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1220 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1221 _mysql_ConnectionObject_errno__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1222 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1223 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1224 "field_count",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1225 (PyCFunction)_mysql_ConnectionObject_field_count,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1226 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1227 _mysql_ConnectionObject_field_count__doc__
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1228 },
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1229 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1230 "get_host_info",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1231 (PyCFunction)_mysql_ConnectionObject_get_host_info,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1232 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1233 _mysql_ConnectionObject_get_host_info__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1234 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1235 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1236 "get_proto_info",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1237 (PyCFunction)_mysql_ConnectionObject_get_proto_info,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1238 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1239 _mysql_ConnectionObject_get_proto_info__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1240 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1241 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1242 "get_server_info",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1243 (PyCFunction)_mysql_ConnectionObject_get_server_info,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1244 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1245 _mysql_ConnectionObject_get_server_info__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1246 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1247 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1248 "info",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1249 (PyCFunction)_mysql_ConnectionObject_info,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1250 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1251 _mysql_ConnectionObject_info__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1252 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1253 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1254 "insert_id",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1255 (PyCFunction)_mysql_ConnectionObject_insert_id,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1256 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1257 _mysql_ConnectionObject_insert_id__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1258 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1259 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1260 "kill",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1261 (PyCFunction)_mysql_ConnectionObject_kill,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1262 METH_VARARGS,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1263 _mysql_ConnectionObject_kill__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1264 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1265 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1266 "ping",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1267 (PyCFunction)_mysql_ConnectionObject_ping,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1268 METH_VARARGS,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1269 _mysql_ConnectionObject_ping__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1270 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1271 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1272 "query",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1273 (PyCFunction)_mysql_ConnectionObject_query,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1274 METH_VARARGS,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1275 _mysql_ConnectionObject_query__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1276 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1277 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1278 "select_db",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1279 (PyCFunction)_mysql_ConnectionObject_select_db,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1280 METH_VARARGS,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1281 _mysql_ConnectionObject_select_db__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1282 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1283 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1284 "shutdown",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1285 (PyCFunction)_mysql_ConnectionObject_shutdown,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1286 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1287 _mysql_ConnectionObject_shutdown__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1288 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1289 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1290 "stat",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1291 (PyCFunction)_mysql_ConnectionObject_stat,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1292 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1293 _mysql_ConnectionObject_stat__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1294 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1295 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1296 "store_result",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1297 (PyCFunction)_mysql_ConnectionObject_store_result,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1298 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1299 _mysql_ConnectionObject_store_result__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1300 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1301 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1302 "string_literal",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1303 (PyCFunction)_mysql_string_literal,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1304 METH_VARARGS,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1305 _mysql_string_literal__doc__},
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1306 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1307 "thread_id",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1308 (PyCFunction)_mysql_ConnectionObject_thread_id,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1309 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1310 _mysql_ConnectionObject_thread_id__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1311 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1312 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1313 "use_result",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1314 (PyCFunction)_mysql_ConnectionObject_use_result,
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1315 METH_NOARGS,
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1316 _mysql_ConnectionObject_use_result__doc__
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1317 },
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1318 {NULL, NULL} /* sentinel */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1319 };
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1320
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1321 static struct PyMemberDef _mysql_ConnectionObject_memberlist[] = {
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1322 {
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1323 "open",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1324 T_INT,
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1325 offsetof(_mysql_ConnectionObject, open),
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1326 RO,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1327 "True if connection is open"
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1328 },
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1329 {
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1330 "converter",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1331 T_OBJECT,
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1332 offsetof(_mysql_ConnectionObject, converter),
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1333 0,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1334 "Type conversion mapping"
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1335 },
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1336 {
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1337 "server_capabilities",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1338 T_UINT,
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1339 offsetof(_mysql_ConnectionObject, connection.server_capabilities),
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1340 RO,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1341 "Capabilites of server; consult MySQLdb.constants.CLIENT"
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1342 },
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1343 {
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1344 "port",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1345 T_UINT,
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1346 offsetof(_mysql_ConnectionObject, connection.port),
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1347 RO,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1348 "TCP/IP port of the server connection"
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1349 },
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1350 {
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1351 "client_flag",
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1352 T_UINT,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1353 RO,
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1354 offsetof(_mysql_ConnectionObject, connection.client_flag),
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1355 "Client flags; refer to MySQLdb.constants.CLIENT"
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1356 },
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1357 {NULL} /* Sentinel */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1358 };
25
25c5d3b241ba Start converting some some things to METH_NOARGS to save invocation time, add
kylev
parents: 21
diff changeset
1359
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1360 static PyObject *
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1361 _mysql_ConnectionObject_getattr(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1362 _mysql_ConnectionObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1363 char *name)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1364 {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1365 PyObject *res;
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1366 struct PyMemberDef *l;
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1367
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1368 res = Py_FindMethod(_mysql_ConnectionObject_methods, (PyObject *)self, name);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1369 if (res != NULL)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1370 return res;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1371 PyErr_Clear();
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1372 if (strcmp(name, "closed") == 0)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1373 return PyInt_FromLong((long)!(self->open));
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1374
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1375 for (l = _mysql_ConnectionObject_memberlist; l->name != NULL; l++) {
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1376 if (strcmp(l->name, name) == 0)
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1377 return PyMember_GetOne((char *)self, l);
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1378 }
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1379
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1380 PyErr_SetString(PyExc_AttributeError, name);
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1381 return NULL;
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1382 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1383
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1384 static int
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1385 _mysql_ConnectionObject_setattr(
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1386 _mysql_ConnectionObject *self,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1387 char *name,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1388 PyObject *v)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1389 {
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1390 struct PyMemberDef *l;
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1391
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1392 if (v == NULL) {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1393 PyErr_SetString(PyExc_AttributeError,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1394 "can't delete connection attributes");
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1395 return -1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1396 }
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1397
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1398 for (l = _mysql_ConnectionObject_memberlist; l->name != NULL; l++)
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1399 if (strcmp(l->name, name) == 0)
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1400 return PyMember_SetOne((char *)self, l, v);
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1401
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1402 PyErr_SetString(PyExc_AttributeError, name);
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1403 return -1;
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1404 }
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1405
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1406 PyTypeObject _mysql_ConnectionObject_Type = {
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1407 PyObject_HEAD_INIT(NULL)
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1408 0,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1409 "_mysql.connection", /* (char *)tp_name For printing */
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1410 sizeof(_mysql_ConnectionObject), /* tp_basicsize */
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1411 0,
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1412 (destructor)_mysql_ConnectionObject_dealloc, /* tp_dealloc */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1413 0, /*tp_print*/
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1414 (getattrfunc)_mysql_ConnectionObject_getattr, /* tp_getattr */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1415 (setattrfunc)_mysql_ConnectionObject_setattr, /* tp_setattr */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1416 0, /*tp_compare*/
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1417 (reprfunc)_mysql_ConnectionObject_repr, /* tp_repr */
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1418
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1419 /* Method suites for standard classes */
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1420
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1421 0, /* (PyNumberMethods *) tp_as_number */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1422 0, /* (PySequenceMethods *) tp_as_sequence */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1423 0, /* (PyMappingMethods *) tp_as_mapping */
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1424
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1425 /* More standard operations (here for binary compatibility) */
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1426
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1427 0, /* (hashfunc) tp_hash */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1428 0, /* (ternaryfunc) tp_call */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1429 0, /* (reprfunc) tp_str */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1430 0, /* (getattrofunc) tp_getattro */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1431 0, /* (setattrofunc) tp_setattro */
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1432
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1433 /* Functions to access object as input/output buffer */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1434 0, /* (PyBufferProcs *) tp_as_buffer */
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1435
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1436 /* Flags to define presence of optional/expanded features */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1437 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1438
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1439 _mysql_connect__doc__, /* (char *) tp_doc Documentation string */
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1440
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1441 /* call function for all accessible objects */
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1442 (traverseproc)_mysql_ConnectionObject_traverse, /* tp_traverse */
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1443
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1444 /* delete references to contained objects */
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1445 (inquiry)_mysql_ConnectionObject_clear, /* tp_clear */
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1446
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1447 /* rich comparisons */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1448 0, /* (richcmpfunc) tp_richcompare */
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1449
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1450 /* weak reference enabler */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1451 0, /* (long) tp_weaklistoffset */
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1452
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1453 /* Iterators */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1454 0, /* (getiterfunc) tp_iter */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1455 0, /* (iternextfunc) tp_iternext */
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1456
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1457 /* Attribute descriptor and subclassing stuff */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1458 (struct PyMethodDef *)_mysql_ConnectionObject_methods, /* tp_methods */
42
fdf0cabb27be Member stuff is stable post py2.2, so remove the MyMember* workarounds
kylev
parents: 29
diff changeset
1459 (struct PyMemberDef *)_mysql_ConnectionObject_memberlist, /* tp_members */
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1460 0, /* (struct getsetlist *) tp_getset; */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1461 0, /* (struct _typeobject *) tp_base; */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1462 0, /* (PyObject *) tp_dict */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1463 0, /* (descrgetfunc) tp_descr_get */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1464 0, /* (descrsetfunc) tp_descr_set */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1465 0, /* (long) tp_dictoffset */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1466 (initproc)_mysql_ConnectionObject_Initialize, /* tp_init */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1467 NULL, /* tp_alloc */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1468 NULL, /* tp_new */
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1469 NULL, /* tp_free Low-level free-memory routine */
0
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1470 0, /* (PyObject *) tp_bases */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1471 0, /* (PyObject *) tp_mro method resolution order */
e48810735f11 Copying 1.2.1 to be the new trunk
adustman
parents:
diff changeset
1472 0, /* (PyObject *) tp_defined */
29
fbf2470ea3d4 Remove more pre-2.3 checks and #define work-arounds.
kylev
parents: 25
diff changeset
1473 };