comparison MySQLdb/__init__.py @ 18:d55bfb1a4701 MySQLdb

Tons of changes from major refactoring/cleanup. This is all really broken right now. In particular, all results are returned as strings.
author adustman
date Fri, 14 Mar 2008 23:06:29 +0000
parents a275593a1630
children 4a5668deee4a
comparison
equal deleted inserted replaced
17:7c7a89123d65 18:d55bfb1a4701
16 MySQLdb.converters module. 16 MySQLdb.converters module.
17 """ 17 """
18 18
19 __revision__ = """$Revision$"""[11:-2] 19 __revision__ = """$Revision$"""[11:-2]
20 from MySQLdb.release import __version__, version_info, __author__ 20 from MySQLdb.release import __version__, version_info, __author__
21 21 from MySQLdb.exceptions import Warning, Error, InterfaceError, DataError, \
22 import _mysql 22 DatabaseError, OperationalError, IntegrityError, InternalError, \
23 23 NotSupportedError, ProgrammingError
24 if version_info != _mysql.version_info:
25 raise ImportError, \
26 "this is MySQLdb version %s, but _mysql is version %r" % \
27 (version_info, _mysql.version_info)
28 24
29 threadsafety = 1 25 threadsafety = 1
30 apilevel = "2.0" 26 apilevel = "2.0"
31 paramstyle = "format" 27 paramstyle = "format"
32 28
33 from _mysql import *
34 from MySQLdb.constants import FIELD_TYPE 29 from MySQLdb.constants import FIELD_TYPE
35 from MySQLdb.times import Date, Time, Timestamp, \ 30 from MySQLdb.times import Date, Time, Timestamp, \
36 DateFromTicks, TimeFromTicks, TimestampFromTicks 31 DateFromTicks, TimeFromTicks, TimestampFromTicks
37 32
38 from sets import ImmutableSet 33 from sets import ImmutableSet
40 class DBAPISet(ImmutableSet): 35 class DBAPISet(ImmutableSet):
41 36
42 """A special type of set for which A == x is True if A is a 37 """A special type of set for which A == x is True if A is a
43 DBAPISet and x is a member of that set. 38 DBAPISet and x is a member of that set.
44 39
40 >>> from MySQLdb.constants import FIELD_TYPE
45 >>> FIELD_TYPE.VAR_STRING == STRING 41 >>> FIELD_TYPE.VAR_STRING == STRING
46 True 42 True
47 >>> FIELD_TYPE.DATE == NUMBER 43 >>> FIELD_TYPE.DATE == NUMBER
48 False 44 False
49 >>> FIELD_TYPE.DATE != DATE 45 >>> FIELD_TYPE.DATE != DATE
88 from MySQLdb.connections import Connection 84 from MySQLdb.connections import Connection
89 return Connection(*args, **kwargs) 85 return Connection(*args, **kwargs)
90 86
91 connect = Connection = Connect 87 connect = Connection = Connect
92 88
93 __all__ = [ 'BINARY', 'Binary', 'Connect', 'Connection', 'DATE', 'Date', 89 __all__ = [
94 'Time', 'Timestamp', 'DateFromTicks', 'TimeFromTicks', 'TimestampFromTicks', 90 'BINARY', 'Binary', 'Connect', 'Connection', 'DATE', 'Date',
95 'DataError', 'DatabaseError', 'Error', 'FIELD_TYPE', 'IntegrityError', 91 'Time', 'Timestamp', 'DateFromTicks', 'TimeFromTicks', 'TimestampFromTicks',
96 'InterfaceError', 'InternalError', 'MySQLError', 'NULL', 'NUMBER', 92 'DataError', 'DatabaseError', 'Error', 'FIELD_TYPE', 'IntegrityError',
97 'NotSupportedError', 'DBAPISet', 'OperationalError', 'ProgrammingError', 93 'InterfaceError', 'InternalError', 'MySQLError', 'NULL', 'NUMBER',
98 'ROWID', 'STRING', 'TIME', 'TIMESTAMP', 'Warning', 'apilevel', 'connect', 94 'NotSupportedError', 'DBAPISet', 'OperationalError', 'ProgrammingError',
99 'connections', 'constants', 'converters', 'cursors', 'debug', 'escape', 95 'ROWID', 'STRING', 'TIME', 'TIMESTAMP', 'Warning', 'apilevel', 'connect',
100 'escape_dict', 'escape_sequence', 'escape_string', 'get_client_info', 96 'connections', 'constants', 'converters', 'cursors', 'debug', 'escape',
101 'paramstyle', 'string_literal', 'threadsafety', 'version_info'] 97 'escape_dict', 'escape_sequence', 'escape_string', 'get_client_info',
98 'paramstyle', 'string_literal', 'threadsafety', 'version_info',
99 ]
102 100
103 101
104 if __name__ == "__main__": 102 if __name__ == "__main__":
105 import doctest 103 import doctest
106 doctest.testmod() 104 doctest.testmod()