1 """MySQLdb - A DB API v2.0 compatible interface to MySQL.
2
3 This package is a wrapper around _mysql, which mostly implements the
4 MySQL C API.
5
6 connect() -- connects to server
7
8 See the C API specification and the MySQL documentation for more info
9 on other items.
10
11 For information on how MySQLdb handles type conversion, see the
12 MySQLdb.converters module.
13
14 """
15
16 __revision__ = """$Revision: 491 $"""[11:-2]
17 from release import __version__, version_info, __author__
18
19 import _mysql
20
21 if version_info != _mysql.version_info:
22 raise ImportError, "this is MySQLdb version %s, but _mysql is version %r" %\
23 (version_info, _mysql.version_info)
24
25 threadsafety = 1
26 apilevel = "2.0"
27 paramstyle = "format"
28
29 from _mysql import *
30 from MySQLdb.constants import FIELD_TYPE
31 from MySQLdb.times import Date, Time, Timestamp, \
32 DateFromTicks, TimeFromTicks, TimestampFromTicks
33
34 from sets import ImmutableSet
36
37 """A special type of set for which A == x is true if A is a
38 DBAPISet and x is a member of that set."""
39
41 from sets import BaseSet
42 if isinstance(other, BaseSet):
43 return super(DBAPISet.self).__ne__(self, other)
44 else:
45 return other not in self
46
48 from sets import BaseSet
49 if isinstance(other, BaseSet):
50 return super(DBAPISet, self).__eq__(self, other)
51 else:
52 return other in self
53
54
55 STRING = DBAPISet([FIELD_TYPE.ENUM, FIELD_TYPE.STRING,
56 FIELD_TYPE.VAR_STRING])
57 BINARY = DBAPISet([FIELD_TYPE.BLOB, FIELD_TYPE.LONG_BLOB,
58 FIELD_TYPE.MEDIUM_BLOB, FIELD_TYPE.TINY_BLOB])
59 NUMBER = DBAPISet([FIELD_TYPE.DECIMAL, FIELD_TYPE.DOUBLE, FIELD_TYPE.FLOAT,
60 FIELD_TYPE.INT24, FIELD_TYPE.LONG, FIELD_TYPE.LONGLONG,
61 FIELD_TYPE.TINY, FIELD_TYPE.YEAR])
62 DATE = DBAPISet([FIELD_TYPE.DATE, FIELD_TYPE.NEWDATE])
63 TIME = DBAPISet([FIELD_TYPE.TIME])
64 TIMESTAMP = DBAPISet([FIELD_TYPE.TIMESTAMP, FIELD_TYPE.DATETIME])
65 DATETIME = TIMESTAMP
66 ROWID = DBAPISet()
67
70
75
76 connect = Connection = Connect
77
78 __all__ = [ 'BINARY', 'Binary', 'Connect', 'Connection', 'DATE',
79 'Date', 'Time', 'Timestamp', 'DateFromTicks', 'TimeFromTicks',
80 'TimestampFromTicks', 'DataError', 'DatabaseError', 'Error',
81 'FIELD_TYPE', 'IntegrityError', 'InterfaceError', 'InternalError',
82 'MySQLError', 'NULL', 'NUMBER', 'NotSupportedError', 'DBAPISet',
83 'OperationalError', 'ProgrammingError', 'ROWID', 'STRING', 'TIME',
84 'TIMESTAMP', 'Warning', 'apilevel', 'connect', 'connections',
85 'constants', 'converters', 'cursors', 'debug', 'escape', 'escape_dict',
86 'escape_sequence', 'escape_string', 'get_client_info',
87 'paramstyle', 'string_literal', 'threadsafety', 'version_info']
88