comparison _mysql.c @ 41:e80676c3505f MySQLdb

More NOARGS, with test coverage
author kylev
date Sun, 15 Feb 2009 07:56:43 +0000
parents 78e810705b3d
children
comparison
equal deleted inserted replaced
40:2d1a3d9e15b2 41:e80676c3505f
157 "Shut down embedded server. If not using an embedded server, this\n\ 157 "Shut down embedded server. If not using an embedded server, this\n\
158 does nothing."; 158 does nothing.";
159 159
160 static PyObject *_mysql_server_end( 160 static PyObject *_mysql_server_end(
161 PyObject *self, 161 PyObject *self,
162 PyObject *args) { 162 PyObject *unused) {
163 if (_mysql_server_init_done) { 163 if (_mysql_server_init_done) {
164 #if MYSQL_VERSION_ID >= 40000 164 #if MYSQL_VERSION_ID >= 40000
165 mysql_server_end(); 165 mysql_server_end();
166 #endif 166 #endif
167 _mysql_server_init_done = 0; 167 _mysql_server_init_done = 0;
175 static char _mysql_thread_safe__doc__[] = 175 static char _mysql_thread_safe__doc__[] =
176 "Indicates whether the client is compiled as thread-safe."; 176 "Indicates whether the client is compiled as thread-safe.";
177 177
178 static PyObject *_mysql_thread_safe( 178 static PyObject *_mysql_thread_safe(
179 PyObject *self, 179 PyObject *self,
180 PyObject *args) { 180 PyObject *unused) {
181 PyObject *flag; 181
182 if (!PyArg_ParseTuple(args, "")) return NULL;
183 check_server_init(NULL); 182 check_server_init(NULL);
184 if (!(flag=PyInt_FromLong((long)mysql_thread_safe()))) return NULL; 183 return PyInt_FromLong((long)mysql_thread_safe());
185 return flag;
186 } 184 }
187 #endif 185 #endif
188 186
189 extern char _mysql_connect__doc__[]; 187 extern char _mysql_connect__doc__[];
190 PyObject * 188 PyObject *
326 "get_client_info() -- Returns a string that represents\n\ 324 "get_client_info() -- Returns a string that represents\n\
327 the client library version."; 325 the client library version.";
328 static PyObject * 326 static PyObject *
329 _mysql_get_client_info( 327 _mysql_get_client_info(
330 PyObject *self, 328 PyObject *self,
331 PyObject *args) 329 PyObject *unused)
332 { 330 {
333 if (!PyArg_ParseTuple(args, "")) return NULL;
334 check_server_init(NULL); 331 check_server_init(NULL);
335 return PyString_FromString(mysql_get_client_info()); 332 return PyString_FromString(mysql_get_client_info());
336 } 333 }
337 334
338 extern PyTypeObject _mysql_ConnectionObject_Type; 335 extern PyTypeObject _mysql_ConnectionObject_Type;
383 _mysql_string_literal__doc__ 380 _mysql_string_literal__doc__
384 }, 381 },
385 { 382 {
386 "get_client_info", 383 "get_client_info",
387 (PyCFunction)_mysql_get_client_info, 384 (PyCFunction)_mysql_get_client_info,
388 METH_VARARGS, 385 METH_NOARGS,
389 _mysql_get_client_info__doc__ 386 _mysql_get_client_info__doc__
390 }, 387 },
391 #if MYSQL_VERSION_ID >= 32314 388 #if MYSQL_VERSION_ID >= 32314
392 { 389 {
393 "thread_safe", 390 "thread_safe",
394 (PyCFunction)_mysql_thread_safe, 391 (PyCFunction)_mysql_thread_safe,
395 METH_VARARGS, 392 METH_NOARGS,
396 _mysql_thread_safe__doc__ 393 _mysql_thread_safe__doc__
397 }, 394 },
398 #endif 395 #endif
399 { 396 {
400 "server_init", 397 "server_init",
403 _mysql_server_init__doc__ 400 _mysql_server_init__doc__
404 }, 401 },
405 { 402 {
406 "server_end", 403 "server_end",
407 (PyCFunction)_mysql_server_end, 404 (PyCFunction)_mysql_server_end,
408 METH_VARARGS, 405 METH_NOARGS,
409 _mysql_server_end__doc__ 406 _mysql_server_end__doc__
410 }, 407 },
411 {NULL, NULL} /* sentinel */ 408 {NULL, NULL} /* sentinel */
412 }; 409 };
413 410