Mercurial > cpython-lru_cache-weakref
annotate Modules/_sqlite/connection.h @ 37829:f048116aade0 legacy-trunk
It's probably a good idea to actually *install* setuptools, too. ;)
| author | Phillip J. Eby <pje@telecommunity.com> |
|---|---|
| date | Tue, 18 Apr 2006 04:34:50 +0000 |
| parents | d27058c409df |
| children | 7da4af95ebad |
| rev | line source |
|---|---|
|
37362
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
1 /* connection.h - definitions for the connection type |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
2 * |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2004-2005 Gerhard Häring <gh@ghaering.de> |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
4 * |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
5 * This file is part of pysqlite. |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
6 * |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
7 * This software is provided 'as-is', without any express or implied |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
8 * warranty. In no event will the authors be held liable for any damages |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
9 * arising from the use of this software. |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
10 * |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
11 * Permission is granted to anyone to use this software for any purpose, |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
12 * including commercial applications, and to alter it and redistribute it |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
13 * freely, subject to the following restrictions: |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
14 * |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
15 * 1. The origin of this software must not be misrepresented; you must not |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
16 * claim that you wrote the original software. If you use this software |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
17 * in a product, an acknowledgment in the product documentation would be |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
18 * appreciated but is not required. |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
19 * 2. Altered source versions must be plainly marked as such, and must not be |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
20 * misrepresented as being the original software. |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
21 * 3. This notice may not be removed or altered from any source distribution. |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
22 */ |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
23 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
24 #ifndef PYSQLITE_CONNECTION_H |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
25 #define PYSQLITE_CONNECTION_H |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
26 #include "Python.h" |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
27 #include "pythread.h" |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
28 #include "structmember.h" |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
29 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
30 #include "cache.h" |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
31 #include "module.h" |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
32 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
33 #include "sqlite3.h" |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
34 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
35 typedef struct |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
36 { |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
37 PyObject_HEAD |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
38 sqlite3* db; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
39 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
40 int inTransaction; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
41 int detect_types; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
42 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
43 /* the timeout value in seconds for database locks */ |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
44 double timeout; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
45 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
46 /* for internal use in the timeout handler: when did the timeout handler |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
47 * first get called with count=0? */ |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
48 double timeout_started; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
49 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
50 /* None for autocommit, otherwise a PyString with the isolation level */ |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
51 PyObject* isolation_level; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
52 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
53 /* NULL for autocommit, otherwise a string with the BEGIN statment; will be |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
54 * freed in connection destructor */ |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
55 char* begin_statement; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
56 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
57 int check_same_thread; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
58 long thread_ident; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
59 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
60 Cache* statement_cache; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
61 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
62 PyObject* row_factory; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
63 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
64 PyObject* text_factory; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
65 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
66 /* remember references to functions/classes used in |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
67 * create_function/create/aggregate, use these as dictionary keys, so we |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
68 * can keep the total system refcount constant by clearing that dictionary |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
69 * in connection_dealloc */ |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
70 PyObject* function_pinboard; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
71 |
|
37458
d27058c409df
Update to pysqlite 2.2.0
Anthony Baxter <anthonybaxter@gmail.com>
parents:
37362
diff
changeset
|
72 /* a dictionary of registered collation name => collation callable mappings */ |
|
d27058c409df
Update to pysqlite 2.2.0
Anthony Baxter <anthonybaxter@gmail.com>
parents:
37362
diff
changeset
|
73 PyObject* collations; |
|
d27058c409df
Update to pysqlite 2.2.0
Anthony Baxter <anthonybaxter@gmail.com>
parents:
37362
diff
changeset
|
74 |
|
37362
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
75 /* Exception objects */ |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
76 PyObject* Warning; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
77 PyObject* Error; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
78 PyObject* InterfaceError; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
79 PyObject* DatabaseError; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
80 PyObject* DataError; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
81 PyObject* OperationalError; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
82 PyObject* IntegrityError; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
83 PyObject* InternalError; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
84 PyObject* ProgrammingError; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
85 PyObject* NotSupportedError; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
86 } Connection; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
87 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
88 extern PyTypeObject ConnectionType; |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
89 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
90 PyObject* connection_alloc(PyTypeObject* type, int aware); |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
91 void connection_dealloc(Connection* self); |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
92 PyObject* connection_cursor(Connection* self, PyObject* args, PyObject* kwargs); |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
93 PyObject* connection_close(Connection* self, PyObject* args); |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
94 PyObject* _connection_begin(Connection* self); |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
95 PyObject* connection_begin(Connection* self, PyObject* args); |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
96 PyObject* connection_commit(Connection* self, PyObject* args); |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
97 PyObject* connection_rollback(Connection* self, PyObject* args); |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
98 PyObject* connection_new(PyTypeObject* type, PyObject* args, PyObject* kw); |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
99 int connection_init(Connection* self, PyObject* args, PyObject* kwargs); |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
100 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
101 int check_thread(Connection* self); |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
102 int check_connection(Connection* con); |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
103 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
104 int connection_setup_types(void); |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
105 |
|
e546274d6503
merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents:
diff
changeset
|
106 #endif |
