Mercurial > p > mysql-python > mysqldb-2
annotate MySQLdb/connections.py @ 72:c0c00294239b MySQLdb
Check in some old changes
author | adustman |
---|---|
date | Thu, 18 Feb 2010 23:47:51 +0000 |
parents | 98d968f5af11 |
children | 80164eb2f090 |
rev | line source |
---|---|
0 | 1 """ |
14 | 2 MySQLdb Connections |
3 ------------------- | |
0 | 4 |
5 This module implements connections for MySQLdb. Presently there is | |
6 only one class: Connection. Others are unlikely. However, you might | |
7 want to make your own subclasses. In most cases, you will probably | |
8 override Connection.default_cursor with a non-standard Cursor class. | |
9 | |
10 """ | |
14 | 11 |
12 __revision__ = "$Revision$"[11:-2] | |
13 __author__ = "$Author$"[9:-2] | |
14 | |
0 | 15 |
16 def defaulterrorhandler(connection, cursor, errorclass, errorvalue): | |
17 """ | |
14 | 18 If cursor is not None, (errorclass, errorvalue) is appended to |
19 cursor.messages; otherwise it is appended to connection.messages. Then | |
20 errorclass is raised with errorvalue as the value. | |
0 | 21 |
14 | 22 You can override this with your own error handler by assigning it to the |
23 instance. | |
0 | 24 """ |
25 error = errorclass, errorvalue | |
26 if cursor: | |
27 cursor.messages.append(error) | |
28 else: | |
29 connection.messages.append(error) | |
30 del cursor | |
31 del connection | |
62 | 32 raise errorclass, errorvalue |
0 | 33 |
34 | |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
35 class Connection(object): |
0 | 36 |
37 """MySQL Database Connection Object""" | |
38 | |
14 | 39 errorhandler = defaulterrorhandler |
0 | 40 |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
41 from MySQLdb.exceptions import Warning, Error, InterfaceError, DataError, \ |
14 | 42 DatabaseError, OperationalError, IntegrityError, InternalError, \ |
43 NotSupportedError, ProgrammingError | |
44 | |
0 | 45 def __init__(self, *args, **kwargs): |
46 """ | |
14 | 47 Create a connection to the database. It is strongly recommended that |
48 you only use keyword parameters. Consult the MySQL C API documentation | |
49 for more information. | |
0 | 50 |
51 host | |
52 string, host to connect | |
53 | |
54 user | |
55 string, user to connect as | |
56 | |
57 passwd | |
58 string, password to use | |
59 | |
60 db | |
61 string, database to use | |
62 | |
63 port | |
64 integer, TCP/IP port to connect to | |
65 | |
66 unix_socket | |
67 string, location of unix_socket to use | |
68 | |
64
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
69 decoders |
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
70 list, SQL decoder stack |
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
71 |
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
72 encoders |
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
73 list, SQL encoder stack |
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
74 |
4 | 75 connect_timeout |
0 | 76 number of seconds to wait before the connection attempt |
77 fails. | |
78 | |
79 compress | |
80 if set, compression is enabled | |
81 | |
82 named_pipe | |
83 if set, a named pipe is used to connect (Windows only) | |
84 | |
85 init_command | |
86 command which is run once the connection is created | |
87 | |
88 read_default_file | |
89 file from which default client values are read | |
90 | |
91 read_default_group | |
92 configuration group to use from the default file | |
93 | |
94 use_unicode | |
95 If True, text-like columns are returned as unicode objects | |
96 using the connection's character set. Otherwise, text-like | |
97 columns are returned as strings. columns are returned as | |
98 normal strings. Unicode objects will always be encoded to | |
99 the connection's character set regardless of this setting. | |
100 | |
101 charset | |
102 If supplied, the connection character set will be changed | |
103 to this character set (MySQL-4.1 and newer). This implies | |
104 use_unicode=True. | |
105 | |
106 sql_mode | |
107 If supplied, the session SQL mode will be changed to this | |
108 setting (MySQL-4.1 and newer). For more details and legal | |
109 values, see the MySQL documentation. | |
110 | |
111 client_flag | |
112 integer, flags to use or 0 | |
113 (see MySQL docs or constants/CLIENTS.py) | |
114 | |
115 ssl | |
116 dictionary or mapping, contains SSL connection parameters; | |
117 see the MySQL documentation for more details | |
118 (mysql_ssl_set()). If this is set, and the client does not | |
1 | 119 support SSL, NotSupportedError will be raised. |
0 | 120 |
121 local_infile | |
122 integer, non-zero enables LOAD LOCAL INFILE; zero disables | |
123 | |
124 There are a number of undocumented, non-standard methods. See the | |
125 documentation for the MySQL C API for some hints on what they do. | |
126 | |
127 """ | |
14 | 128 from MySQLdb.constants import CLIENT, FIELD_TYPE |
64
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
129 from MySQLdb.converters import default_decoders, default_encoders |
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
130 from MySQLdb.converters import simple_type_encoders as conversions |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
131 from MySQLdb.cursors import Cursor |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
132 import _mysql |
46
4093fb968cb7
Bring back conversions for the time being, until we can get trunk actually
kylev
parents:
35
diff
changeset
|
133 |
0 | 134 kwargs2 = kwargs.copy() |
22
597efa4e0311
Trivial patch for dict.has_key() being deprecated going forward.
kylev
parents:
18
diff
changeset
|
135 |
64
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
136 self.cursorclass = Cursor |
0 | 137 charset = kwargs2.pop('charset', '') |
67
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
138 if 'decoder_stack' not in kwargs2: |
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
139 kwargs2['decoder_stack'] = default_decoders; |
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
140 self.encoders = kwargs2.pop('encoders', default_encoders) |
64
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
141 |
0 | 142 client_flag = kwargs.get('client_flag', 0) |
14 | 143 client_version = tuple( |
144 [ int(n) for n in _mysql.get_client_info().split('.')[:2] ]) | |
0 | 145 if client_version >= (4, 1): |
146 client_flag |= CLIENT.MULTI_STATEMENTS | |
147 if client_version >= (5, 0): | |
148 client_flag |= CLIENT.MULTI_RESULTS | |
64
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
149 |
0 | 150 kwargs2['client_flag'] = client_flag |
64
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
151 |
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
152 sql_mode = kwargs2.pop('sql_mode', None) |
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
153 |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
154 self._db = _mysql.connection(*args, **kwargs2) |
0 | 155 |
14 | 156 self._server_version = tuple( |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
157 [ int(n) for n in self._db.get_server_info().split('.')[:2] ]) |
0 | 158 |
64
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
159 if charset: |
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
160 self._db.set_character_set(charset) |
0 | 161 |
162 if sql_mode: | |
163 self.set_sql_mode(sql_mode) | |
164 | |
64
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
165 self._transactional = bool(self._db.server_capabilities & CLIENT.TRANSACTIONS) |
0 | 166 if self._transactional: |
167 # PEP-249 requires autocommit to be initially off | |
168 self.autocommit(False) | |
169 self.messages = [] | |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
170 |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
171 def autocommit(self, do_autocommit): |
72 | 172 self._autocommit = do_autocommit |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
173 return self._db.autocommit(do_autocommit) |
64
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
174 |
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
175 def ping(self, reconnect=False): |
72 | 176 if reconnect and not self._autocommit: |
177 raise ProgrammingError("autocommit must be enabled before enabling auto-reconnect; consider the consequences") | |
64
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
178 return self._db.ping(reconnect) |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
179 |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
180 def commit(self): |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
181 return self._db.commit() |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
182 |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
183 def rollback(self): |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
184 return self._db.rollback() |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
185 |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
186 def close(self): |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
187 return self._db.close() |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
188 |
67
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
189 def escape_string(self, s): |
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
190 return self._db.escape_string(s) |
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
191 |
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
192 def string_literal(self, s): |
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
193 return self._db.string_literal(s) |
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
194 |
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
195 def cursor(self, encoders=None): |
0 | 196 """ |
14 | 197 Create a cursor on which queries may be performed. The optional |
198 cursorclass parameter is used to create the Cursor. By default, | |
199 self.cursorclass=cursors.Cursor is used. | |
0 | 200 """ |
64
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
201 if not encoders: |
67
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
202 encoders = self.encoders[:] |
64
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
203 |
67
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
204 return self.cursorclass(self, encoders) |
0 | 205 |
14 | 206 def __enter__(self): |
207 return self.cursor() | |
9
0e37ee00beb7
Merge changes from 1.2 branch (r470:483): Mostly build-related.
adustman
parents:
5
diff
changeset
|
208 |
14 | 209 def __exit__(self, exc, value, traceback): |
9
0e37ee00beb7
Merge changes from 1.2 branch (r470:483): Mostly build-related.
adustman
parents:
5
diff
changeset
|
210 if exc: |
0e37ee00beb7
Merge changes from 1.2 branch (r470:483): Mostly build-related.
adustman
parents:
5
diff
changeset
|
211 self.rollback() |
0e37ee00beb7
Merge changes from 1.2 branch (r470:483): Mostly build-related.
adustman
parents:
5
diff
changeset
|
212 else: |
0e37ee00beb7
Merge changes from 1.2 branch (r470:483): Mostly build-related.
adustman
parents:
5
diff
changeset
|
213 self.commit() |
0e37ee00beb7
Merge changes from 1.2 branch (r470:483): Mostly build-related.
adustman
parents:
5
diff
changeset
|
214 |
14 | 215 def literal(self, obj): |
0 | 216 """ |
67
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
217 Given an object obj, returns an SQL literal as a string. |
0 | 218 |
67
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
219 Non-standard. |
14 | 220 """ |
67
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
221 for encoder in self.encoders: |
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
222 f = encoder(obj) |
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
223 if f: |
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
224 return f(self, obj) |
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
225 |
98d968f5af11
Reimplement MySQL->Python type conversion in C; much simpler and easier to deal with now. Hey, all my tests pass, so I guess that means I need to write some more tests.
adustman
parents:
64
diff
changeset
|
226 raise self.NotSupportedError("could not encode as SQL", obj) |
0 | 227 |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
228 def _warning_count(self): |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
229 """Return the number of warnings generated from the last query.""" |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
230 if hasattr(self._db, "warning_count"): |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
231 return self._db.warning_count() |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
232 else: |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
233 info = self._db.info() |
0 | 234 if info: |
14 | 235 return int(info.split()[-1]) |
0 | 236 else: |
237 return 0 | |
64
2d6a35051f64
Cursor MixIns: DEAD. More of the new type conversion scheme exposed. Two tests failing because encoding hasn't been finished yet.
adustman
parents:
62
diff
changeset
|
238 |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
239 def character_set_name(self): |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
240 return self._db.character_set_name() |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
241 |
0 | 242 def set_character_set(self, charset): |
14 | 243 """Set the connection character set to charset. The character set can |
244 only be changed in MySQL-4.1 and newer. If you try to change the | |
245 character set from the current value in an older version, | |
15 | 246 NotSupportedError will be raised. |
247 | |
248 Non-standard. It is better to set the character set when creating the | |
249 connection using the charset parameter.""" | |
1 | 250 if self.character_set_name() != charset: |
251 try: | |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
252 self._db.set_character_set(charset) |
1 | 253 except AttributeError: |
254 if self._server_version < (4, 1): | |
35
e7bd07afbcb9
Conflict-filled merge from 1.2br for 558:559 set and exception fixes
kylev
parents:
22
diff
changeset
|
255 raise self.NotSupportedError("server is too old to set charset") |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
256 self._db.query('SET NAMES %s' % charset) |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
257 self._db.store_result() |
0 | 258 self.string_decoder.charset = charset |
259 self.unicode_literal.charset = charset | |
260 | |
261 def set_sql_mode(self, sql_mode): | |
14 | 262 """Set the connection sql_mode. See MySQL documentation for legal |
15 | 263 values. |
264 | |
265 Non-standard. It is better to set this when creating the connection | |
266 using the sql_mode parameter.""" | |
0 | 267 if self._server_version < (4, 1): |
35
e7bd07afbcb9
Conflict-filled merge from 1.2br for 558:559 set and exception fixes
kylev
parents:
22
diff
changeset
|
268 raise self.NotSupportedError("server is too old to set sql_mode") |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
269 self._db.query("SET SESSION sql_mode='%s'" % sql_mode) |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
270 self._db.store_result() |
0 | 271 |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
272 def _show_warnings(self): |
14 | 273 """Return detailed information about warnings as a sequence of tuples |
274 of (Level, Code, Message). This is only supported in MySQL-4.1 and up. | |
15 | 275 If your server is an earlier version, an empty sequence is returned. |
276 | |
277 Non-standard. This is invoked automatically after executing a query, | |
278 so you should not usually call it yourself.""" | |
14 | 279 if self._server_version < (4, 1): return () |
18
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
280 self._db.query("SHOW WARNINGS") |
d55bfb1a4701
Tons of changes from major refactoring/cleanup. This is all really broken
adustman
parents:
15
diff
changeset
|
281 result = self._db.store_result() |
14 | 282 warnings = result.fetch_row(0) |
0 | 283 return warnings |
284 |