Mercurial > p > mysql-python > mysqldb-2
annotate _mysql.h @ 42:fdf0cabb27be MySQLdb
Member stuff is stable post py2.2, so remove the MyMember* workarounds
author | kylev |
---|---|
date | Tue, 17 Feb 2009 05:55:24 +0000 |
parents | 5a3e4cafadec |
children | 2b9a9814daab |
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 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
|
18 #define MyFree(ob) ob->ob_type->tp_free((PyObject *)ob) |
0 | 19 |
4 | 20 #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) |
21 typedef int Py_ssize_t; | |
22 #define PY_SSIZE_T_MAX INT_MAX | |
23 #define PY_SSIZE_T_MIN INT_MIN | |
24 #endif | |
25 | |
0 | 26 typedef struct { |
27 PyObject_HEAD | |
28 MYSQL connection; | |
29 int open; | |
30 PyObject *converter; | |
31 } _mysql_ConnectionObject; | |
32 | |
33 #define check_connection(c) if (!(c->open)) return _mysql_Exception(c) | |
34 #define result_connection(r) ((_mysql_ConnectionObject *)r->conn) | |
35 #define check_result_connection(r) check_connection(result_connection(r)) | |
36 | |
37 extern PyTypeObject _mysql_ConnectionObject_Type; | |
38 | |
39 typedef struct { | |
40 PyObject_HEAD | |
41 PyObject *conn; | |
42 MYSQL_RES *result; | |
43 int nfields; | |
44 int use; | |
45 PyObject *converter; | |
46 } _mysql_ResultObject; | |
47 | |
48 extern PyTypeObject _mysql_ResultObject_Type; | |
49 | |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
50 typedef struct { |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
51 PyObject_HEAD |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
52 PyObject *result; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
53 MYSQL_FIELD field; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
54 unsigned int index; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
55 } _mysql_FieldObject; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
56 |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
57 extern PyTypeObject _mysql_FieldObject_Type; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
58 |
20 | 59 extern int _mysql_server_init_done; |
0 | 60 #if MYSQL_VERSION_ID >= 40000 |
61 #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;} } | |
62 #else | |
63 #define check_server_init(x) if (!_mysql_server_init_done) _mysql_server_init_done = 1 | |
64 #endif | |
65 | |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
66 extern PyObject *_mysql_MySQLError; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
67 extern PyObject *_mysql_Warning; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
68 extern PyObject *_mysql_Error; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
69 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
|
70 extern PyObject *_mysql_InterfaceError; |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
71 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
|
72 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
|
73 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
|
74 extern PyObject *_mysql_InternalError; |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
75 extern PyObject *_mysql_ProgrammingError; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
76 extern PyObject *_mysql_NotSupportedError; |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
77 extern PyObject *_mysql_error_map; |
0 | 78 |
2
c0d1fc0429ce
Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents:
1
diff
changeset
|
79 extern PyObject * |
c0d1fc0429ce
Smashed _mysql.c with a great big hammer and got some smaller,
adustman
parents:
1
diff
changeset
|
80 _mysql_Exception(_mysql_ConnectionObject *c); |
6 | 81 |
82 extern int | |
83 _mysql_ResultObject_Initialize( | |
84 _mysql_ResultObject *self, | |
85 PyObject *args, | |
86 PyObject *kwargs); | |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
87 |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
88 extern int |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
89 _mysql_FieldObject_Initialize( |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
90 _mysql_FieldObject *self, |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
91 PyObject *args, |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
8
diff
changeset
|
92 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
|
93 |
20 | 94 #endif |