comparison _mysql.c @ 4:b5a377255eea MySQLdb

Merge changes from MySQLdb-1.2 branch (448-455)
author adustman
date Tue, 24 Oct 2006 19:52:31 +0000
parents c0d1fc0429ce
children b70cce9bd065
comparison
equal deleted inserted replaced
3:df195ac92df6 4:b5a377255eea
75 case ER_DUP_UNIQUE: 75 case ER_DUP_UNIQUE:
76 #endif 76 #endif
77 #ifdef ER_NO_REFERENCED_ROW 77 #ifdef ER_NO_REFERENCED_ROW
78 case ER_NO_REFERENCED_ROW: 78 case ER_NO_REFERENCED_ROW:
79 #endif 79 #endif
80 #ifdef ER_NO_REFERENCED_ROW_2
81 case ER_NO_REFERENCED_ROW_2:
82 #endif
80 #ifdef ER_ROW_IS_REFERENCED 83 #ifdef ER_ROW_IS_REFERENCED
81 case ER_ROW_IS_REFERENCED: 84 case ER_ROW_IS_REFERENCED:
85 #endif
86 #ifdef ER_ROW_IS_REFERENCED_2
87 case ER_ROW_IS_REFERENCED_2:
82 #endif 88 #endif
83 #ifdef ER_CANNOT_ADD_FOREIGN 89 #ifdef ER_CANNOT_ADD_FOREIGN
84 case ER_CANNOT_ADD_FOREIGN: 90 case ER_CANNOT_ADD_FOREIGN:
85 #endif 91 #endif
86 e = _mysql_IntegrityError; 92 e = _mysql_IntegrityError;
478 return NULL; 484 return NULL;
479 if (PyDict_SetItemString(dict, name, e)) return NULL; 485 if (PyDict_SetItemString(dict, name, e)) return NULL;
480 return e; 486 return e;
481 } 487 }
482 488
489 #define QUOTE(X) _QUOTE(X)
490 #define _QUOTE(X) #X
491
483 static char _mysql___doc__[] = 492 static char _mysql___doc__[] =
484 "an adaptation of the MySQL C API (mostly)\n\ 493 "an adaptation of the MySQL C API (mostly)\n\
485 \n\ 494 \n\
486 You probably are better off using MySQLdb instead of using this\n\ 495 You probably are better off using MySQLdb instead of using this\n\
487 module directly.\n\ 496 module directly.\n\
512 _mysql_ResultObject_Type.tp_free = _PyObject_GC_Del; 521 _mysql_ResultObject_Type.tp_free = _PyObject_GC_Del;
513 #endif 522 #endif
514 523
515 if (!(dict = PyModule_GetDict(module))) goto error; 524 if (!(dict = PyModule_GetDict(module))) goto error;
516 if (PyDict_SetItemString(dict, "version_info", 525 if (PyDict_SetItemString(dict, "version_info",
517 PyRun_String(version_info, Py_eval_input, 526 PyRun_String(QUOTE(version_info), Py_eval_input,
518 dict, dict))) 527 dict, dict)))
519 goto error; 528 goto error;
520 if (PyDict_SetItemString(dict, "__version__", 529 if (PyDict_SetItemString(dict, "__version__",
521 PyString_FromString(__version__))) 530 PyString_FromString(QUOTE(__version__))))
522 goto error; 531 goto error;
523 if (PyDict_SetItemString(dict, "connection", 532 if (PyDict_SetItemString(dict, "connection",
524 (PyObject *)&_mysql_ConnectionObject_Type)) 533 (PyObject *)&_mysql_ConnectionObject_Type))
525 goto error; 534 goto error;
526 Py_INCREF(&_mysql_ConnectionObject_Type); 535 Py_INCREF(&_mysql_ConnectionObject_Type);