Mercurial > p > mysql-python > mysqldb-2
annotate _mysql.h @ 35:e7bd07afbcb9 MySQLdb
Conflict-filled merge from 1.2br for 558:559 set and exception fixes
author | kylev |
---|---|
date | Thu, 12 Feb 2009 00:23:41 +0000 |
parents | 5a3e4cafadec |
children | fdf0cabb27be |
rev | line source |
---|---|
20 | 1 #ifndef _MYSQL_PYTHON__MYSQL_H_ |
21 | 2 #define _MYSQL_PYTHON__MYSQL_H_ |
20 | 3 |
28
5a3e4cafadec
Clean out the old 1.x and 2.2 era memory workarounds (our minimum is 2.3).
kylev
parents:
21
diff
changeset
|
4 #include <Python.h> |
0 | 5 |
6 #ifdef MS_WIN32 | |
7 #include <windows.h> | |
8 #endif /* MS_WIN32 */ | |
9 | |
10 #include "structmember.h" | |
11 #include "mysql.h" | |
12 #include "my_config.h" | |
13 #include "mysqld_error.h" | |
14 #include "errmsg.h" | |
15 | |
28
5a3e4cafadec
Clean out the old 1.x and 2.2 era memory workarounds (our minimum is 2.3).
kylev
parents:
21
diff
changeset
|
16 #define MyTuple_Resize(t,n,d) _PyTuple_Resize(t, n) |
5a3e4cafadec
Clean out the old 1.x and 2.2 era memory workarounds (our minimum is 2.3).
kylev
parents:
21
diff
changeset
|
17 #define MyMember(a,b,c,d,e) {a,b,c,d,e} |
5a3e4cafadec
Clean out the old 1.x and 2.2 era memory workarounds (our minimum is 2.3).
kylev
parents:
21
diff
changeset
|
18 #define MyMemberlist(x) struct PyMemberDef x |
5a3e4cafadec
Clean out the old 1.x and 2.2 era memory workarounds (our minimum is 2.3).
kylev
parents:
21
diff
changeset
|
19 #define MyAlloc(s,t) (s *) t.tp_alloc(&t,0) |
5a3e4cafadec
Clean out the old 1.x and 2.2 era memory workarounds (our minimum is 2.3).
kylev
parents:
21
diff
changeset
|
20 #define MyFree(ob) ob->ob_type->tp_free((PyObject *)ob) |
0 | 21 |
4 | 22 #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) |
23 typedef int Py_ssize_t; | |
24 #define PY_SSIZE_T_MAX INT_MAX | |
25 #define PY_SSIZE_T_MIN INT_MIN | |
26 #endif | |
27 | |
0 | 28 typedef struct { |
29 PyObject_HEAD | |
30 MYSQL connection; | |
31 int open; | |
32 PyObject *converter; | |
33 } _mysql_ConnectionObject; | |
34 | |
35 #define check_connection(c) if (!(c->open)) return _mysql_Exception(c) | |
36 #define result_connection(r) ((_mysql_ConnectionObject *)r->conn) | |
37 #define check_result_connection(r) check_connection(result_connection(r)) | |
38 | |
39 extern PyTypeObject _mysql_ConnectionObject_Type; | |
40 | |
41 typedef struct { | |
42 PyObject_HEAD | |
43 PyObject *conn; | |
44 MYSQL_RES *result; | |
45 int nfields; | |
46 int use; | |
47 PyObject *converter; | |
48 } _mysql_ResultObject; | |
49 | |
50 extern PyTypeObject _mysql_ResultObject_Type; | |
51 | |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
52 typedef struct { |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
53 PyObject_HEAD |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
54 PyObject *result; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
55 MYSQL_FIELD field; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
56 unsigned int index; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
57 } _mysql_FieldObject; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
58 |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
59 extern PyTypeObject _mysql_FieldObject_Type; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
60 |
20 | 61 extern int _mysql_server_init_done; |
0 | 62 #if MYSQL_VERSION_ID >= 40000 |
63 #define check_server_init(x) if (!_mysql_server_init_done) { if (mysql_server_init(0, NULL, NULL)) { _mysql_Exception(NULL); return x; } else { _mysql_server_init_done = 1;} } | |
64 #else | |
65 #define check_server_init(x) if (!_mysql_server_init_done) _mysql_server_init_done = 1 | |
66 #endif | |
67 | |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
68 extern PyObject *_mysql_MySQLError; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
69 extern PyObject *_mysql_Warning; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
70 extern PyObject *_mysql_Error; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
71 extern PyObject *_mysql_DatabaseError; |
28
5a3e4cafadec
Clean out the old 1.x and 2.2 era memory workarounds (our minimum is 2.3).
kylev
parents:
21
diff
changeset
|
72 extern PyObject *_mysql_InterfaceError; |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
73 extern PyObject *_mysql_DataError; |
28
5a3e4cafadec
Clean out the old 1.x and 2.2 era memory workarounds (our minimum is 2.3).
kylev
parents:
21
diff
changeset
|
74 extern PyObject *_mysql_OperationalError; |
5a3e4cafadec
Clean out the old 1.x and 2.2 era memory workarounds (our minimum is 2.3).
kylev
parents:
21
diff
changeset
|
75 extern PyObject *_mysql_IntegrityError; |
5a3e4cafadec
Clean out the old 1.x and 2.2 era memory workarounds (our minimum is 2.3).
kylev
parents:
21
diff
changeset
|
76 extern PyObject *_mysql_InternalError; |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
77 extern PyObject *_mysql_ProgrammingError; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
78 extern PyObject *_mysql_NotSupportedError; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
79 extern PyObject *_mysql_error_map; |
0 | 80 |
2
c0d1fc0429ce
Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents:
1
diff
changeset
|
81 extern PyObject * |
c0d1fc0429ce
Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents:
1
diff
changeset
|
82 _mysql_Exception(_mysql_ConnectionObject *c); |
6 | 83 |
84 extern int | |
85 _mysql_ResultObject_Initialize( | |
86 _mysql_ResultObject *self, | |
87 PyObject *args, | |
88 PyObject *kwargs); | |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
89 |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
90 extern int |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
91 _mysql_FieldObject_Initialize( |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
92 _mysql_FieldObject *self, |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
93 PyObject *args, |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
94 PyObject *kwargs); |
28
5a3e4cafadec
Clean out the old 1.x and 2.2 era memory workarounds (our minimum is 2.3).
kylev
parents:
21
diff
changeset
|
95 |
20 | 96 #endif |