mysqlx-connector-python 8.3.0__py2.py3-none-any.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.
- mysqlx/__init__.py +136 -0
- mysqlx/authentication.py +186 -0
- mysqlx/charsets.py +620 -0
- mysqlx/connection.py +3364 -0
- mysqlx/constants.py +297 -0
- mysqlx/crud.py +776 -0
- mysqlx/dbdoc.py +120 -0
- mysqlx/errorcode.py +1877 -0
- mysqlx/errors.py +257 -0
- mysqlx/expr.py +1366 -0
- mysqlx/helpers.py +234 -0
- mysqlx/locales/__init__.py +80 -0
- mysqlx/locales/eng/__init__.py +30 -0
- mysqlx/locales/eng/client_error.py +152 -0
- mysqlx/logger.py +33 -0
- mysqlx/protobuf/__init__.py +627 -0
- mysqlx/protobuf/mysqlx_connection_pb2.py +74 -0
- mysqlx/protobuf/mysqlx_crud_pb2.py +108 -0
- mysqlx/protobuf/mysqlx_cursor_pb2.py +68 -0
- mysqlx/protobuf/mysqlx_datatypes_pb2.py +75 -0
- mysqlx/protobuf/mysqlx_expect_pb2.py +69 -0
- mysqlx/protobuf/mysqlx_expr_pb2.py +81 -0
- mysqlx/protobuf/mysqlx_notice_pb2.py +81 -0
- mysqlx/protobuf/mysqlx_pb2.py +71 -0
- mysqlx/protobuf/mysqlx_prepare_pb2.py +73 -0
- mysqlx/protobuf/mysqlx_resultset_pb2.py +75 -0
- mysqlx/protobuf/mysqlx_session_pb2.py +67 -0
- mysqlx/protobuf/mysqlx_sql_pb2.py +63 -0
- mysqlx/protocol.py +1214 -0
- mysqlx/py.typed +0 -0
- mysqlx/result.py +1177 -0
- mysqlx/statement.py +1542 -0
- mysqlx/types.py +92 -0
- mysqlx/utils.py +136 -0
- mysqlx/version.py +46 -0
- mysqlx_connector_python-8.3.0.dist-info/LICENSE.txt +4211 -0
- mysqlx_connector_python-8.3.0.dist-info/METADATA +43 -0
- mysqlx_connector_python-8.3.0.dist-info/RECORD +40 -0
- mysqlx_connector_python-8.3.0.dist-info/WHEEL +6 -0
- mysqlx_connector_python-8.3.0.dist-info/top_level.txt +1 -0
mysqlx/helpers.py
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software; you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU General Public License, version 2.0, as
|
|
5
|
+
# published by the Free Software Foundation.
|
|
6
|
+
#
|
|
7
|
+
# This program is also distributed with certain software (including
|
|
8
|
+
# but not limited to OpenSSL) that is licensed under separate terms,
|
|
9
|
+
# as designated in a particular file or component or in included license
|
|
10
|
+
# documentation. The authors of MySQL hereby grant you an
|
|
11
|
+
# additional permission to link the program and your derivative works
|
|
12
|
+
# with the separately licensed software that they have included with
|
|
13
|
+
# MySQL.
|
|
14
|
+
#
|
|
15
|
+
# Without limiting anything contained in the foregoing, this file,
|
|
16
|
+
# which is part of MySQL Connector/Python, is also subject to the
|
|
17
|
+
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
|
18
|
+
# http://oss.oracle.com/licenses/universal-foss-exception.
|
|
19
|
+
#
|
|
20
|
+
# This program is distributed in the hope that it will be useful, but
|
|
21
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
23
|
+
# See the GNU General Public License, version 2.0, for more details.
|
|
24
|
+
#
|
|
25
|
+
# You should have received a copy of the GNU General Public License
|
|
26
|
+
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
|
27
|
+
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
28
|
+
|
|
29
|
+
"""This module contains helper functions."""
|
|
30
|
+
|
|
31
|
+
import binascii
|
|
32
|
+
import decimal
|
|
33
|
+
import functools
|
|
34
|
+
import inspect
|
|
35
|
+
import warnings
|
|
36
|
+
|
|
37
|
+
from typing import Any, Callable, List, Optional, Union
|
|
38
|
+
|
|
39
|
+
from .constants import TLS_CIPHER_SUITES, TLS_VERSIONS
|
|
40
|
+
from .errors import InterfaceError
|
|
41
|
+
from .types import EscapeTypes, StrOrBytes
|
|
42
|
+
|
|
43
|
+
BYTE_TYPES = (bytearray, bytes)
|
|
44
|
+
NUMERIC_TYPES = (int, float, decimal.Decimal)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def encode_to_bytes(value: StrOrBytes, encoding: str = "utf-8") -> bytes:
|
|
48
|
+
"""Returns an encoded version of the string as a bytes object.
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
encoding (str): The encoding.
|
|
52
|
+
|
|
53
|
+
Resturns:
|
|
54
|
+
bytes: The encoded version of the string as a bytes object.
|
|
55
|
+
"""
|
|
56
|
+
return value if isinstance(value, bytes) else value.encode(encoding)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def decode_from_bytes(value: StrOrBytes, encoding: str = "utf-8") -> str:
|
|
60
|
+
"""Returns a string decoded from the given bytes.
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
value (bytes): The value to be decoded.
|
|
64
|
+
encoding (str): The encoding.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
str: The value decoded from bytes.
|
|
68
|
+
"""
|
|
69
|
+
return value.decode(encoding) if isinstance(value, bytes) else value
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def get_item_or_attr(obj: object, key: str) -> Any:
|
|
73
|
+
"""Get item from dictionary or attribute from object.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
obj (object): Dictionary or object.
|
|
77
|
+
key (str): Key.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
object: The object for the provided key.
|
|
81
|
+
"""
|
|
82
|
+
return obj[key] if isinstance(obj, dict) else getattr(obj, key)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def escape(*args: EscapeTypes) -> Union[EscapeTypes, List[EscapeTypes]]:
|
|
86
|
+
"""Escapes special characters as they are expected to be when MySQL
|
|
87
|
+
receives them.
|
|
88
|
+
As found in MySQL source mysys/charset.c
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
value (object): Value to be escaped.
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
str: The value if not a string, or the escaped string.
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
def _escape(value: EscapeTypes) -> EscapeTypes:
|
|
98
|
+
"""Escapes special characters."""
|
|
99
|
+
if value is None:
|
|
100
|
+
return value
|
|
101
|
+
if isinstance(value, NUMERIC_TYPES):
|
|
102
|
+
return value
|
|
103
|
+
if isinstance(value, (bytes, bytearray)):
|
|
104
|
+
value = value.replace(b"\\", b"\\\\")
|
|
105
|
+
value = value.replace(b"\n", b"\\n")
|
|
106
|
+
value = value.replace(b"\r", b"\\r")
|
|
107
|
+
value = value.replace(b"\047", b"\134\047") # single quotes
|
|
108
|
+
value = value.replace(b"\042", b"\134\042") # double quotes
|
|
109
|
+
value = value.replace(b"\032", b"\134\032") # for Win32
|
|
110
|
+
else:
|
|
111
|
+
value = value.replace("\\", "\\\\")
|
|
112
|
+
value = value.replace("\n", "\\n")
|
|
113
|
+
value = value.replace("\r", "\\r")
|
|
114
|
+
value = value.replace("\047", "\134\047") # single quotes
|
|
115
|
+
value = value.replace("\042", "\134\042") # double quotes
|
|
116
|
+
value = value.replace("\032", "\134\032") # for Win32
|
|
117
|
+
return value
|
|
118
|
+
|
|
119
|
+
if len(args) > 1:
|
|
120
|
+
return [_escape(arg) for arg in args]
|
|
121
|
+
return _escape(args[0])
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def quote_identifier(identifier: str, sql_mode: str = "") -> str:
|
|
125
|
+
"""Quote the given identifier with backticks, converting backticks (`)
|
|
126
|
+
in the identifier name with the correct escape sequence (``) unless the
|
|
127
|
+
identifier is quoted (") as in sql_mode set to ANSI_QUOTES.
|
|
128
|
+
|
|
129
|
+
Args:
|
|
130
|
+
identifier (str): Identifier to quote.
|
|
131
|
+
|
|
132
|
+
Returns:
|
|
133
|
+
str: Returns string with the identifier quoted with backticks.
|
|
134
|
+
"""
|
|
135
|
+
if sql_mode == "ANSI_QUOTES":
|
|
136
|
+
quoted = identifier.replace('"', '""')
|
|
137
|
+
return f'"{quoted}"'
|
|
138
|
+
quoted = identifier.replace("`", "``")
|
|
139
|
+
return f"`{quoted}`"
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def deprecated(version: Optional[str] = None, reason: Optional[str] = None) -> Callable:
|
|
143
|
+
"""This is a decorator used to mark functions as deprecated.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
version (Optional[string]): Version when was deprecated.
|
|
147
|
+
reason (Optional[string]): Reason or extra information to be shown.
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
Callable: A decorator used to mark functions as deprecated.
|
|
151
|
+
|
|
152
|
+
Usage:
|
|
153
|
+
|
|
154
|
+
.. code-block:: python
|
|
155
|
+
|
|
156
|
+
from mysqlx.helpers import deprecated
|
|
157
|
+
|
|
158
|
+
@deprecated('8.0.12', 'Please use other_function() instead')
|
|
159
|
+
def deprecated_function(x, y):
|
|
160
|
+
return x + y
|
|
161
|
+
"""
|
|
162
|
+
|
|
163
|
+
def decorate(func: Callable) -> Callable:
|
|
164
|
+
"""Decorate function."""
|
|
165
|
+
|
|
166
|
+
@functools.wraps(func)
|
|
167
|
+
def wrapper(*args: Any, **kwargs: Any) -> Callable:
|
|
168
|
+
"""Wrapper function.
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
*args: Variable length argument list.
|
|
172
|
+
**kwargs: Arbitrary keyword arguments.
|
|
173
|
+
"""
|
|
174
|
+
message = [f"'{func.__name__}' is deprecated"]
|
|
175
|
+
if version:
|
|
176
|
+
message.append(f" since version {version}")
|
|
177
|
+
if reason:
|
|
178
|
+
message.append(f". {reason}")
|
|
179
|
+
frame = inspect.currentframe().f_back
|
|
180
|
+
warnings.warn_explicit(
|
|
181
|
+
"".join(message),
|
|
182
|
+
category=DeprecationWarning,
|
|
183
|
+
filename=inspect.getfile(frame.f_code),
|
|
184
|
+
lineno=frame.f_lineno,
|
|
185
|
+
)
|
|
186
|
+
return func(*args, **kwargs)
|
|
187
|
+
|
|
188
|
+
return wrapper
|
|
189
|
+
|
|
190
|
+
return decorate
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def iani_to_openssl_cs_name(
|
|
194
|
+
tls_version: str, cipher_suites_names: List[str]
|
|
195
|
+
) -> List[str]:
|
|
196
|
+
"""Translates a cipher suites names list; from IANI names to OpenSSL names.
|
|
197
|
+
|
|
198
|
+
Args:
|
|
199
|
+
TLS_version (str): The TLS version to look at for a translation.
|
|
200
|
+
cipher_suite_names (list): A list of cipher suites names.
|
|
201
|
+
|
|
202
|
+
Returns:
|
|
203
|
+
List[str]: List of translated names.
|
|
204
|
+
"""
|
|
205
|
+
translated_names = []
|
|
206
|
+
|
|
207
|
+
cipher_suites = {} # TLS_CIPHER_SUITES[TLS_version]
|
|
208
|
+
|
|
209
|
+
# Find the previews TLS versions of the given on TLS_version
|
|
210
|
+
for index in range(TLS_VERSIONS.index(tls_version) + 1):
|
|
211
|
+
cipher_suites.update(TLS_CIPHER_SUITES[TLS_VERSIONS[index]])
|
|
212
|
+
|
|
213
|
+
for name in cipher_suites_names:
|
|
214
|
+
if "-" in name:
|
|
215
|
+
translated_names.append(name)
|
|
216
|
+
elif name in cipher_suites:
|
|
217
|
+
translated_names.append(cipher_suites[name])
|
|
218
|
+
else:
|
|
219
|
+
raise InterfaceError(
|
|
220
|
+
f"The '{name}' in cipher suites is not a valid cipher suite"
|
|
221
|
+
)
|
|
222
|
+
return translated_names
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def hexlify(data: bytes) -> str:
|
|
226
|
+
"""Return the hexadecimal representation of the binary data.
|
|
227
|
+
|
|
228
|
+
Args:
|
|
229
|
+
data (bytes): The binary data.
|
|
230
|
+
|
|
231
|
+
Returns:
|
|
232
|
+
str: The decoded hexadecimal representation of data.
|
|
233
|
+
"""
|
|
234
|
+
return binascii.hexlify(data).decode("utf-8")
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software; you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU General Public License, version 2.0, as
|
|
5
|
+
# published by the Free Software Foundation.
|
|
6
|
+
#
|
|
7
|
+
# This program is also distributed with certain software (including
|
|
8
|
+
# but not limited to OpenSSL) that is licensed under separate terms,
|
|
9
|
+
# as designated in a particular file or component or in included license
|
|
10
|
+
# documentation. The authors of MySQL hereby grant you an
|
|
11
|
+
# additional permission to link the program and your derivative works
|
|
12
|
+
# with the separately licensed software that they have included with
|
|
13
|
+
# MySQL.
|
|
14
|
+
#
|
|
15
|
+
# Without limiting anything contained in the foregoing, this file,
|
|
16
|
+
# which is part of MySQL Connector/Python, is also subject to the
|
|
17
|
+
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
|
18
|
+
# http://oss.oracle.com/licenses/universal-foss-exception.
|
|
19
|
+
#
|
|
20
|
+
# This program is distributed in the hope that it will be useful, but
|
|
21
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
23
|
+
# See the GNU General Public License, version 2.0, for more details.
|
|
24
|
+
#
|
|
25
|
+
# You should have received a copy of the GNU General Public License
|
|
26
|
+
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
|
27
|
+
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
28
|
+
|
|
29
|
+
"""Translations."""
|
|
30
|
+
|
|
31
|
+
__all__ = ["get_client_error"]
|
|
32
|
+
|
|
33
|
+
from typing import Optional, Union
|
|
34
|
+
|
|
35
|
+
from .. import errorcode
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def get_client_error(error: Union[int, str], language: str = "eng") -> Optional[str]:
|
|
39
|
+
"""Lookup client error
|
|
40
|
+
|
|
41
|
+
This function will lookup the client error message based on the given
|
|
42
|
+
error and return the error message. If the error was not found,
|
|
43
|
+
None will be returned.
|
|
44
|
+
|
|
45
|
+
Error can be either an integer or a string. For example:
|
|
46
|
+
error: 2000
|
|
47
|
+
error: CR_UNKNOWN_ERROR
|
|
48
|
+
|
|
49
|
+
The language attribute can be used to retrieve a localized message, when
|
|
50
|
+
available.
|
|
51
|
+
|
|
52
|
+
Returns a string or None.
|
|
53
|
+
"""
|
|
54
|
+
try:
|
|
55
|
+
tmp = __import__(
|
|
56
|
+
f"mysqlx.locales.{language}",
|
|
57
|
+
globals(),
|
|
58
|
+
locals(),
|
|
59
|
+
["client_error"],
|
|
60
|
+
)
|
|
61
|
+
except ImportError:
|
|
62
|
+
raise ImportError(
|
|
63
|
+
f"No localization support for language '{language}'"
|
|
64
|
+
) from None
|
|
65
|
+
client_error = tmp.client_error
|
|
66
|
+
|
|
67
|
+
if isinstance(error, int):
|
|
68
|
+
errno = error
|
|
69
|
+
for key, value in errorcode.__dict__.items():
|
|
70
|
+
if value == errno:
|
|
71
|
+
error = key
|
|
72
|
+
break
|
|
73
|
+
|
|
74
|
+
if isinstance(error, (str)):
|
|
75
|
+
try:
|
|
76
|
+
return getattr(client_error, error)
|
|
77
|
+
except AttributeError:
|
|
78
|
+
return None
|
|
79
|
+
|
|
80
|
+
raise ValueError("error argument needs to be either an integer or string")
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software; you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU General Public License, version 2.0, as
|
|
5
|
+
# published by the Free Software Foundation.
|
|
6
|
+
#
|
|
7
|
+
# This program is also distributed with certain software (including
|
|
8
|
+
# but not limited to OpenSSL) that is licensed under separate terms,
|
|
9
|
+
# as designated in a particular file or component or in included license
|
|
10
|
+
# documentation. The authors of MySQL hereby grant you an
|
|
11
|
+
# additional permission to link the program and your derivative works
|
|
12
|
+
# with the separately licensed software that they have included with
|
|
13
|
+
# MySQL.
|
|
14
|
+
#
|
|
15
|
+
# Without limiting anything contained in the foregoing, this file,
|
|
16
|
+
# which is part of MySQL Connector/Python, is also subject to the
|
|
17
|
+
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
|
18
|
+
# http://oss.oracle.com/licenses/universal-foss-exception.
|
|
19
|
+
#
|
|
20
|
+
# This program is distributed in the hope that it will be useful, but
|
|
21
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
23
|
+
# See the GNU General Public License, version 2.0, for more details.
|
|
24
|
+
#
|
|
25
|
+
# You should have received a copy of the GNU General Public License
|
|
26
|
+
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
|
27
|
+
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
28
|
+
|
|
29
|
+
"""English Content
|
|
30
|
+
"""
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
# Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
|
|
4
|
+
#
|
|
5
|
+
# This program is free software; you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU General Public License, version 2.0, as
|
|
7
|
+
# published by the Free Software Foundation.
|
|
8
|
+
#
|
|
9
|
+
# This program is also distributed with certain software (including
|
|
10
|
+
# but not limited to OpenSSL) that is licensed under separate terms,
|
|
11
|
+
# as designated in a particular file or component or in included license
|
|
12
|
+
# documentation. The authors of MySQL hereby grant you an
|
|
13
|
+
# additional permission to link the program and your derivative works
|
|
14
|
+
# with the separately licensed software that they have included with
|
|
15
|
+
# MySQL.
|
|
16
|
+
#
|
|
17
|
+
# Without limiting anything contained in the foregoing, this file,
|
|
18
|
+
# which is part of MySQL Connector/Python, is also subject to the
|
|
19
|
+
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
|
20
|
+
# http://oss.oracle.com/licenses/universal-foss-exception.
|
|
21
|
+
#
|
|
22
|
+
# This program is distributed in the hope that it will be useful, but
|
|
23
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
24
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
25
|
+
# See the GNU General Public License, version 2.0, for more details.
|
|
26
|
+
#
|
|
27
|
+
# You should have received a copy of the GNU General Public License
|
|
28
|
+
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
|
29
|
+
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
30
|
+
|
|
31
|
+
"""MySQL Error Messages."""
|
|
32
|
+
|
|
33
|
+
# This file was auto-generated.
|
|
34
|
+
_GENERATED_ON = "2021-08-11"
|
|
35
|
+
_MYSQL_VERSION = (8, 0, 27)
|
|
36
|
+
|
|
37
|
+
# pylint: disable=line-too-long
|
|
38
|
+
# Start MySQL Error messages
|
|
39
|
+
CR_UNKNOWN_ERROR = "Unknown MySQL error"
|
|
40
|
+
CR_SOCKET_CREATE_ERROR = "Can't create UNIX socket (%s)"
|
|
41
|
+
CR_CONNECTION_ERROR = (
|
|
42
|
+
"Can't connect to local MySQL server through socket '%-.100s' (%s)"
|
|
43
|
+
)
|
|
44
|
+
CR_CONN_HOST_ERROR = "Can't connect to MySQL server on '%-.100s:%u' (%s)"
|
|
45
|
+
CR_IPSOCK_ERROR = "Can't create TCP/IP socket (%s)"
|
|
46
|
+
CR_UNKNOWN_HOST = "Unknown MySQL server host '%-.100s' (%s)"
|
|
47
|
+
CR_SERVER_GONE_ERROR = "MySQL server has gone away"
|
|
48
|
+
CR_VERSION_ERROR = "Protocol mismatch; server version = %s, client version = %s"
|
|
49
|
+
CR_OUT_OF_MEMORY = "MySQL client ran out of memory"
|
|
50
|
+
CR_WRONG_HOST_INFO = "Wrong host info"
|
|
51
|
+
CR_LOCALHOST_CONNECTION = "Localhost via UNIX socket"
|
|
52
|
+
CR_TCP_CONNECTION = "%-.100s via TCP/IP"
|
|
53
|
+
CR_SERVER_HANDSHAKE_ERR = "Error in server handshake"
|
|
54
|
+
CR_SERVER_LOST = "Lost connection to MySQL server during query"
|
|
55
|
+
CR_COMMANDS_OUT_OF_SYNC = "Commands out of sync; you can't run this command now"
|
|
56
|
+
CR_NAMEDPIPE_CONNECTION = "Named pipe: %-.32s"
|
|
57
|
+
CR_NAMEDPIPEWAIT_ERROR = "Can't wait for named pipe to host: %-.64s pipe: %-.32s (%s)"
|
|
58
|
+
CR_NAMEDPIPEOPEN_ERROR = "Can't open named pipe to host: %-.64s pipe: %-.32s (%s)"
|
|
59
|
+
CR_NAMEDPIPESETSTATE_ERROR = (
|
|
60
|
+
"Can't set state of named pipe to host: %-.64s pipe: %-.32s (%s)"
|
|
61
|
+
)
|
|
62
|
+
CR_CANT_READ_CHARSET = "Can't initialize character set %-.32s (path: %-.100s)"
|
|
63
|
+
CR_NET_PACKET_TOO_LARGE = "Got packet bigger than 'max_allowed_packet' bytes"
|
|
64
|
+
CR_EMBEDDED_CONNECTION = "Embedded server"
|
|
65
|
+
CR_PROBE_SLAVE_STATUS = "Error on SHOW SLAVE STATUS:"
|
|
66
|
+
CR_PROBE_SLAVE_HOSTS = "Error on SHOW SLAVE HOSTS:"
|
|
67
|
+
CR_PROBE_SLAVE_CONNECT = "Error connecting to slave:"
|
|
68
|
+
CR_PROBE_MASTER_CONNECT = "Error connecting to master:"
|
|
69
|
+
CR_SSL_CONNECTION_ERROR = "SSL connection error: %-.100s"
|
|
70
|
+
CR_MALFORMED_PACKET = "Malformed packet"
|
|
71
|
+
CR_WRONG_LICENSE = "This client library is licensed only for use with MySQL servers having '%s' license"
|
|
72
|
+
CR_NULL_POINTER = "Invalid use of null pointer"
|
|
73
|
+
CR_NO_PREPARE_STMT = "Statement not prepared"
|
|
74
|
+
CR_PARAMS_NOT_BOUND = "No data supplied for parameters in prepared statement"
|
|
75
|
+
CR_DATA_TRUNCATED = "Data truncated"
|
|
76
|
+
CR_NO_PARAMETERS_EXISTS = "No parameters exist in the statement"
|
|
77
|
+
CR_INVALID_PARAMETER_NO = "Invalid parameter number"
|
|
78
|
+
CR_INVALID_BUFFER_USE = (
|
|
79
|
+
"Can't send long data for non-string/non-binary data types (parameter: %s)"
|
|
80
|
+
)
|
|
81
|
+
CR_UNSUPPORTED_PARAM_TYPE = "Using unsupported buffer type: %s (parameter: %s)"
|
|
82
|
+
CR_SHARED_MEMORY_CONNECTION = "Shared memory: %-.100s"
|
|
83
|
+
CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR = (
|
|
84
|
+
"Can't open shared memory; client could not create request event (%s)"
|
|
85
|
+
)
|
|
86
|
+
CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR = (
|
|
87
|
+
"Can't open shared memory; no answer event received from server (%s)"
|
|
88
|
+
)
|
|
89
|
+
CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR = (
|
|
90
|
+
"Can't open shared memory; server could not allocate file mapping (%s)"
|
|
91
|
+
)
|
|
92
|
+
CR_SHARED_MEMORY_CONNECT_MAP_ERROR = (
|
|
93
|
+
"Can't open shared memory; server could not get pointer to file mapping (%s)"
|
|
94
|
+
)
|
|
95
|
+
CR_SHARED_MEMORY_FILE_MAP_ERROR = (
|
|
96
|
+
"Can't open shared memory; client could not allocate file mapping (%s)"
|
|
97
|
+
)
|
|
98
|
+
CR_SHARED_MEMORY_MAP_ERROR = (
|
|
99
|
+
"Can't open shared memory; client could not get pointer to file mapping (%s)"
|
|
100
|
+
)
|
|
101
|
+
CR_SHARED_MEMORY_EVENT_ERROR = (
|
|
102
|
+
"Can't open shared memory; client could not create %s event (%s)"
|
|
103
|
+
)
|
|
104
|
+
CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR = (
|
|
105
|
+
"Can't open shared memory; no answer from server (%s)"
|
|
106
|
+
)
|
|
107
|
+
CR_SHARED_MEMORY_CONNECT_SET_ERROR = (
|
|
108
|
+
"Can't open shared memory; cannot send request event to server (%s)"
|
|
109
|
+
)
|
|
110
|
+
CR_CONN_UNKNOW_PROTOCOL = "Wrong or unknown protocol"
|
|
111
|
+
CR_INVALID_CONN_HANDLE = "Invalid connection handle"
|
|
112
|
+
CR_UNUSED_1 = "Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)"
|
|
113
|
+
CR_FETCH_CANCELED = "Row retrieval was canceled by mysql_stmt_close() call"
|
|
114
|
+
CR_NO_DATA = "Attempt to read column without prior row fetch"
|
|
115
|
+
CR_NO_STMT_METADATA = "Prepared statement contains no metadata"
|
|
116
|
+
CR_NO_RESULT_SET = (
|
|
117
|
+
"Attempt to read a row while there is no result set associated with the statement"
|
|
118
|
+
)
|
|
119
|
+
CR_NOT_IMPLEMENTED = "This feature is not implemented yet"
|
|
120
|
+
CR_SERVER_LOST_EXTENDED = "Lost connection to MySQL server at '%s', system error: %s"
|
|
121
|
+
CR_STMT_CLOSED = "Statement closed indirectly because of a preceding %s() call"
|
|
122
|
+
CR_NEW_STMT_METADATA = "The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again"
|
|
123
|
+
CR_ALREADY_CONNECTED = (
|
|
124
|
+
"This handle is already connected. Use a separate handle for each connection."
|
|
125
|
+
)
|
|
126
|
+
CR_AUTH_PLUGIN_CANNOT_LOAD = "Authentication plugin '%s' cannot be loaded: %s"
|
|
127
|
+
CR_DUPLICATE_CONNECTION_ATTR = "There is an attribute with the same name already"
|
|
128
|
+
CR_AUTH_PLUGIN_ERR = "Authentication plugin '%s' reported error: %s"
|
|
129
|
+
CR_INSECURE_API_ERR = "Insecure API function call: '%s' Use instead: '%s'"
|
|
130
|
+
CR_FILE_NAME_TOO_LONG = "File name is too long"
|
|
131
|
+
CR_SSL_FIPS_MODE_ERR = "Set FIPS mode ON/STRICT failed"
|
|
132
|
+
CR_DEPRECATED_COMPRESSION_NOT_SUPPORTED = (
|
|
133
|
+
"Compression protocol not supported with asynchronous protocol"
|
|
134
|
+
)
|
|
135
|
+
CR_COMPRESSION_WRONGLY_CONFIGURED = (
|
|
136
|
+
"Connection failed due to wrongly configured compression algorithm"
|
|
137
|
+
)
|
|
138
|
+
CR_KERBEROS_USER_NOT_FOUND = (
|
|
139
|
+
"SSO user not found, Please perform SSO authentication using kerberos."
|
|
140
|
+
)
|
|
141
|
+
CR_LOAD_DATA_LOCAL_INFILE_REJECTED = (
|
|
142
|
+
"LOAD DATA LOCAL INFILE file request rejected due to restrictions on access."
|
|
143
|
+
)
|
|
144
|
+
CR_LOAD_DATA_LOCAL_INFILE_REALPATH_FAIL = (
|
|
145
|
+
"Determining the real path for '%s' failed with error (%s): %s"
|
|
146
|
+
)
|
|
147
|
+
CR_DNS_SRV_LOOKUP_FAILED = "DNS SRV lookup failed with error : %s"
|
|
148
|
+
CR_MANDATORY_TRACKER_NOT_FOUND = (
|
|
149
|
+
"Client does not recognise tracker type %s marked as mandatory by server."
|
|
150
|
+
)
|
|
151
|
+
CR_INVALID_FACTOR_NO = "Invalid first argument for MYSQL_OPT_USER_PASSWORD option. Valid value should be between 1 and 3 inclusive."
|
|
152
|
+
# End MySQL Error messages
|
mysqlx/logger.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Copyright (c) 2022, 2023, Oracle and/or its affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software; you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU General Public License, version 2.0, as
|
|
5
|
+
# published by the Free Software Foundation.
|
|
6
|
+
#
|
|
7
|
+
# This program is also distributed with certain software (including
|
|
8
|
+
# but not limited to OpenSSL) that is licensed under separate terms,
|
|
9
|
+
# as designated in a particular file or component or in included license
|
|
10
|
+
# documentation. The authors of MySQL hereby grant you an
|
|
11
|
+
# additional permission to link the program and your derivative works
|
|
12
|
+
# with the separately licensed software that they have included with
|
|
13
|
+
# MySQL.
|
|
14
|
+
#
|
|
15
|
+
# Without limiting anything contained in the foregoing, this file,
|
|
16
|
+
# which is part of MySQL Connector/Python, is also subject to the
|
|
17
|
+
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
|
18
|
+
# http://oss.oracle.com/licenses/universal-foss-exception.
|
|
19
|
+
#
|
|
20
|
+
# This program is distributed in the hope that it will be useful, but
|
|
21
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
23
|
+
# See the GNU General Public License, version 2.0, for more details.
|
|
24
|
+
#
|
|
25
|
+
# You should have received a copy of the GNU General Public License
|
|
26
|
+
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
|
27
|
+
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
28
|
+
|
|
29
|
+
"""Setup of the `mysqlx` logger."""
|
|
30
|
+
|
|
31
|
+
import logging
|
|
32
|
+
|
|
33
|
+
logger = logging.getLogger("mysqlx")
|