mysqlclient 2.2.5__cp313-cp313-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
MySQLdb/__init__.py ADDED
@@ -0,0 +1,168 @@
1
+ """
2
+ MySQLdb - A DB API v2.0 compatible interface to MySQL.
3
+
4
+ This package is a wrapper around _mysql, which mostly implements the
5
+ MySQL C API.
6
+
7
+ connect() -- connects to server
8
+
9
+ See the C API specification and the MySQL documentation for more info
10
+ on other items.
11
+
12
+ For information on how MySQLdb handles type conversion, see the
13
+ MySQLdb.converters module.
14
+ """
15
+
16
+ from .release import version_info
17
+ from . import _mysql
18
+
19
+ if version_info != _mysql.version_info:
20
+ raise ImportError(
21
+ f"this is MySQLdb version {version_info}, "
22
+ f"but _mysql is version {_mysql.version_info!r}\n"
23
+ f"_mysql: {_mysql.__file__!r}"
24
+ )
25
+
26
+
27
+ from ._mysql import (
28
+ NotSupportedError,
29
+ OperationalError,
30
+ get_client_info,
31
+ ProgrammingError,
32
+ Error,
33
+ InterfaceError,
34
+ debug,
35
+ IntegrityError,
36
+ string_literal,
37
+ MySQLError,
38
+ DataError,
39
+ DatabaseError,
40
+ InternalError,
41
+ Warning,
42
+ )
43
+ from MySQLdb.constants import FIELD_TYPE
44
+ from MySQLdb.times import (
45
+ Date,
46
+ Time,
47
+ Timestamp,
48
+ DateFromTicks,
49
+ TimeFromTicks,
50
+ TimestampFromTicks,
51
+ )
52
+
53
+ threadsafety = 1
54
+ apilevel = "2.0"
55
+ paramstyle = "format"
56
+
57
+
58
+ class DBAPISet(frozenset):
59
+ """A special type of set for which A == x is true if A is a
60
+ DBAPISet and x is a member of that set."""
61
+
62
+ def __eq__(self, other):
63
+ if isinstance(other, DBAPISet):
64
+ return not self.difference(other)
65
+ return other in self
66
+
67
+
68
+ STRING = DBAPISet([FIELD_TYPE.ENUM, FIELD_TYPE.STRING, FIELD_TYPE.VAR_STRING])
69
+ BINARY = DBAPISet(
70
+ [
71
+ FIELD_TYPE.BLOB,
72
+ FIELD_TYPE.LONG_BLOB,
73
+ FIELD_TYPE.MEDIUM_BLOB,
74
+ FIELD_TYPE.TINY_BLOB,
75
+ ]
76
+ )
77
+ NUMBER = DBAPISet(
78
+ [
79
+ FIELD_TYPE.DECIMAL,
80
+ FIELD_TYPE.DOUBLE,
81
+ FIELD_TYPE.FLOAT,
82
+ FIELD_TYPE.INT24,
83
+ FIELD_TYPE.LONG,
84
+ FIELD_TYPE.LONGLONG,
85
+ FIELD_TYPE.TINY,
86
+ FIELD_TYPE.YEAR,
87
+ FIELD_TYPE.NEWDECIMAL,
88
+ ]
89
+ )
90
+ DATE = DBAPISet([FIELD_TYPE.DATE])
91
+ TIME = DBAPISet([FIELD_TYPE.TIME])
92
+ TIMESTAMP = DBAPISet([FIELD_TYPE.TIMESTAMP, FIELD_TYPE.DATETIME])
93
+ DATETIME = TIMESTAMP
94
+ ROWID = DBAPISet()
95
+
96
+
97
+ def test_DBAPISet_set_equality():
98
+ assert STRING == STRING
99
+
100
+
101
+ def test_DBAPISet_set_inequality():
102
+ assert STRING != NUMBER
103
+
104
+
105
+ def test_DBAPISet_set_equality_membership():
106
+ assert FIELD_TYPE.VAR_STRING == STRING
107
+
108
+
109
+ def test_DBAPISet_set_inequality_membership():
110
+ assert FIELD_TYPE.DATE != STRING
111
+
112
+
113
+ def Binary(x):
114
+ return bytes(x)
115
+
116
+
117
+ def Connect(*args, **kwargs):
118
+ """Factory function for connections.Connection."""
119
+ from MySQLdb.connections import Connection
120
+
121
+ return Connection(*args, **kwargs)
122
+
123
+
124
+ connect = Connection = Connect
125
+
126
+ __all__ = [
127
+ "BINARY",
128
+ "Binary",
129
+ "Connect",
130
+ "Connection",
131
+ "DATE",
132
+ "Date",
133
+ "Time",
134
+ "Timestamp",
135
+ "DateFromTicks",
136
+ "TimeFromTicks",
137
+ "TimestampFromTicks",
138
+ "DataError",
139
+ "DatabaseError",
140
+ "Error",
141
+ "FIELD_TYPE",
142
+ "IntegrityError",
143
+ "InterfaceError",
144
+ "InternalError",
145
+ "MySQLError",
146
+ "NUMBER",
147
+ "NotSupportedError",
148
+ "DBAPISet",
149
+ "OperationalError",
150
+ "ProgrammingError",
151
+ "ROWID",
152
+ "STRING",
153
+ "TIME",
154
+ "TIMESTAMP",
155
+ "Warning",
156
+ "apilevel",
157
+ "connect",
158
+ "connections",
159
+ "constants",
160
+ "converters",
161
+ "cursors",
162
+ "debug",
163
+ "get_client_info",
164
+ "paramstyle",
165
+ "string_literal",
166
+ "threadsafety",
167
+ "version_info",
168
+ ]
MySQLdb/_exceptions.py ADDED
@@ -0,0 +1,91 @@
1
+ """Exception classes for _mysql and MySQLdb.
2
+
3
+ These classes are dictated by the DB API v2.0:
4
+
5
+ https://www.python.org/dev/peps/pep-0249/
6
+ """
7
+
8
+
9
+ class MySQLError(Exception):
10
+ """Exception related to operation with MySQL."""
11
+
12
+ __module__ = "MySQLdb"
13
+
14
+
15
+ class Warning(Warning, MySQLError):
16
+ """Exception raised for important warnings like data truncations
17
+ while inserting, etc."""
18
+
19
+ __module__ = "MySQLdb"
20
+
21
+
22
+ class Error(MySQLError):
23
+ """Exception that is the base class of all other error exceptions
24
+ (not Warning)."""
25
+
26
+ __module__ = "MySQLdb"
27
+
28
+
29
+ class InterfaceError(Error):
30
+ """Exception raised for errors that are related to the database
31
+ interface rather than the database itself."""
32
+
33
+ __module__ = "MySQLdb"
34
+
35
+
36
+ class DatabaseError(Error):
37
+ """Exception raised for errors that are related to the
38
+ database."""
39
+
40
+ __module__ = "MySQLdb"
41
+
42
+
43
+ class DataError(DatabaseError):
44
+ """Exception raised for errors that are due to problems with the
45
+ processed data like division by zero, numeric value out of range,
46
+ etc."""
47
+
48
+ __module__ = "MySQLdb"
49
+
50
+
51
+ class OperationalError(DatabaseError):
52
+ """Exception raised for errors that are related to the database's
53
+ operation and not necessarily under the control of the programmer,
54
+ e.g. an unexpected disconnect occurs, the data source name is not
55
+ found, a transaction could not be processed, a memory allocation
56
+ error occurred during processing, etc."""
57
+
58
+ __module__ = "MySQLdb"
59
+
60
+
61
+ class IntegrityError(DatabaseError):
62
+ """Exception raised when the relational integrity of the database
63
+ is affected, e.g. a foreign key check fails, duplicate key,
64
+ etc."""
65
+
66
+ __module__ = "MySQLdb"
67
+
68
+
69
+ class InternalError(DatabaseError):
70
+ """Exception raised when the database encounters an internal
71
+ error, e.g. the cursor is not valid anymore, the transaction is
72
+ out of sync, etc."""
73
+
74
+ __module__ = "MySQLdb"
75
+
76
+
77
+ class ProgrammingError(DatabaseError):
78
+ """Exception raised for programming errors, e.g. table not found
79
+ or already exists, syntax error in the SQL statement, wrong number
80
+ of parameters specified, etc."""
81
+
82
+ __module__ = "MySQLdb"
83
+
84
+
85
+ class NotSupportedError(DatabaseError):
86
+ """Exception raised in case a method or database API was used
87
+ which is not supported by the database, e.g. requesting a
88
+ .rollback() on a connection that does not support transaction or
89
+ has transactions turned off."""
90
+
91
+ __module__ = "MySQLdb"