First Commit
This commit is contained in:
@@ -0,0 +1,809 @@
|
||||
# Copyright (c) 2016, 2020, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
"""MySQL X DevAPI Python implementation"""
|
||||
|
||||
import re
|
||||
import json
|
||||
import logging
|
||||
import ssl
|
||||
|
||||
from urllib.parse import parse_qsl, unquote, urlparse
|
||||
|
||||
try:
|
||||
from json.decoder import JSONDecodeError
|
||||
except ImportError:
|
||||
JSONDecodeError = ValueError
|
||||
|
||||
from .connection import Client, Session
|
||||
from .constants import (Auth, LockContention, OPENSSL_CS_NAMES, SSLMode,
|
||||
TLS_VERSIONS, TLS_CIPHER_SUITES)
|
||||
from .crud import Schema, Collection, Table, View
|
||||
from .dbdoc import DbDoc
|
||||
# pylint: disable=W0622
|
||||
from .errors import (Error, InterfaceError, DatabaseError, NotSupportedError,
|
||||
DataError, IntegrityError, ProgrammingError,
|
||||
OperationalError, InternalError, PoolError, TimeoutError)
|
||||
from .result import (Column, Row, Result, BufferingResult, RowResult,
|
||||
SqlResult, DocResult, ColumnType)
|
||||
from .statement import (Statement, FilterableStatement, SqlStatement,
|
||||
FindStatement, AddStatement, RemoveStatement,
|
||||
ModifyStatement, SelectStatement, InsertStatement,
|
||||
DeleteStatement, UpdateStatement,
|
||||
CreateCollectionIndexStatement, Expr, ReadStatement,
|
||||
WriteStatement)
|
||||
from .expr import ExprParser as expr
|
||||
|
||||
|
||||
_SPLIT_RE = re.compile(r",(?![^\(\)]*\))")
|
||||
_PRIORITY_RE = re.compile(r"^\(address=(.+),priority=(\d+)\)$", re.VERBOSE)
|
||||
_ROUTER_RE = re.compile(r"^\(address=(.+)[,]*\)$", re.VERBOSE)
|
||||
_URI_SCHEME_RE = re.compile(r"^([a-zA-Z][a-zA-Z0-9+\-.]+)://(.*)")
|
||||
_SSL_OPTS = ["ssl-cert", "ssl-ca", "ssl-key", "ssl-crl", "tls-versions",
|
||||
"tls-ciphersuites"]
|
||||
_SESS_OPTS = _SSL_OPTS + ["user", "password", "schema", "host", "port",
|
||||
"routers", "socket", "ssl-mode", "auth", "use-pure",
|
||||
"connect-timeout", "connection-attributes",
|
||||
"compression", "compression-algorithms", "dns-srv"]
|
||||
|
||||
logging.getLogger(__name__).addHandler(logging.NullHandler())
|
||||
|
||||
DUPLICATED_IN_LIST_ERROR = (
|
||||
"The '{list}' list must not contain repeated values, the value "
|
||||
"'{value}' is duplicated.")
|
||||
|
||||
TLS_VERSION_ERROR = ("The given tls-version: '{}' is not recognized as a "
|
||||
"valid TLS protocol version (should be one of {}).")
|
||||
|
||||
TLS_VERSION_DEPRECATED_ERROR = ("The given tls_version: '{}' are no longer "
|
||||
"allowed (should be one of {}).")
|
||||
|
||||
TLS_VER_NO_SUPPORTED = ("No supported TLS protocol version found in the "
|
||||
"'tls-versions' list '{}'. ")
|
||||
|
||||
TLS_VERSIONS = ["TLSv1.2", "TLSv1.3"]
|
||||
|
||||
DEPRECATED_TLS_VERSIONS = ["TLSv1", "TLSv1.1"]
|
||||
|
||||
TLS_V1_3_SUPPORTED = False
|
||||
if hasattr(ssl, "HAS_TLSv1_3") and ssl.HAS_TLSv1_3:
|
||||
TLS_V1_3_SUPPORTED = True
|
||||
|
||||
|
||||
def _parse_address_list(path):
|
||||
"""Parses a list of host, port pairs
|
||||
|
||||
Args:
|
||||
path: String containing a list of routers or just router
|
||||
|
||||
Returns:
|
||||
Returns a dict with parsed values of host, port and priority if
|
||||
specified.
|
||||
"""
|
||||
path = path.replace(" ", "")
|
||||
array = not("," not in path and path.count(":") > 1
|
||||
and path.count("[") == 1) and path.startswith("[") \
|
||||
and path.endswith("]")
|
||||
|
||||
routers = []
|
||||
address_list = _SPLIT_RE.split(path[1:-1] if array else path)
|
||||
priority_count = 0
|
||||
for address in address_list:
|
||||
router = {}
|
||||
|
||||
match = _PRIORITY_RE.match(address)
|
||||
if match:
|
||||
address = match.group(1)
|
||||
router["priority"] = int(match.group(2))
|
||||
priority_count += 1
|
||||
else:
|
||||
match = _ROUTER_RE.match(address)
|
||||
if match:
|
||||
address = match.group(1)
|
||||
router["priority"] = 100
|
||||
|
||||
match = urlparse("//{0}".format(address))
|
||||
if not match.hostname:
|
||||
raise InterfaceError("Invalid address: {0}".format(address))
|
||||
|
||||
try:
|
||||
router.update(host=match.hostname, port=match.port)
|
||||
except ValueError as err:
|
||||
raise ProgrammingError("Invalid URI: {0}".format(err), 4002)
|
||||
|
||||
routers.append(router)
|
||||
|
||||
if 0 < priority_count < len(address_list):
|
||||
raise ProgrammingError("You must either assign no priority to any "
|
||||
"of the routers or give a priority for "
|
||||
"every router", 4000)
|
||||
|
||||
return {"routers": routers} if array else routers[0]
|
||||
|
||||
|
||||
def _parse_connection_uri(uri):
|
||||
"""Parses the connection string and returns a dictionary with the
|
||||
connection settings.
|
||||
|
||||
Args:
|
||||
uri: mysqlx URI scheme to connect to a MySQL server/farm.
|
||||
|
||||
Returns:
|
||||
Returns a dict with parsed values of credentials and address of the
|
||||
MySQL server/farm.
|
||||
|
||||
Raises:
|
||||
:class:`mysqlx.InterfaceError`: If contains a duplicate option or
|
||||
URI scheme is not valid.
|
||||
"""
|
||||
settings = {"schema": ""}
|
||||
|
||||
match = _URI_SCHEME_RE.match(uri)
|
||||
scheme, uri = match.groups() if match else ("mysqlx", uri)
|
||||
|
||||
if scheme not in ("mysqlx", "mysqlx+srv"):
|
||||
raise InterfaceError("Scheme '{0}' is not valid".format(scheme))
|
||||
|
||||
if scheme == "mysqlx+srv":
|
||||
settings["dns-srv"] = True
|
||||
|
||||
userinfo, tmp = uri.partition("@")[::2]
|
||||
host, query_str = tmp.partition("?")[::2]
|
||||
|
||||
pos = host.rfind("/")
|
||||
if host[pos:].find(")") == -1 and pos > 0:
|
||||
host, settings["schema"] = host.rsplit("/", 1)
|
||||
host = host.strip("()")
|
||||
|
||||
if not host or not userinfo or ":" not in userinfo:
|
||||
raise InterfaceError("Malformed URI '{0}'".format(uri))
|
||||
user, password = userinfo.split(":", 1)
|
||||
settings["user"], settings["password"] = unquote(user), unquote(password)
|
||||
|
||||
if host.startswith(("/", "..", ".")):
|
||||
settings["socket"] = unquote(host)
|
||||
elif host.startswith("\\."):
|
||||
raise InterfaceError("Windows Pipe is not supported")
|
||||
else:
|
||||
settings.update(_parse_address_list(host))
|
||||
|
||||
invalid_options = ("user", "password", "dns-srv")
|
||||
for key, val in parse_qsl(query_str, True):
|
||||
opt = key.replace("_", "-").lower()
|
||||
if opt in invalid_options:
|
||||
raise InterfaceError("Invalid option: '{0}'".format(key))
|
||||
if opt in settings:
|
||||
raise InterfaceError("Duplicate option: '{0}'".format(key))
|
||||
if opt in _SSL_OPTS:
|
||||
settings[opt] = unquote(val.strip("()"))
|
||||
else:
|
||||
val_str = val.lower()
|
||||
if val_str in ("1", "true"):
|
||||
settings[opt] = True
|
||||
elif val_str in ("0", "false"):
|
||||
settings[opt] = False
|
||||
else:
|
||||
settings[opt] = val_str
|
||||
return settings
|
||||
|
||||
|
||||
def _validate_settings(settings):
|
||||
"""Validates the settings to be passed to a Session object
|
||||
the port values are converted to int if specified or set to 33060
|
||||
otherwise. The priority values for each router is converted to int
|
||||
if specified.
|
||||
|
||||
Args:
|
||||
settings: dict containing connection settings.
|
||||
|
||||
Raises:
|
||||
:class:`mysqlx.InterfaceError`: On any configuration issue.
|
||||
"""
|
||||
invalid_opts = set(settings.keys()).difference(_SESS_OPTS)
|
||||
if invalid_opts:
|
||||
raise InterfaceError("Invalid option(s): '{0}'"
|
||||
"".format("', '".join(invalid_opts)))
|
||||
|
||||
if "routers" in settings:
|
||||
for router in settings["routers"]:
|
||||
_validate_hosts(router, 33060)
|
||||
elif "host" in settings:
|
||||
_validate_hosts(settings)
|
||||
|
||||
if "ssl-mode" in settings:
|
||||
try:
|
||||
settings["ssl-mode"] = settings["ssl-mode"].lower()
|
||||
SSLMode.index(settings["ssl-mode"])
|
||||
except (AttributeError, ValueError):
|
||||
raise InterfaceError("Invalid SSL Mode '{0}'"
|
||||
"".format(settings["ssl-mode"]))
|
||||
if settings["ssl-mode"] == SSLMode.DISABLED and \
|
||||
any(key in settings for key in _SSL_OPTS):
|
||||
raise InterfaceError("SSL options used with ssl-mode 'disabled'")
|
||||
|
||||
if "ssl-crl" in settings and not "ssl-ca" in settings:
|
||||
raise InterfaceError("CA Certificate not provided")
|
||||
if "ssl-key" in settings and not "ssl-cert" in settings:
|
||||
raise InterfaceError("Client Certificate not provided")
|
||||
|
||||
if not "ssl-ca" in settings and settings.get("ssl-mode") \
|
||||
in [SSLMode.VERIFY_IDENTITY, SSLMode.VERIFY_CA]:
|
||||
raise InterfaceError("Cannot verify Server without CA")
|
||||
if "ssl-ca" in settings and settings.get("ssl-mode") \
|
||||
not in [SSLMode.VERIFY_IDENTITY, SSLMode.VERIFY_CA]:
|
||||
raise InterfaceError("Must verify Server if CA is provided")
|
||||
|
||||
if "auth" in settings:
|
||||
try:
|
||||
settings["auth"] = settings["auth"].lower()
|
||||
Auth.index(settings["auth"])
|
||||
except (AttributeError, ValueError):
|
||||
raise InterfaceError("Invalid Auth '{0}'".format(settings["auth"]))
|
||||
|
||||
if "compression" in settings:
|
||||
compression = settings["compression"].lower().strip()
|
||||
if compression not in ("preferred", "required", "disabled"):
|
||||
raise InterfaceError(
|
||||
"The connection property 'compression' acceptable values are: "
|
||||
"'preferred', 'required', or 'disabled'. The value '{0}' is "
|
||||
"not acceptable".format(settings["compression"]))
|
||||
settings["compression"] = compression
|
||||
|
||||
if "compression-algorithms" in settings:
|
||||
if isinstance(settings["compression-algorithms"], str):
|
||||
compression_algorithms = \
|
||||
settings["compression-algorithms"].strip().strip("[]")
|
||||
if compression_algorithms:
|
||||
settings["compression-algorithms"] = \
|
||||
compression_algorithms.split(",")
|
||||
else:
|
||||
settings["compression-algorithms"] = None
|
||||
elif not isinstance(settings["compression-algorithms"], (list, tuple)):
|
||||
raise InterfaceError("Invalid type of the connection property "
|
||||
"'compression-algorithms'")
|
||||
if settings.get("compression") == "disabled":
|
||||
settings["compression-algorithms"] = None
|
||||
|
||||
if "connection-attributes" in settings:
|
||||
_validate_connection_attributes(settings)
|
||||
|
||||
if "connect-timeout" in settings:
|
||||
try:
|
||||
if isinstance(settings["connect-timeout"], str):
|
||||
settings["connect-timeout"] = int(settings["connect-timeout"])
|
||||
if not isinstance(settings["connect-timeout"], int) \
|
||||
or settings["connect-timeout"] < 0:
|
||||
raise ValueError
|
||||
except ValueError:
|
||||
raise TypeError("The connection timeout value must be a positive "
|
||||
"integer (including 0)")
|
||||
|
||||
if "dns-srv" in settings:
|
||||
if not isinstance(settings["dns-srv"], bool):
|
||||
raise InterfaceError("The value of 'dns-srv' must be a boolean")
|
||||
if settings.get("socket"):
|
||||
raise InterfaceError("Using Unix domain sockets with DNS SRV "
|
||||
"lookup is not allowed")
|
||||
if settings.get("port"):
|
||||
raise InterfaceError("Specifying a port number with DNS SRV "
|
||||
"lookup is not allowed")
|
||||
if settings.get("routers"):
|
||||
raise InterfaceError("Specifying multiple hostnames with DNS "
|
||||
"SRV look up is not allowed")
|
||||
elif "host" in settings and not settings.get("port"):
|
||||
settings["port"] = 33060
|
||||
|
||||
if "tls-versions" in settings:
|
||||
_validate_tls_versions(settings)
|
||||
|
||||
if "tls-ciphersuites" in settings:
|
||||
_validate_tls_ciphersuites(settings)
|
||||
|
||||
|
||||
def _validate_hosts(settings, default_port=None):
|
||||
"""Validate hosts.
|
||||
|
||||
Args:
|
||||
settings (dict): Settings dictionary.
|
||||
default_port (int): Default connection port.
|
||||
|
||||
Raises:
|
||||
:class:`mysqlx.InterfaceError`: If priority or port are invalid.
|
||||
"""
|
||||
if "priority" in settings and settings["priority"]:
|
||||
try:
|
||||
settings["priority"] = int(settings["priority"])
|
||||
if settings["priority"] < 0 or settings["priority"] > 100:
|
||||
raise ProgrammingError("Invalid priority value, "
|
||||
"must be between 0 and 100", 4007)
|
||||
except NameError:
|
||||
raise ProgrammingError("Invalid priority", 4007)
|
||||
except ValueError:
|
||||
raise ProgrammingError(
|
||||
"Invalid priority: {}".format(settings["priority"]), 4007)
|
||||
|
||||
if "port" in settings and settings["port"]:
|
||||
try:
|
||||
settings["port"] = int(settings["port"])
|
||||
except NameError:
|
||||
raise InterfaceError("Invalid port")
|
||||
elif "host" in settings and default_port:
|
||||
settings["port"] = default_port
|
||||
|
||||
|
||||
def _validate_connection_attributes(settings):
|
||||
"""Validate connection-attributes.
|
||||
|
||||
Args:
|
||||
settings (dict): Settings dictionary.
|
||||
|
||||
Raises:
|
||||
:class:`mysqlx.InterfaceError`: If attribute name or value exceeds size.
|
||||
"""
|
||||
attributes = {}
|
||||
if "connection-attributes" not in settings:
|
||||
return
|
||||
|
||||
conn_attrs = settings["connection-attributes"]
|
||||
|
||||
if isinstance(conn_attrs, str):
|
||||
if conn_attrs == "":
|
||||
settings["connection-attributes"] = {}
|
||||
return
|
||||
if not (conn_attrs.startswith("[") and conn_attrs.endswith("]")) and \
|
||||
not conn_attrs in ['False', "false", "True", "true"]:
|
||||
raise InterfaceError("The value of 'connection-attributes' must "
|
||||
"be a boolean or a list of key-value pairs, "
|
||||
"found: '{}'".format(conn_attrs))
|
||||
elif conn_attrs in ['False', "false", "True", "true"]:
|
||||
if conn_attrs in ['False', "false"]:
|
||||
settings["connection-attributes"] = False
|
||||
else:
|
||||
settings["connection-attributes"] = {}
|
||||
return
|
||||
else:
|
||||
conn_attributes = conn_attrs[1:-1].split(",")
|
||||
for attr in conn_attributes:
|
||||
if attr == "":
|
||||
continue
|
||||
attr_name_val = attr.split('=')
|
||||
attr_name = attr_name_val[0]
|
||||
attr_val = attr_name_val[1] if len(attr_name_val) > 1 else ""
|
||||
if attr_name in attributes:
|
||||
raise InterfaceError("Duplicate key '{}' used in "
|
||||
"connection-attributes"
|
||||
"".format(attr_name))
|
||||
else:
|
||||
attributes[attr_name] = attr_val
|
||||
elif isinstance(conn_attrs, dict):
|
||||
for attr_name in conn_attrs:
|
||||
attr_value = conn_attrs[attr_name]
|
||||
if not isinstance(attr_value, str):
|
||||
attr_value = repr(attr_value)
|
||||
attributes[attr_name] = attr_value
|
||||
elif isinstance(conn_attrs, bool) or conn_attrs in [0, 1]:
|
||||
if conn_attrs:
|
||||
settings["connection-attributes"] = {}
|
||||
else:
|
||||
settings["connection-attributes"] = False
|
||||
return
|
||||
elif isinstance(conn_attrs, set):
|
||||
for attr_name in conn_attrs:
|
||||
attributes[attr_name] = ""
|
||||
elif isinstance(conn_attrs, list):
|
||||
for attr in conn_attrs:
|
||||
if attr == "":
|
||||
continue
|
||||
attr_name_val = attr.split('=')
|
||||
attr_name = attr_name_val[0]
|
||||
attr_val = attr_name_val[1] if len(attr_name_val) > 1 else ""
|
||||
if attr_name in attributes:
|
||||
raise InterfaceError("Duplicate key '{}' used in "
|
||||
"connection-attributes"
|
||||
"".format(attr_name))
|
||||
else:
|
||||
attributes[attr_name] = attr_val
|
||||
elif not isinstance(conn_attrs, bool):
|
||||
raise InterfaceError("connection-attributes must be Boolean or a list "
|
||||
"of key-value pairs, found: '{}'"
|
||||
"".format(conn_attrs))
|
||||
|
||||
if attributes:
|
||||
for attr_name in attributes:
|
||||
attr_value = attributes[attr_name]
|
||||
|
||||
# Validate name type
|
||||
if not isinstance(attr_name, str):
|
||||
raise InterfaceError("Attribute name '{}' must be a string"
|
||||
"type".format(attr_name))
|
||||
# Validate attribute name limit 32 characters
|
||||
if len(attr_name) > 32:
|
||||
raise InterfaceError("Attribute name '{}' exceeds 32 "
|
||||
"characters limit size".format(attr_name))
|
||||
# Validate names in connection-attributes cannot start with "_"
|
||||
if attr_name.startswith("_"):
|
||||
raise InterfaceError("Key names in connection-attributes "
|
||||
"cannot start with '_', found: '{}'"
|
||||
"".format(attr_name))
|
||||
|
||||
# Validate value type
|
||||
if not isinstance(attr_value, str):
|
||||
raise InterfaceError("Attribute '{}' value: '{}' must "
|
||||
"be a string type"
|
||||
"".format(attr_name, attr_value))
|
||||
# Validate attribute value limit 1024 characters
|
||||
if len(attr_value) > 1024:
|
||||
raise InterfaceError("Attribute '{}' value: '{}' "
|
||||
"exceeds 1024 characters limit size"
|
||||
"".format(attr_name, attr_value))
|
||||
|
||||
settings["connection-attributes"] = attributes
|
||||
|
||||
|
||||
def _validate_tls_versions(settings):
|
||||
"""Validate tls-versions.
|
||||
|
||||
Args:
|
||||
settings (dict): Settings dictionary.
|
||||
|
||||
Raises:
|
||||
:class:`mysqlx.InterfaceError`: If tls-versions name is not valid.
|
||||
"""
|
||||
tls_versions = []
|
||||
if "tls-versions" not in settings:
|
||||
return
|
||||
|
||||
tls_versions_settings = settings["tls-versions"]
|
||||
|
||||
if isinstance(tls_versions_settings, str):
|
||||
if not (tls_versions_settings.startswith("[") and
|
||||
tls_versions_settings.endswith("]")):
|
||||
raise InterfaceError("tls-versions must be a list, found: '{}'"
|
||||
"".format(tls_versions_settings))
|
||||
else:
|
||||
tls_vers = tls_versions_settings[1:-1].split(",")
|
||||
for tls_ver in tls_vers:
|
||||
tls_version = tls_ver.strip()
|
||||
if tls_version == "":
|
||||
continue
|
||||
else:
|
||||
if tls_version in tls_versions:
|
||||
raise InterfaceError(
|
||||
DUPLICATED_IN_LIST_ERROR.format(
|
||||
list="tls_versions", value=tls_version))
|
||||
tls_versions.append(tls_version)
|
||||
elif isinstance(tls_versions_settings, list):
|
||||
if not tls_versions_settings:
|
||||
raise InterfaceError("At least one TLS protocol version must be "
|
||||
"specified in 'tls-versions' list.")
|
||||
for tls_ver in tls_versions_settings:
|
||||
if tls_ver in tls_versions:
|
||||
raise InterfaceError(
|
||||
DUPLICATED_IN_LIST_ERROR.format(list="tls_versions",
|
||||
value=tls_ver))
|
||||
else:
|
||||
tls_versions.append(tls_ver)
|
||||
|
||||
elif isinstance(tls_versions_settings, set):
|
||||
for tls_ver in tls_versions_settings:
|
||||
tls_versions.append(tls_ver)
|
||||
else:
|
||||
raise InterfaceError("tls-versions should be a list with one or more "
|
||||
"of versions in {}. found: '{}'"
|
||||
"".format(", ".join(TLS_VERSIONS), tls_versions))
|
||||
|
||||
if not tls_versions:
|
||||
raise InterfaceError("At least one TLS protocol version must be "
|
||||
"specified in 'tls-versions' list.")
|
||||
|
||||
use_tls_versions = []
|
||||
deprecated_tls_versions = []
|
||||
not_tls_versions = []
|
||||
for tls_ver in tls_versions:
|
||||
if tls_ver in TLS_VERSIONS:
|
||||
use_tls_versions.append(tls_ver)
|
||||
if tls_ver in DEPRECATED_TLS_VERSIONS:
|
||||
deprecated_tls_versions.append(tls_ver)
|
||||
else:
|
||||
not_tls_versions.append(tls_ver)
|
||||
|
||||
if use_tls_versions:
|
||||
if use_tls_versions == ["TLSv1.3"] and not TLS_V1_3_SUPPORTED:
|
||||
raise NotSupportedError(
|
||||
TLS_VER_NO_SUPPORTED.format(tls_versions, TLS_VERSIONS))
|
||||
use_tls_versions.sort()
|
||||
settings["tls-versions"] = use_tls_versions
|
||||
elif deprecated_tls_versions:
|
||||
raise NotSupportedError(
|
||||
TLS_VERSION_DEPRECATED_ERROR.format(deprecated_tls_versions,
|
||||
TLS_VERSIONS))
|
||||
elif not_tls_versions:
|
||||
raise InterfaceError(
|
||||
TLS_VERSION_ERROR.format(tls_ver, TLS_VERSIONS))
|
||||
|
||||
|
||||
def _validate_tls_ciphersuites(settings):
|
||||
"""Validate tls-ciphersuites.
|
||||
|
||||
Args:
|
||||
settings (dict): Settings dictionary.
|
||||
|
||||
Raises:
|
||||
:class:`mysqlx.InterfaceError`: If tls-ciphersuites name is not valid.
|
||||
"""
|
||||
tls_ciphersuites = []
|
||||
if "tls-ciphersuites" not in settings:
|
||||
return
|
||||
|
||||
tls_ciphersuites_settings = settings["tls-ciphersuites"]
|
||||
|
||||
if isinstance(tls_ciphersuites_settings, str):
|
||||
if not (tls_ciphersuites_settings.startswith("[") and
|
||||
tls_ciphersuites_settings.endswith("]")):
|
||||
raise InterfaceError("tls-ciphersuites must be a list, found: '{}'"
|
||||
"".format(tls_ciphersuites_settings))
|
||||
else:
|
||||
tls_css = tls_ciphersuites_settings[1:-1].split(",")
|
||||
if not tls_css:
|
||||
raise InterfaceError("No valid cipher suite found in the "
|
||||
"'tls-ciphersuites' list.")
|
||||
for tls_cs in tls_css:
|
||||
tls_cs = tls_cs.strip().upper()
|
||||
if tls_cs:
|
||||
tls_ciphersuites.append(tls_cs)
|
||||
elif isinstance(tls_ciphersuites_settings, list):
|
||||
tls_ciphersuites = [tls_cs for tls_cs in tls_ciphersuites_settings
|
||||
if tls_cs]
|
||||
|
||||
elif isinstance(tls_ciphersuites_settings, set):
|
||||
for tls_cs in tls_ciphersuites:
|
||||
if tls_cs:
|
||||
tls_ciphersuites.append(tls_cs)
|
||||
else:
|
||||
raise InterfaceError("tls-ciphersuites should be a list with one or "
|
||||
"more ciphersuites. Found: '{}'"
|
||||
"".format(tls_ciphersuites_settings))
|
||||
|
||||
tls_versions = TLS_VERSIONS[:] if settings.get("tls-versions", None) \
|
||||
is None else settings["tls-versions"][:]
|
||||
|
||||
# A newer TLS version can use a cipher introduced on
|
||||
# an older version.
|
||||
tls_versions.sort(reverse=True)
|
||||
newer_tls_ver = tls_versions[0]
|
||||
|
||||
translated_names = []
|
||||
iani_cipher_suites_names = {}
|
||||
ossl_cipher_suites_names = []
|
||||
|
||||
# Old ciphers can work with new TLS versions.
|
||||
# Find all the ciphers introduced on previous TLS versions
|
||||
for tls_ver in TLS_VERSIONS[:TLS_VERSIONS.index(newer_tls_ver) + 1]:
|
||||
iani_cipher_suites_names.update(TLS_CIPHER_SUITES[tls_ver])
|
||||
ossl_cipher_suites_names.extend(OPENSSL_CS_NAMES[tls_ver])
|
||||
|
||||
for name in tls_ciphersuites:
|
||||
if "-" in name and name in ossl_cipher_suites_names:
|
||||
translated_names.append(name)
|
||||
elif name in iani_cipher_suites_names:
|
||||
translated_name = iani_cipher_suites_names[name]
|
||||
if translated_name in translated_names:
|
||||
raise AttributeError(
|
||||
DUPLICATED_IN_LIST_ERROR.format(
|
||||
list="tls_ciphersuites", value=translated_name))
|
||||
else:
|
||||
translated_names.append(translated_name)
|
||||
else:
|
||||
raise InterfaceError(
|
||||
"The value '{}' in cipher suites is not a valid "
|
||||
"cipher suite".format(name))
|
||||
|
||||
if not translated_names:
|
||||
raise InterfaceError("No valid cipher suite found in the "
|
||||
"'tls-ciphersuites' list.")
|
||||
|
||||
settings["tls-ciphersuites"] = translated_names
|
||||
|
||||
|
||||
def _get_connection_settings(*args, **kwargs):
|
||||
"""Parses the connection string and returns a dictionary with the
|
||||
connection settings.
|
||||
|
||||
Args:
|
||||
*args: Variable length argument list with the connection data used
|
||||
to connect to the database. It can be a dictionary or a
|
||||
connection string.
|
||||
**kwargs: Arbitrary keyword arguments with connection data used to
|
||||
connect to the database.
|
||||
|
||||
Returns:
|
||||
mysqlx.Session: Session object.
|
||||
|
||||
Raises:
|
||||
TypeError: If connection timeout is not a positive integer.
|
||||
:class:`mysqlx.InterfaceError`: If settings not provided.
|
||||
"""
|
||||
settings = {}
|
||||
if args:
|
||||
if isinstance(args[0], str):
|
||||
settings = _parse_connection_uri(args[0])
|
||||
elif isinstance(args[0], dict):
|
||||
for key, val in args[0].items():
|
||||
settings[key.replace("_", "-")] = val
|
||||
elif kwargs:
|
||||
for key, val in kwargs.items():
|
||||
settings[key.replace("_", "-")] = val
|
||||
|
||||
if not settings:
|
||||
raise InterfaceError("Settings not provided")
|
||||
|
||||
_validate_settings(settings)
|
||||
return settings
|
||||
|
||||
|
||||
def get_session(*args, **kwargs):
|
||||
"""Creates a Session instance using the provided connection data.
|
||||
|
||||
Args:
|
||||
*args: Variable length argument list with the connection data used
|
||||
to connect to a MySQL server. It can be a dictionary or a
|
||||
connection string.
|
||||
**kwargs: Arbitrary keyword arguments with connection data used to
|
||||
connect to the database.
|
||||
|
||||
Returns:
|
||||
mysqlx.Session: Session object.
|
||||
"""
|
||||
settings = _get_connection_settings(*args, **kwargs)
|
||||
return Session(settings)
|
||||
|
||||
|
||||
def get_client(connection_string, options_string):
|
||||
"""Creates a Client instance with the provided connection data and settings.
|
||||
|
||||
Args:
|
||||
connection_string: A string or a dict type object to indicate the \
|
||||
connection data used to connect to a MySQL server.
|
||||
|
||||
The string must have the following uri format::
|
||||
|
||||
cnx_str = 'mysqlx://{user}:{pwd}@{host}:{port}'
|
||||
cnx_str = ('mysqlx://{user}:{pwd}@['
|
||||
' (address={host}:{port}, priority=n),'
|
||||
' (address={host}:{port}, priority=n), ...]'
|
||||
' ?[option=value]')
|
||||
|
||||
And the dictionary::
|
||||
|
||||
cnx_dict = {
|
||||
'host': 'The host where the MySQL product is running',
|
||||
'port': '(int) the port number configured for X protocol',
|
||||
'user': 'The user name account',
|
||||
'password': 'The password for the given user account',
|
||||
'ssl-mode': 'The flags for ssl mode in mysqlx.SSLMode.FLAG',
|
||||
'ssl-ca': 'The path to the ca.cert'
|
||||
"connect-timeout": '(int) milliseconds to wait on timeout'
|
||||
}
|
||||
|
||||
options_string: A string in the form of a document or a dictionary \
|
||||
type with configuration for the client.
|
||||
|
||||
Current options include::
|
||||
|
||||
options = {
|
||||
'pooling': {
|
||||
'enabled': (bool), # [True | False], True by default
|
||||
'max_size': (int), # Maximum connections per pool
|
||||
"max_idle_time": (int), # milliseconds that a
|
||||
# connection will remain active while not in use.
|
||||
# By default 0, means infinite.
|
||||
"queue_timeout": (int), # milliseconds a request will
|
||||
# wait for a connection to become available.
|
||||
# By default 0, means infinite.
|
||||
}
|
||||
}
|
||||
|
||||
Returns:
|
||||
mysqlx.Client: Client object.
|
||||
|
||||
.. versionadded:: 8.0.13
|
||||
"""
|
||||
if not isinstance(connection_string, (str, dict)):
|
||||
raise InterfaceError("connection_data must be a string or dict")
|
||||
|
||||
settings_dict = _get_connection_settings(connection_string)
|
||||
|
||||
if not isinstance(options_string, (str, dict)):
|
||||
raise InterfaceError("connection_options must be a string or dict")
|
||||
|
||||
if isinstance(options_string, str):
|
||||
try:
|
||||
options_dict = json.loads(options_string)
|
||||
except JSONDecodeError:
|
||||
raise InterfaceError("'pooling' options must be given in the form "
|
||||
"of a document or dict")
|
||||
else:
|
||||
options_dict = {}
|
||||
for key, value in options_string.items():
|
||||
options_dict[key.replace("-", "_")] = value
|
||||
|
||||
if not isinstance(options_dict, dict):
|
||||
raise InterfaceError("'pooling' options must be given in the form of a "
|
||||
"document or dict")
|
||||
pooling_options_dict = {}
|
||||
if "pooling" in options_dict:
|
||||
pooling_options = options_dict.pop("pooling")
|
||||
if not isinstance(pooling_options, (dict)):
|
||||
raise InterfaceError("'pooling' options must be given in the form "
|
||||
"document or dict")
|
||||
# Fill default pooling settings
|
||||
pooling_options_dict["enabled"] = pooling_options.pop("enabled", True)
|
||||
pooling_options_dict["max_size"] = pooling_options.pop("max_size", 25)
|
||||
pooling_options_dict["max_idle_time"] = \
|
||||
pooling_options.pop("max_idle_time", 0)
|
||||
pooling_options_dict["queue_timeout"] = \
|
||||
pooling_options.pop("queue_timeout", 0)
|
||||
|
||||
# No other options besides pooling are supported
|
||||
if len(pooling_options) > 0:
|
||||
raise InterfaceError("Unrecognized pooling options: {}"
|
||||
"".format(pooling_options))
|
||||
# No other options besides pooling are supported
|
||||
if len(options_dict) > 0:
|
||||
raise InterfaceError("Unrecognized connection options: {}"
|
||||
"".format(options_dict.keys()))
|
||||
|
||||
return Client(settings_dict, pooling_options_dict)
|
||||
|
||||
|
||||
__all__ = [
|
||||
# mysqlx.connection
|
||||
"Client", "Session", "get_client", "get_session", "expr",
|
||||
|
||||
# mysqlx.constants
|
||||
"Auth", "LockContention", "SSLMode",
|
||||
|
||||
# mysqlx.crud
|
||||
"Schema", "Collection", "Table", "View",
|
||||
|
||||
# mysqlx.errors
|
||||
"Error", "InterfaceError", "DatabaseError", "NotSupportedError",
|
||||
"DataError", "IntegrityError", "ProgrammingError", "OperationalError",
|
||||
"InternalError", "PoolError", "TimeoutError",
|
||||
|
||||
# mysqlx.result
|
||||
"Column", "Row", "Result", "BufferingResult", "RowResult",
|
||||
"SqlResult", "DocResult", "ColumnType",
|
||||
|
||||
# mysqlx.statement
|
||||
"DbDoc", "Statement", "FilterableStatement", "SqlStatement",
|
||||
"FindStatement", "AddStatement", "RemoveStatement", "ModifyStatement",
|
||||
"SelectStatement", "InsertStatement", "DeleteStatement", "UpdateStatement",
|
||||
"ReadStatement", "WriteStatement", "CreateCollectionIndexStatement",
|
||||
"Expr",
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,174 @@
|
||||
# Copyright (c) 2016, 2020, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
"""Implementation of MySQL Authentication Plugin."""
|
||||
|
||||
import hashlib
|
||||
import struct
|
||||
|
||||
from .helpers import hexlify
|
||||
|
||||
|
||||
def xor_string(hash1, hash2, hash_size):
|
||||
"""Encrypt/Decrypt function used for password encryption in
|
||||
authentication, using a simple XOR.
|
||||
|
||||
Args:
|
||||
hash1 (str): The first hash.
|
||||
hash2 (str): The second hash.
|
||||
|
||||
Returns:
|
||||
str: A string with the xor applied.
|
||||
"""
|
||||
xored = [h1 ^ h2 for (h1, h2) in zip(hash1, hash2)]
|
||||
return struct.pack("{0}B".format(hash_size), *xored)
|
||||
|
||||
|
||||
class BaseAuthPlugin(object):
|
||||
"""Base class for implementing the authentication plugins."""
|
||||
def __init__(self, username=None, password=None):
|
||||
self._username = username
|
||||
self._password = password
|
||||
|
||||
def name(self):
|
||||
"""Returns the plugin name.
|
||||
|
||||
Returns:
|
||||
str: The plugin name.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def auth_name(self):
|
||||
"""Returns the authentication name.
|
||||
|
||||
Returns:
|
||||
str: The authentication name.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class MySQL41AuthPlugin(BaseAuthPlugin):
|
||||
"""Class implementing the MySQL Native Password authentication plugin."""
|
||||
def name(self):
|
||||
"""Returns the plugin name.
|
||||
|
||||
Returns:
|
||||
str: The plugin name.
|
||||
"""
|
||||
return "MySQL 4.1 Authentication Plugin"
|
||||
|
||||
def auth_name(self):
|
||||
"""Returns the authentication name.
|
||||
|
||||
Returns:
|
||||
str: The authentication name.
|
||||
"""
|
||||
return "MYSQL41"
|
||||
|
||||
def auth_data(self, data):
|
||||
"""Hashing for MySQL 4.1 authentication.
|
||||
|
||||
Args:
|
||||
data (str): The authentication data.
|
||||
|
||||
Returns:
|
||||
str: The authentication response.
|
||||
"""
|
||||
if self._password:
|
||||
password = self._password.encode("utf-8") \
|
||||
if isinstance(self._password, str) else self._password
|
||||
hash1 = hashlib.sha1(password).digest()
|
||||
hash2 = hashlib.sha1(hash1).digest()
|
||||
xored = xor_string(hash1, hashlib.sha1(data + hash2).digest(), 20)
|
||||
return "{0}\0{1}\0*{2}\0".format("", self._username, hexlify(xored))
|
||||
return "{0}\0{1}\0".format("", self._username)
|
||||
|
||||
|
||||
class PlainAuthPlugin(BaseAuthPlugin):
|
||||
"""Class implementing the MySQL Plain authentication plugin."""
|
||||
def name(self):
|
||||
"""Returns the plugin name.
|
||||
|
||||
Returns:
|
||||
str: The plugin name.
|
||||
"""
|
||||
return "Plain Authentication Plugin"
|
||||
|
||||
def auth_name(self):
|
||||
"""Returns the authentication name.
|
||||
|
||||
Returns:
|
||||
str: The authentication name.
|
||||
"""
|
||||
return "PLAIN"
|
||||
|
||||
def auth_data(self):
|
||||
"""Returns the authentication data.
|
||||
|
||||
Returns:
|
||||
str: The authentication data.
|
||||
"""
|
||||
return "\0{0}\0{1}".format(self._username, self._password)
|
||||
|
||||
|
||||
class Sha256MemoryAuthPlugin(BaseAuthPlugin):
|
||||
"""Class implementing the SHA256_MEMORY authentication plugin."""
|
||||
def name(self):
|
||||
"""Returns the plugin name.
|
||||
|
||||
Returns:
|
||||
str: The plugin name.
|
||||
"""
|
||||
return "SHA256_MEMORY Authentication Plugin"
|
||||
|
||||
def auth_name(self):
|
||||
"""Returns the authentication name.
|
||||
|
||||
Returns:
|
||||
str: The authentication name.
|
||||
"""
|
||||
return "SHA256_MEMORY"
|
||||
|
||||
def auth_data(self, data):
|
||||
"""Hashing for SHA256_MEMORY authentication.
|
||||
|
||||
The scramble is of the form:
|
||||
SHA256(SHA256(SHA256(PASSWORD)),NONCE) XOR SHA256(PASSWORD)
|
||||
|
||||
Args:
|
||||
data (str): The authentication data.
|
||||
|
||||
Returns:
|
||||
str: The authentication response.
|
||||
"""
|
||||
password = self._password.encode("utf-8") \
|
||||
if isinstance(self._password, str) else self._password
|
||||
hash1 = hashlib.sha256(password).digest()
|
||||
hash2 = hashlib.sha256(hashlib.sha256(hash1).digest() + data).digest()
|
||||
xored = xor_string(hash2, hash1, 32)
|
||||
return "\0{0}\0{1}".format(self._username, hexlify(xored))
|
||||
@@ -0,0 +1,350 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# This file was auto-generated.
|
||||
_GENERATED_ON = '2019-04-29'
|
||||
_MYSQL_VERSION = (8, 0, 17)
|
||||
|
||||
"""This module contains the MySQL Server Character Sets"""
|
||||
|
||||
MYSQL_CHARACTER_SETS = [
|
||||
# (character set name, collation, default)
|
||||
None,
|
||||
("big5", "big5_chinese_ci", True), # 1
|
||||
("latin2", "latin2_czech_cs", False), # 2
|
||||
("dec8", "dec8_swedish_ci", True), # 3
|
||||
("cp850", "cp850_general_ci", True), # 4
|
||||
("latin1", "latin1_german1_ci", False), # 5
|
||||
("hp8", "hp8_english_ci", True), # 6
|
||||
("koi8r", "koi8r_general_ci", True), # 7
|
||||
("latin1", "latin1_swedish_ci", True), # 8
|
||||
("latin2", "latin2_general_ci", True), # 9
|
||||
("swe7", "swe7_swedish_ci", True), # 10
|
||||
("ascii", "ascii_general_ci", True), # 11
|
||||
("ujis", "ujis_japanese_ci", True), # 12
|
||||
("sjis", "sjis_japanese_ci", True), # 13
|
||||
("cp1251", "cp1251_bulgarian_ci", False), # 14
|
||||
("latin1", "latin1_danish_ci", False), # 15
|
||||
("hebrew", "hebrew_general_ci", True), # 16
|
||||
None,
|
||||
("tis620", "tis620_thai_ci", True), # 18
|
||||
("euckr", "euckr_korean_ci", True), # 19
|
||||
("latin7", "latin7_estonian_cs", False), # 20
|
||||
("latin2", "latin2_hungarian_ci", False), # 21
|
||||
("koi8u", "koi8u_general_ci", True), # 22
|
||||
("cp1251", "cp1251_ukrainian_ci", False), # 23
|
||||
("gb2312", "gb2312_chinese_ci", True), # 24
|
||||
("greek", "greek_general_ci", True), # 25
|
||||
("cp1250", "cp1250_general_ci", True), # 26
|
||||
("latin2", "latin2_croatian_ci", False), # 27
|
||||
("gbk", "gbk_chinese_ci", True), # 28
|
||||
("cp1257", "cp1257_lithuanian_ci", False), # 29
|
||||
("latin5", "latin5_turkish_ci", True), # 30
|
||||
("latin1", "latin1_german2_ci", False), # 31
|
||||
("armscii8", "armscii8_general_ci", True), # 32
|
||||
("utf8", "utf8_general_ci", True), # 33
|
||||
("cp1250", "cp1250_czech_cs", False), # 34
|
||||
("ucs2", "ucs2_general_ci", True), # 35
|
||||
("cp866", "cp866_general_ci", True), # 36
|
||||
("keybcs2", "keybcs2_general_ci", True), # 37
|
||||
("macce", "macce_general_ci", True), # 38
|
||||
("macroman", "macroman_general_ci", True), # 39
|
||||
("cp852", "cp852_general_ci", True), # 40
|
||||
("latin7", "latin7_general_ci", True), # 41
|
||||
("latin7", "latin7_general_cs", False), # 42
|
||||
("macce", "macce_bin", False), # 43
|
||||
("cp1250", "cp1250_croatian_ci", False), # 44
|
||||
("utf8mb4", "utf8mb4_general_ci", False), # 45
|
||||
("utf8mb4", "utf8mb4_bin", False), # 46
|
||||
("latin1", "latin1_bin", False), # 47
|
||||
("latin1", "latin1_general_ci", False), # 48
|
||||
("latin1", "latin1_general_cs", False), # 49
|
||||
("cp1251", "cp1251_bin", False), # 50
|
||||
("cp1251", "cp1251_general_ci", True), # 51
|
||||
("cp1251", "cp1251_general_cs", False), # 52
|
||||
("macroman", "macroman_bin", False), # 53
|
||||
("utf16", "utf16_general_ci", True), # 54
|
||||
("utf16", "utf16_bin", False), # 55
|
||||
("utf16le", "utf16le_general_ci", True), # 56
|
||||
("cp1256", "cp1256_general_ci", True), # 57
|
||||
("cp1257", "cp1257_bin", False), # 58
|
||||
("cp1257", "cp1257_general_ci", True), # 59
|
||||
("utf32", "utf32_general_ci", True), # 60
|
||||
("utf32", "utf32_bin", False), # 61
|
||||
("utf16le", "utf16le_bin", False), # 62
|
||||
("binary", "binary", True), # 63
|
||||
("armscii8", "armscii8_bin", False), # 64
|
||||
("ascii", "ascii_bin", False), # 65
|
||||
("cp1250", "cp1250_bin", False), # 66
|
||||
("cp1256", "cp1256_bin", False), # 67
|
||||
("cp866", "cp866_bin", False), # 68
|
||||
("dec8", "dec8_bin", False), # 69
|
||||
("greek", "greek_bin", False), # 70
|
||||
("hebrew", "hebrew_bin", False), # 71
|
||||
("hp8", "hp8_bin", False), # 72
|
||||
("keybcs2", "keybcs2_bin", False), # 73
|
||||
("koi8r", "koi8r_bin", False), # 74
|
||||
("koi8u", "koi8u_bin", False), # 75
|
||||
("utf8", "utf8_tolower_ci", False), # 76
|
||||
("latin2", "latin2_bin", False), # 77
|
||||
("latin5", "latin5_bin", False), # 78
|
||||
("latin7", "latin7_bin", False), # 79
|
||||
("cp850", "cp850_bin", False), # 80
|
||||
("cp852", "cp852_bin", False), # 81
|
||||
("swe7", "swe7_bin", False), # 82
|
||||
("utf8", "utf8_bin", False), # 83
|
||||
("big5", "big5_bin", False), # 84
|
||||
("euckr", "euckr_bin", False), # 85
|
||||
("gb2312", "gb2312_bin", False), # 86
|
||||
("gbk", "gbk_bin", False), # 87
|
||||
("sjis", "sjis_bin", False), # 88
|
||||
("tis620", "tis620_bin", False), # 89
|
||||
("ucs2", "ucs2_bin", False), # 90
|
||||
("ujis", "ujis_bin", False), # 91
|
||||
("geostd8", "geostd8_general_ci", True), # 92
|
||||
("geostd8", "geostd8_bin", False), # 93
|
||||
("latin1", "latin1_spanish_ci", False), # 94
|
||||
("cp932", "cp932_japanese_ci", True), # 95
|
||||
("cp932", "cp932_bin", False), # 96
|
||||
("eucjpms", "eucjpms_japanese_ci", True), # 97
|
||||
("eucjpms", "eucjpms_bin", False), # 98
|
||||
("cp1250", "cp1250_polish_ci", False), # 99
|
||||
None,
|
||||
("utf16", "utf16_unicode_ci", False), # 101
|
||||
("utf16", "utf16_icelandic_ci", False), # 102
|
||||
("utf16", "utf16_latvian_ci", False), # 103
|
||||
("utf16", "utf16_romanian_ci", False), # 104
|
||||
("utf16", "utf16_slovenian_ci", False), # 105
|
||||
("utf16", "utf16_polish_ci", False), # 106
|
||||
("utf16", "utf16_estonian_ci", False), # 107
|
||||
("utf16", "utf16_spanish_ci", False), # 108
|
||||
("utf16", "utf16_swedish_ci", False), # 109
|
||||
("utf16", "utf16_turkish_ci", False), # 110
|
||||
("utf16", "utf16_czech_ci", False), # 111
|
||||
("utf16", "utf16_danish_ci", False), # 112
|
||||
("utf16", "utf16_lithuanian_ci", False), # 113
|
||||
("utf16", "utf16_slovak_ci", False), # 114
|
||||
("utf16", "utf16_spanish2_ci", False), # 115
|
||||
("utf16", "utf16_roman_ci", False), # 116
|
||||
("utf16", "utf16_persian_ci", False), # 117
|
||||
("utf16", "utf16_esperanto_ci", False), # 118
|
||||
("utf16", "utf16_hungarian_ci", False), # 119
|
||||
("utf16", "utf16_sinhala_ci", False), # 120
|
||||
("utf16", "utf16_german2_ci", False), # 121
|
||||
("utf16", "utf16_croatian_ci", False), # 122
|
||||
("utf16", "utf16_unicode_520_ci", False), # 123
|
||||
("utf16", "utf16_vietnamese_ci", False), # 124
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
("ucs2", "ucs2_unicode_ci", False), # 128
|
||||
("ucs2", "ucs2_icelandic_ci", False), # 129
|
||||
("ucs2", "ucs2_latvian_ci", False), # 130
|
||||
("ucs2", "ucs2_romanian_ci", False), # 131
|
||||
("ucs2", "ucs2_slovenian_ci", False), # 132
|
||||
("ucs2", "ucs2_polish_ci", False), # 133
|
||||
("ucs2", "ucs2_estonian_ci", False), # 134
|
||||
("ucs2", "ucs2_spanish_ci", False), # 135
|
||||
("ucs2", "ucs2_swedish_ci", False), # 136
|
||||
("ucs2", "ucs2_turkish_ci", False), # 137
|
||||
("ucs2", "ucs2_czech_ci", False), # 138
|
||||
("ucs2", "ucs2_danish_ci", False), # 139
|
||||
("ucs2", "ucs2_lithuanian_ci", False), # 140
|
||||
("ucs2", "ucs2_slovak_ci", False), # 141
|
||||
("ucs2", "ucs2_spanish2_ci", False), # 142
|
||||
("ucs2", "ucs2_roman_ci", False), # 143
|
||||
("ucs2", "ucs2_persian_ci", False), # 144
|
||||
("ucs2", "ucs2_esperanto_ci", False), # 145
|
||||
("ucs2", "ucs2_hungarian_ci", False), # 146
|
||||
("ucs2", "ucs2_sinhala_ci", False), # 147
|
||||
("ucs2", "ucs2_german2_ci", False), # 148
|
||||
("ucs2", "ucs2_croatian_ci", False), # 149
|
||||
("ucs2", "ucs2_unicode_520_ci", False), # 150
|
||||
("ucs2", "ucs2_vietnamese_ci", False), # 151
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
("ucs2", "ucs2_general_mysql500_ci", False), # 159
|
||||
("utf32", "utf32_unicode_ci", False), # 160
|
||||
("utf32", "utf32_icelandic_ci", False), # 161
|
||||
("utf32", "utf32_latvian_ci", False), # 162
|
||||
("utf32", "utf32_romanian_ci", False), # 163
|
||||
("utf32", "utf32_slovenian_ci", False), # 164
|
||||
("utf32", "utf32_polish_ci", False), # 165
|
||||
("utf32", "utf32_estonian_ci", False), # 166
|
||||
("utf32", "utf32_spanish_ci", False), # 167
|
||||
("utf32", "utf32_swedish_ci", False), # 168
|
||||
("utf32", "utf32_turkish_ci", False), # 169
|
||||
("utf32", "utf32_czech_ci", False), # 170
|
||||
("utf32", "utf32_danish_ci", False), # 171
|
||||
("utf32", "utf32_lithuanian_ci", False), # 172
|
||||
("utf32", "utf32_slovak_ci", False), # 173
|
||||
("utf32", "utf32_spanish2_ci", False), # 174
|
||||
("utf32", "utf32_roman_ci", False), # 175
|
||||
("utf32", "utf32_persian_ci", False), # 176
|
||||
("utf32", "utf32_esperanto_ci", False), # 177
|
||||
("utf32", "utf32_hungarian_ci", False), # 178
|
||||
("utf32", "utf32_sinhala_ci", False), # 179
|
||||
("utf32", "utf32_german2_ci", False), # 180
|
||||
("utf32", "utf32_croatian_ci", False), # 181
|
||||
("utf32", "utf32_unicode_520_ci", False), # 182
|
||||
("utf32", "utf32_vietnamese_ci", False), # 183
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
("utf8", "utf8_unicode_ci", False), # 192
|
||||
("utf8", "utf8_icelandic_ci", False), # 193
|
||||
("utf8", "utf8_latvian_ci", False), # 194
|
||||
("utf8", "utf8_romanian_ci", False), # 195
|
||||
("utf8", "utf8_slovenian_ci", False), # 196
|
||||
("utf8", "utf8_polish_ci", False), # 197
|
||||
("utf8", "utf8_estonian_ci", False), # 198
|
||||
("utf8", "utf8_spanish_ci", False), # 199
|
||||
("utf8", "utf8_swedish_ci", False), # 200
|
||||
("utf8", "utf8_turkish_ci", False), # 201
|
||||
("utf8", "utf8_czech_ci", False), # 202
|
||||
("utf8", "utf8_danish_ci", False), # 203
|
||||
("utf8", "utf8_lithuanian_ci", False), # 204
|
||||
("utf8", "utf8_slovak_ci", False), # 205
|
||||
("utf8", "utf8_spanish2_ci", False), # 206
|
||||
("utf8", "utf8_roman_ci", False), # 207
|
||||
("utf8", "utf8_persian_ci", False), # 208
|
||||
("utf8", "utf8_esperanto_ci", False), # 209
|
||||
("utf8", "utf8_hungarian_ci", False), # 210
|
||||
("utf8", "utf8_sinhala_ci", False), # 211
|
||||
("utf8", "utf8_german2_ci", False), # 212
|
||||
("utf8", "utf8_croatian_ci", False), # 213
|
||||
("utf8", "utf8_unicode_520_ci", False), # 214
|
||||
("utf8", "utf8_vietnamese_ci", False), # 215
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
("utf8", "utf8_general_mysql500_ci", False), # 223
|
||||
("utf8mb4", "utf8mb4_unicode_ci", False), # 224
|
||||
("utf8mb4", "utf8mb4_icelandic_ci", False), # 225
|
||||
("utf8mb4", "utf8mb4_latvian_ci", False), # 226
|
||||
("utf8mb4", "utf8mb4_romanian_ci", False), # 227
|
||||
("utf8mb4", "utf8mb4_slovenian_ci", False), # 228
|
||||
("utf8mb4", "utf8mb4_polish_ci", False), # 229
|
||||
("utf8mb4", "utf8mb4_estonian_ci", False), # 230
|
||||
("utf8mb4", "utf8mb4_spanish_ci", False), # 231
|
||||
("utf8mb4", "utf8mb4_swedish_ci", False), # 232
|
||||
("utf8mb4", "utf8mb4_turkish_ci", False), # 233
|
||||
("utf8mb4", "utf8mb4_czech_ci", False), # 234
|
||||
("utf8mb4", "utf8mb4_danish_ci", False), # 235
|
||||
("utf8mb4", "utf8mb4_lithuanian_ci", False), # 236
|
||||
("utf8mb4", "utf8mb4_slovak_ci", False), # 237
|
||||
("utf8mb4", "utf8mb4_spanish2_ci", False), # 238
|
||||
("utf8mb4", "utf8mb4_roman_ci", False), # 239
|
||||
("utf8mb4", "utf8mb4_persian_ci", False), # 240
|
||||
("utf8mb4", "utf8mb4_esperanto_ci", False), # 241
|
||||
("utf8mb4", "utf8mb4_hungarian_ci", False), # 242
|
||||
("utf8mb4", "utf8mb4_sinhala_ci", False), # 243
|
||||
("utf8mb4", "utf8mb4_german2_ci", False), # 244
|
||||
("utf8mb4", "utf8mb4_croatian_ci", False), # 245
|
||||
("utf8mb4", "utf8mb4_unicode_520_ci", False), # 246
|
||||
("utf8mb4", "utf8mb4_vietnamese_ci", False), # 247
|
||||
("gb18030", "gb18030_chinese_ci", True), # 248
|
||||
("gb18030", "gb18030_bin", False), # 249
|
||||
("gb18030", "gb18030_unicode_520_ci", False), # 250
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
("utf8mb4", "utf8mb4_0900_ai_ci", True), # 255
|
||||
("utf8mb4", "utf8mb4_de_pb_0900_ai_ci", False), # 256
|
||||
("utf8mb4", "utf8mb4_is_0900_ai_ci", False), # 257
|
||||
("utf8mb4", "utf8mb4_lv_0900_ai_ci", False), # 258
|
||||
("utf8mb4", "utf8mb4_ro_0900_ai_ci", False), # 259
|
||||
("utf8mb4", "utf8mb4_sl_0900_ai_ci", False), # 260
|
||||
("utf8mb4", "utf8mb4_pl_0900_ai_ci", False), # 261
|
||||
("utf8mb4", "utf8mb4_et_0900_ai_ci", False), # 262
|
||||
("utf8mb4", "utf8mb4_es_0900_ai_ci", False), # 263
|
||||
("utf8mb4", "utf8mb4_sv_0900_ai_ci", False), # 264
|
||||
("utf8mb4", "utf8mb4_tr_0900_ai_ci", False), # 265
|
||||
("utf8mb4", "utf8mb4_cs_0900_ai_ci", False), # 266
|
||||
("utf8mb4", "utf8mb4_da_0900_ai_ci", False), # 267
|
||||
("utf8mb4", "utf8mb4_lt_0900_ai_ci", False), # 268
|
||||
("utf8mb4", "utf8mb4_sk_0900_ai_ci", False), # 269
|
||||
("utf8mb4", "utf8mb4_es_trad_0900_ai_ci", False), # 270
|
||||
("utf8mb4", "utf8mb4_la_0900_ai_ci", False), # 271
|
||||
None,
|
||||
("utf8mb4", "utf8mb4_eo_0900_ai_ci", False), # 273
|
||||
("utf8mb4", "utf8mb4_hu_0900_ai_ci", False), # 274
|
||||
("utf8mb4", "utf8mb4_hr_0900_ai_ci", False), # 275
|
||||
None,
|
||||
("utf8mb4", "utf8mb4_vi_0900_ai_ci", False), # 277
|
||||
("utf8mb4", "utf8mb4_0900_as_cs", False), # 278
|
||||
("utf8mb4", "utf8mb4_de_pb_0900_as_cs", False), # 279
|
||||
("utf8mb4", "utf8mb4_is_0900_as_cs", False), # 280
|
||||
("utf8mb4", "utf8mb4_lv_0900_as_cs", False), # 281
|
||||
("utf8mb4", "utf8mb4_ro_0900_as_cs", False), # 282
|
||||
("utf8mb4", "utf8mb4_sl_0900_as_cs", False), # 283
|
||||
("utf8mb4", "utf8mb4_pl_0900_as_cs", False), # 284
|
||||
("utf8mb4", "utf8mb4_et_0900_as_cs", False), # 285
|
||||
("utf8mb4", "utf8mb4_es_0900_as_cs", False), # 286
|
||||
("utf8mb4", "utf8mb4_sv_0900_as_cs", False), # 287
|
||||
("utf8mb4", "utf8mb4_tr_0900_as_cs", False), # 288
|
||||
("utf8mb4", "utf8mb4_cs_0900_as_cs", False), # 289
|
||||
("utf8mb4", "utf8mb4_da_0900_as_cs", False), # 290
|
||||
("utf8mb4", "utf8mb4_lt_0900_as_cs", False), # 291
|
||||
("utf8mb4", "utf8mb4_sk_0900_as_cs", False), # 292
|
||||
("utf8mb4", "utf8mb4_es_trad_0900_as_cs", False), # 293
|
||||
("utf8mb4", "utf8mb4_la_0900_as_cs", False), # 294
|
||||
None,
|
||||
("utf8mb4", "utf8mb4_eo_0900_as_cs", False), # 296
|
||||
("utf8mb4", "utf8mb4_hu_0900_as_cs", False), # 297
|
||||
("utf8mb4", "utf8mb4_hr_0900_as_cs", False), # 298
|
||||
None,
|
||||
("utf8mb4", "utf8mb4_vi_0900_as_cs", False), # 300
|
||||
None,
|
||||
None,
|
||||
("utf8mb4", "utf8mb4_ja_0900_as_cs", False), # 303
|
||||
("utf8mb4", "utf8mb4_ja_0900_as_cs_ks", False), # 304
|
||||
("utf8mb4", "utf8mb4_0900_as_ci", False), # 305
|
||||
("utf8mb4", "utf8mb4_ru_0900_ai_ci", False), # 306
|
||||
("utf8mb4", "utf8mb4_ru_0900_as_cs", False), # 307
|
||||
("utf8mb4", "utf8mb4_zh_0900_as_cs", False), # 308
|
||||
("utf8mb4", "utf8mb4_0900_bin", False), # 309
|
||||
]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,323 @@
|
||||
# Copyright (c) 2016, 2019, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
"""Constants."""
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
# pylint: disable=C0103
|
||||
def create_enum(name, fields, values=None):
|
||||
"""Emulates an enum by creating a namedtuple.
|
||||
|
||||
Args:
|
||||
name (string): The type name.
|
||||
fields (tuple): The fields names.
|
||||
values (tuple): The values of the fields.
|
||||
|
||||
Returns:
|
||||
namedtuple: A namedtuple object.
|
||||
"""
|
||||
Enum = namedtuple(name, fields)
|
||||
if values is None:
|
||||
return Enum(*fields)
|
||||
return Enum(*values)
|
||||
|
||||
|
||||
SSLMode = create_enum("SSLMode",
|
||||
("REQUIRED", "DISABLED", "VERIFY_CA", "VERIFY_IDENTITY"),
|
||||
("required", "disabled", "verify_ca", "verify_identity"))
|
||||
Auth = create_enum("Auth",
|
||||
("PLAIN", "MYSQL41", "SHA256_MEMORY"),
|
||||
("plain", "mysql41", "sha256_memory"))
|
||||
LockContention = create_enum("LockContention",
|
||||
("DEFAULT", "NOWAIT", "SKIP_LOCKED"), (0, 1, 2))
|
||||
|
||||
# Compression algorithms and aliases
|
||||
COMPRESSION_ALGORITHMS = {
|
||||
"deflate": "deflate_stream",
|
||||
"deflate_stream": "deflate_stream",
|
||||
"lz4": "lz4_message",
|
||||
"lz4_message": "lz4_message",
|
||||
"zstd": "zstd_stream",
|
||||
"zstd_stream": "zstd_stream"
|
||||
}
|
||||
|
||||
TLS_VERSIONS = ["TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"]
|
||||
|
||||
# TLS v1.0 cipher suites IANI to OpenSSL name translation
|
||||
TLSV1_CIPHER_SUITES = {
|
||||
"TLS_RSA_WITH_NULL_MD5": "NULL-MD5",
|
||||
"TLS_RSA_WITH_NULL_SHA": "NULL-SHA",
|
||||
"TLS_RSA_WITH_RC4_128_MD5": "RC4-MD5",
|
||||
"TLS_RSA_WITH_RC4_128_SHA": "RC4-SHA",
|
||||
"TLS_RSA_WITH_IDEA_CBC_SHA": "IDEA-CBC-SHA",
|
||||
"TLS_RSA_WITH_3DES_EDE_CBC_SHA": "DES-CBC3-SHA",
|
||||
|
||||
"TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA": "Not implemented.",
|
||||
"TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA": "Not implemented.",
|
||||
"TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA": "DHE-DSS-DES-CBC3-SHA",
|
||||
"TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA": "DHE-RSA-DES-CBC3-SHA",
|
||||
|
||||
"TLS_DH_anon_WITH_RC4_128_MD5": "ADH-RC4-MD5",
|
||||
"TLS_DH_anon_WITH_3DES_EDE_CBC_SHA": "ADH-DES-CBC3-SHA",
|
||||
|
||||
# AES cipher suites from RFC3268, extending TLS v1.0
|
||||
"TLS_RSA_WITH_AES_128_CBC_SHA": "AES128-SHA",
|
||||
"TLS_RSA_WITH_AES_256_CBC_SHA": "AES256-SHA",
|
||||
|
||||
"TLS_DH_DSS_WITH_AES_128_CBC_SHA": "DH-DSS-AES128-SHA",
|
||||
"TLS_DH_DSS_WITH_AES_256_CBC_SHA": "DH-DSS-AES256-SHA",
|
||||
"TLS_DH_RSA_WITH_AES_128_CBC_SHA": "DH-RSA-AES128-SHA",
|
||||
"TLS_DH_RSA_WITH_AES_256_CBC_SHA": "DH-RSA-AES256-SHA",
|
||||
|
||||
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA": "DHE-DSS-AES128-SHA",
|
||||
"TLS_DHE_DSS_WITH_AES_256_CBC_SHA": "DHE-DSS-AES256-SHA",
|
||||
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA": "DHE-RSA-AES128-SHA",
|
||||
"TLS_DHE_RSA_WITH_AES_256_CBC_SHA": "DHE-RSA-AES256-SHA",
|
||||
|
||||
"TLS_DH_anon_WITH_AES_128_CBC_SHA": "ADH-AES128-SHA",
|
||||
"TLS_DH_anon_WITH_AES_256_CBC_SHA": "ADH-AES256-SHA",
|
||||
|
||||
# Camellia cipher suites from RFC4132, extending TLS v1.0
|
||||
"TLS_RSA_WITH_CAMELLIA_128_CBC_SHA": "CAMELLIA128-SHA",
|
||||
"TLS_RSA_WITH_CAMELLIA_256_CBC_SHA": "CAMELLIA256-SHA",
|
||||
|
||||
"TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA": "DH-DSS-CAMELLIA128-SHA",
|
||||
"TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA": "DH-DSS-CAMELLIA256-SHA",
|
||||
"TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA": "DH-RSA-CAMELLIA128-SHA",
|
||||
"TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA": "DH-RSA-CAMELLIA256-SHA",
|
||||
|
||||
"TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA": "DHE-DSS-CAMELLIA128-SHA",
|
||||
"TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA": "DHE-DSS-CAMELLIA256-SHA",
|
||||
"TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA": "DHE-RSA-CAMELLIA128-SHA",
|
||||
"TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA": "DHE-RSA-CAMELLIA256-SHA",
|
||||
|
||||
"TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA": "ADH-CAMELLIA128-SHA",
|
||||
"TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA": "ADH-CAMELLIA256-SHA",
|
||||
|
||||
# SEED cipher suites from RFC4162, extending TLS v1.0
|
||||
"TLS_RSA_WITH_SEED_CBC_SHA": "SEED-SHA",
|
||||
|
||||
"TLS_DH_DSS_WITH_SEED_CBC_SHA": "DH-DSS-SEED-SHA",
|
||||
"TLS_DH_RSA_WITH_SEED_CBC_SHA": "DH-RSA-SEED-SHA",
|
||||
|
||||
"TLS_DHE_DSS_WITH_SEED_CBC_SHA": "DHE-DSS-SEED-SHA",
|
||||
"TLS_DHE_RSA_WITH_SEED_CBC_SHA": "DHE-RSA-SEED-SHA",
|
||||
|
||||
"TLS_DH_anon_WITH_SEED_CBC_SHA": "ADH-SEED-SHA",
|
||||
|
||||
# GOST cipher suites from draft-chudov-cryptopro-cptls, extending TLS v1.0
|
||||
"TLS_GOSTR341094_WITH_28147_CNT_IMIT": "GOST94-GOST89-GOST89",
|
||||
"TLS_GOSTR341001_WITH_28147_CNT_IMIT": "GOST2001-GOST89-GOST89",
|
||||
"TLS_GOSTR341094_WITH_NULL_GOSTR3411": "GOST94-NULL-GOST94",
|
||||
"TLS_GOSTR341001_WITH_NULL_GOSTR3411": "GOST2001-NULL-GOST94"}
|
||||
|
||||
# TLS v1.1 cipher suites IANI to OpenSSL name translation
|
||||
TLSV1_1_CIPHER_SUITES = TLSV1_CIPHER_SUITES
|
||||
|
||||
# TLS v1.2 cipher suites IANI to OpenSSL name translation
|
||||
TLSV1_2_CIPHER_SUITES = {
|
||||
"TLS_RSA_WITH_NULL_SHA256": "NULL-SHA256",
|
||||
|
||||
"TLS_RSA_WITH_AES_128_CBC_SHA256": "AES128-SHA256",
|
||||
"TLS_RSA_WITH_AES_256_CBC_SHA256": "AES256-SHA256",
|
||||
"TLS_RSA_WITH_AES_128_GCM_SHA256": "AES128-GCM-SHA256",
|
||||
"TLS_RSA_WITH_AES_256_GCM_SHA384": "AES256-GCM-SHA384",
|
||||
|
||||
"TLS_DH_RSA_WITH_AES_128_CBC_SHA256": "DH-RSA-AES128-SHA256",
|
||||
"TLS_DH_RSA_WITH_AES_256_CBC_SHA256": "DH-RSA-AES256-SHA256",
|
||||
"TLS_DH_RSA_WITH_AES_128_GCM_SHA256": "DH-RSA-AES128-GCM-SHA256",
|
||||
"TLS_DH_RSA_WITH_AES_256_GCM_SHA384": "DH-RSA-AES256-GCM-SHA384",
|
||||
|
||||
"TLS_DH_DSS_WITH_AES_128_CBC_SHA256": "DH-DSS-AES128-SHA256",
|
||||
"TLS_DH_DSS_WITH_AES_256_CBC_SHA256": "DH-DSS-AES256-SHA256",
|
||||
"TLS_DH_DSS_WITH_AES_128_GCM_SHA256": "DH-DSS-AES128-GCM-SHA256",
|
||||
"TLS_DH_DSS_WITH_AES_256_GCM_SHA384": "DH-DSS-AES256-GCM-SHA384",
|
||||
|
||||
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA256": "DHE-RSA-AES128-SHA256",
|
||||
"TLS_DHE_RSA_WITH_AES_256_CBC_SHA256": "DHE-RSA-AES256-SHA256",
|
||||
"TLS_DHE_RSA_WITH_AES_128_GCM_SHA256": "DHE-RSA-AES128-GCM-SHA256",
|
||||
"TLS_DHE_RSA_WITH_AES_256_GCM_SHA384": "DHE-RSA-AES256-GCM-SHA384",
|
||||
|
||||
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA256": "DHE-DSS-AES128-SHA256",
|
||||
"TLS_DHE_DSS_WITH_AES_256_CBC_SHA256": "DHE-DSS-AES256-SHA256",
|
||||
"TLS_DHE_DSS_WITH_AES_128_GCM_SHA256": "DHE-DSS-AES128-GCM-SHA256",
|
||||
"TLS_DHE_DSS_WITH_AES_256_GCM_SHA384": "DHE-DSS-AES256-GCM-SHA384",
|
||||
|
||||
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256": "ECDHE-RSA-AES128-SHA256",
|
||||
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384": "ECDHE-RSA-AES256-SHA384",
|
||||
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256": "ECDHE-RSA-AES128-GCM-SHA256",
|
||||
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384": "ECDHE-RSA-AES256-GCM-SHA384",
|
||||
|
||||
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256": "ECDHE-ECDSA-AES128-SHA256",
|
||||
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384": "ECDHE-ECDSA-AES256-SHA384",
|
||||
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256": "ECDHE-ECDSA-AES128-GCM-SHA256",
|
||||
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384": "ECDHE-ECDSA-AES256-GCM-SHA384",
|
||||
|
||||
"TLS_DH_anon_WITH_AES_128_CBC_SHA256": "ADH-AES128-SHA256",
|
||||
"TLS_DH_anon_WITH_AES_256_CBC_SHA256": "ADH-AES256-SHA256",
|
||||
"TLS_DH_anon_WITH_AES_128_GCM_SHA256": "ADH-AES128-GCM-SHA256",
|
||||
"TLS_DH_anon_WITH_AES_256_GCM_SHA384": "ADH-AES256-GCM-SHA384",
|
||||
|
||||
"RSA_WITH_AES_128_CCM": "AES128-CCM",
|
||||
"RSA_WITH_AES_256_CCM": "AES256-CCM",
|
||||
"DHE_RSA_WITH_AES_128_CCM": "DHE-RSA-AES128-CCM",
|
||||
"DHE_RSA_WITH_AES_256_CCM": "DHE-RSA-AES256-CCM",
|
||||
"RSA_WITH_AES_128_CCM_8": "AES128-CCM8",
|
||||
"RSA_WITH_AES_256_CCM_8": "AES256-CCM8",
|
||||
"DHE_RSA_WITH_AES_128_CCM_8": "DHE-RSA-AES128-CCM8",
|
||||
"DHE_RSA_WITH_AES_256_CCM_8": "DHE-RSA-AES256-CCM8",
|
||||
"ECDHE_ECDSA_WITH_AES_128_CCM": "ECDHE-ECDSA-AES128-CCM",
|
||||
"ECDHE_ECDSA_WITH_AES_256_CCM": "ECDHE-ECDSA-AES256-CCM",
|
||||
"ECDHE_ECDSA_WITH_AES_128_CCM_8": "ECDHE-ECDSA-AES128-CCM8",
|
||||
"ECDHE_ECDSA_WITH_AES_256_CCM_8": "ECDHE-ECDSA-AES256-CCM8",
|
||||
|
||||
# ARIA cipher suites from RFC6209, extending TLS v1.2
|
||||
"TLS_RSA_WITH_ARIA_128_GCM_SHA256": "ARIA128-GCM-SHA256",
|
||||
"TLS_RSA_WITH_ARIA_256_GCM_SHA384": "ARIA256-GCM-SHA384",
|
||||
"TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256": "DHE-RSA-ARIA128-GCM-SHA256",
|
||||
"TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384": "DHE-RSA-ARIA256-GCM-SHA384",
|
||||
"TLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256": "DHE-DSS-ARIA128-GCM-SHA256",
|
||||
"TLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384": "DHE-DSS-ARIA256-GCM-SHA384",
|
||||
"TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256": "ECDHE-ECDSA-ARIA128-GCM-SHA256",
|
||||
"TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384": "ECDHE-ECDSA-ARIA256-GCM-SHA384",
|
||||
"TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256": "ECDHE-ARIA128-GCM-SHA256",
|
||||
"TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384": "ECDHE-ARIA256-GCM-SHA384",
|
||||
"TLS_PSK_WITH_ARIA_128_GCM_SHA256": "PSK-ARIA128-GCM-SHA256",
|
||||
"TLS_PSK_WITH_ARIA_256_GCM_SHA384": "PSK-ARIA256-GCM-SHA384",
|
||||
"TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256": "DHE-PSK-ARIA128-GCM-SHA256",
|
||||
"TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384": "DHE-PSK-ARIA256-GCM-SHA384",
|
||||
"TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256": "RSA-PSK-ARIA128-GCM-SHA256",
|
||||
"TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384": "RSA-PSK-ARIA256-GCM-SHA384",
|
||||
|
||||
# Camellia HMAC-Based cipher suites from RFC6367, extending TLS v1.2
|
||||
"TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256": "ECDHE-ECDSA-CAMELLIA128-SHA256",
|
||||
"TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384": "ECDHE-ECDSA-CAMELLIA256-SHA384",
|
||||
"TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256": "ECDHE-RSA-CAMELLIA128-SHA256",
|
||||
"TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384": "ECDHE-RSA-CAMELLIA256-SHA384",
|
||||
|
||||
# Pre-shared keying (PSK) cipher suites",
|
||||
"PSK_WITH_NULL_SHA": "PSK-NULL-SHA",
|
||||
"DHE_PSK_WITH_NULL_SHA": "DHE-PSK-NULL-SHA",
|
||||
"RSA_PSK_WITH_NULL_SHA": "RSA-PSK-NULL-SHA",
|
||||
|
||||
"PSK_WITH_RC4_128_SHA": "PSK-RC4-SHA",
|
||||
"PSK_WITH_3DES_EDE_CBC_SHA": "PSK-3DES-EDE-CBC-SHA",
|
||||
"PSK_WITH_AES_128_CBC_SHA": "PSK-AES128-CBC-SHA",
|
||||
"PSK_WITH_AES_256_CBC_SHA": "PSK-AES256-CBC-SHA",
|
||||
|
||||
"DHE_PSK_WITH_RC4_128_SHA": "DHE-PSK-RC4-SHA",
|
||||
"DHE_PSK_WITH_3DES_EDE_CBC_SHA": "DHE-PSK-3DES-EDE-CBC-SHA",
|
||||
"DHE_PSK_WITH_AES_128_CBC_SHA": "DHE-PSK-AES128-CBC-SHA",
|
||||
"DHE_PSK_WITH_AES_256_CBC_SHA": "DHE-PSK-AES256-CBC-SHA",
|
||||
|
||||
"RSA_PSK_WITH_RC4_128_SHA": "RSA-PSK-RC4-SHA",
|
||||
"RSA_PSK_WITH_3DES_EDE_CBC_SHA": "RSA-PSK-3DES-EDE-CBC-SHA",
|
||||
"RSA_PSK_WITH_AES_128_CBC_SHA": "RSA-PSK-AES128-CBC-SHA",
|
||||
"RSA_PSK_WITH_AES_256_CBC_SHA": "RSA-PSK-AES256-CBC-SHA",
|
||||
|
||||
"PSK_WITH_AES_128_GCM_SHA256": "PSK-AES128-GCM-SHA256",
|
||||
"PSK_WITH_AES_256_GCM_SHA384": "PSK-AES256-GCM-SHA384",
|
||||
"DHE_PSK_WITH_AES_128_GCM_SHA256": "DHE-PSK-AES128-GCM-SHA256",
|
||||
"DHE_PSK_WITH_AES_256_GCM_SHA384": "DHE-PSK-AES256-GCM-SHA384",
|
||||
"RSA_PSK_WITH_AES_128_GCM_SHA256": "RSA-PSK-AES128-GCM-SHA256",
|
||||
"RSA_PSK_WITH_AES_256_GCM_SHA384": "RSA-PSK-AES256-GCM-SHA384",
|
||||
|
||||
"PSK_WITH_AES_128_CBC_SHA256": "PSK-AES128-CBC-SHA256",
|
||||
"PSK_WITH_AES_256_CBC_SHA384": "PSK-AES256-CBC-SHA384",
|
||||
"PSK_WITH_NULL_SHA256": "PSK-NULL-SHA256",
|
||||
"PSK_WITH_NULL_SHA384": "PSK-NULL-SHA384",
|
||||
"DHE_PSK_WITH_AES_128_CBC_SHA256": "DHE-PSK-AES128-CBC-SHA256",
|
||||
"DHE_PSK_WITH_AES_256_CBC_SHA384": "DHE-PSK-AES256-CBC-SHA384",
|
||||
"DHE_PSK_WITH_NULL_SHA256": "DHE-PSK-NULL-SHA256",
|
||||
"DHE_PSK_WITH_NULL_SHA384": "DHE-PSK-NULL-SHA384",
|
||||
"RSA_PSK_WITH_AES_128_CBC_SHA256": "RSA-PSK-AES128-CBC-SHA256",
|
||||
"RSA_PSK_WITH_AES_256_CBC_SHA384": "RSA-PSK-AES256-CBC-SHA384",
|
||||
"RSA_PSK_WITH_NULL_SHA256": "RSA-PSK-NULL-SHA256",
|
||||
"RSA_PSK_WITH_NULL_SHA384": "RSA-PSK-NULL-SHA384",
|
||||
|
||||
"ECDHE_PSK_WITH_RC4_128_SHA": "ECDHE-PSK-RC4-SHA",
|
||||
"ECDHE_PSK_WITH_3DES_EDE_CBC_SHA": "ECDHE-PSK-3DES-EDE-CBC-SHA",
|
||||
"ECDHE_PSK_WITH_AES_128_CBC_SHA": "ECDHE-PSK-AES128-CBC-SHA",
|
||||
"ECDHE_PSK_WITH_AES_256_CBC_SHA": "ECDHE-PSK-AES256-CBC-SHA",
|
||||
"ECDHE_PSK_WITH_AES_128_CBC_SHA256": "ECDHE-PSK-AES128-CBC-SHA256",
|
||||
"ECDHE_PSK_WITH_AES_256_CBC_SHA384": "ECDHE-PSK-AES256-CBC-SHA384",
|
||||
"ECDHE_PSK_WITH_NULL_SHA": "ECDHE-PSK-NULL-SHA",
|
||||
"ECDHE_PSK_WITH_NULL_SHA256": "ECDHE-PSK-NULL-SHA256",
|
||||
"ECDHE_PSK_WITH_NULL_SHA384": "ECDHE-PSK-NULL-SHA384",
|
||||
|
||||
"PSK_WITH_CAMELLIA_128_CBC_SHA256": "PSK-CAMELLIA128-SHA256",
|
||||
"PSK_WITH_CAMELLIA_256_CBC_SHA384": "PSK-CAMELLIA256-SHA384",
|
||||
|
||||
"DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256": "DHE-PSK-CAMELLIA128-SHA256",
|
||||
"DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384": "DHE-PSK-CAMELLIA256-SHA384",
|
||||
|
||||
"RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256": "RSA-PSK-CAMELLIA128-SHA256",
|
||||
"RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384": "RSA-PSK-CAMELLIA256-SHA384",
|
||||
|
||||
"ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256": "ECDHE-PSK-CAMELLIA128-SHA256",
|
||||
"ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384": "ECDHE-PSK-CAMELLIA256-SHA384",
|
||||
|
||||
"PSK_WITH_AES_128_CCM": "PSK-AES128-CCM",
|
||||
"PSK_WITH_AES_256_CCM": "PSK-AES256-CCM",
|
||||
"DHE_PSK_WITH_AES_128_CCM": "DHE-PSK-AES128-CCM",
|
||||
"DHE_PSK_WITH_AES_256_CCM": "DHE-PSK-AES256-CCM",
|
||||
"PSK_WITH_AES_128_CCM_8": "PSK-AES128-CCM8",
|
||||
"PSK_WITH_AES_256_CCM_8": "PSK-AES256-CCM8",
|
||||
"DHE_PSK_WITH_AES_128_CCM_8": "DHE-PSK-AES128-CCM8",
|
||||
"DHE_PSK_WITH_AES_256_CCM_8": "DHE-PSK-AES256-CCM8",
|
||||
|
||||
# ChaCha20-Poly1305 cipher suites, extending TLS v1.2
|
||||
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256": "ECDHE-RSA-CHACHA20-POLY1305",
|
||||
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256": "ECDHE-ECDSA-CHACHA20-POLY1305",
|
||||
"TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256": "DHE-RSA-CHACHA20-POLY1305",
|
||||
"TLS_PSK_WITH_CHACHA20_POLY1305_SHA256": "PSK-CHACHA20-POLY1305",
|
||||
"TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256": "ECDHE-PSK-CHACHA20-POLY1305",
|
||||
"TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256": "DHE-PSK-CHACHA20-POLY1305",
|
||||
"TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256": "RSA-PSK-CHACHA20-POLY1305"}
|
||||
|
||||
# TLS v1.3 cipher suites IANI to OpenSSL name translation
|
||||
TLSV1_3_CIPHER_SUITES = {
|
||||
"TLS_AES_128_GCM_SHA256": "TLS_AES_128_GCM_SHA256",
|
||||
"TLS_AES_256_GCM_SHA384": "TLS_AES_256_GCM_SHA384",
|
||||
"TLS_CHACHA20_POLY1305_SHA256": "TLS_CHACHA20_POLY1305_SHA256",
|
||||
"TLS_AES_128_CCM_SHA256": "TLS_AES_128_CCM_SHA256",
|
||||
"TLS_AES_128_CCM_8_SHA256": "TLS_AES_128_CCM_8_SHA256"}
|
||||
|
||||
TLS_CIPHER_SUITES = {
|
||||
"TLSv1": TLSV1_CIPHER_SUITES,
|
||||
"TLSv1.1": TLSV1_1_CIPHER_SUITES,
|
||||
"TLSv1.2": TLSV1_2_CIPHER_SUITES,
|
||||
"TLSv1.3": TLSV1_3_CIPHER_SUITES}
|
||||
|
||||
OPENSSL_CS_NAMES = {
|
||||
"TLSv1": TLSV1_CIPHER_SUITES.values(),
|
||||
"TLSv1.1": TLSV1_1_CIPHER_SUITES.values(),
|
||||
"TLSv1.2": TLSV1_2_CIPHER_SUITES.values(),
|
||||
"TLSv1.3": TLSV1_3_CIPHER_SUITES.values()}
|
||||
@@ -0,0 +1,722 @@
|
||||
# Copyright (c) 2016, 2021, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
"""Implementation of the CRUD database objects."""
|
||||
|
||||
import json
|
||||
import warnings
|
||||
|
||||
from .dbdoc import DbDoc
|
||||
from .errorcode import (ER_NO_SUCH_TABLE, ER_TABLE_EXISTS_ERROR,
|
||||
ER_X_CMD_NUM_ARGUMENTS, ER_X_INVALID_ADMIN_COMMAND)
|
||||
from .errors import NotSupportedError, OperationalError, ProgrammingError
|
||||
from .helpers import deprecated, escape, quote_identifier
|
||||
from .statement import (FindStatement, AddStatement, RemoveStatement,
|
||||
ModifyStatement, SelectStatement, InsertStatement,
|
||||
DeleteStatement, UpdateStatement,
|
||||
CreateCollectionIndexStatement)
|
||||
|
||||
|
||||
_COUNT_VIEWS_QUERY = ("SELECT COUNT(*) FROM information_schema.views "
|
||||
"WHERE table_schema = '{0}' AND table_name = '{1}'")
|
||||
_COUNT_TABLES_QUERY = ("SELECT COUNT(*) FROM information_schema.tables "
|
||||
"WHERE table_schema = '{0}' AND table_name = '{1}'")
|
||||
_COUNT_SCHEMAS_QUERY = ("SELECT COUNT(*) FROM information_schema.schemata "
|
||||
"WHERE schema_name = '{0}'")
|
||||
_COUNT_QUERY = "SELECT COUNT(*) FROM {0}.{1}"
|
||||
_DROP_TABLE_QUERY = "DROP TABLE IF EXISTS {0}.{1}"
|
||||
|
||||
|
||||
class DatabaseObject(object):
|
||||
"""Provides base functionality for database objects.
|
||||
|
||||
Args:
|
||||
schema (mysqlx.Schema): The Schema object.
|
||||
name (str): The database object name.
|
||||
"""
|
||||
def __init__(self, schema, name):
|
||||
self._schema = schema
|
||||
self._name = name.decode() if isinstance(name, bytes) else name
|
||||
self._session = self._schema.get_session()
|
||||
self._connection = self._session.get_connection()
|
||||
|
||||
@property
|
||||
def session(self):
|
||||
""":class:`mysqlx.Session`: The Session object.
|
||||
"""
|
||||
return self._session
|
||||
|
||||
@property
|
||||
def schema(self):
|
||||
""":class:`mysqlx.Schema`: The Schema object.
|
||||
"""
|
||||
return self._schema
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""str: The name of this database object.
|
||||
"""
|
||||
return self._name
|
||||
|
||||
def get_connection(self):
|
||||
"""Returns the underlying connection.
|
||||
|
||||
Returns:
|
||||
mysqlx.connection.Connection: The connection object.
|
||||
"""
|
||||
return self._connection
|
||||
|
||||
def get_session(self):
|
||||
"""Returns the session of this database object.
|
||||
|
||||
Returns:
|
||||
mysqlx.Session: The Session object.
|
||||
"""
|
||||
return self._session
|
||||
|
||||
def get_schema(self):
|
||||
"""Returns the Schema object of this database object.
|
||||
|
||||
Returns:
|
||||
mysqlx.Schema: The Schema object.
|
||||
"""
|
||||
return self._schema
|
||||
|
||||
def get_name(self):
|
||||
"""Returns the name of this database object.
|
||||
|
||||
Returns:
|
||||
str: The name of this database object.
|
||||
"""
|
||||
return self._name
|
||||
|
||||
def exists_in_database(self):
|
||||
"""Verifies if this object exists in the database.
|
||||
|
||||
Returns:
|
||||
bool: `True` if object exists in database.
|
||||
|
||||
Raises:
|
||||
NotImplementedError: This method must be implemented.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@deprecated("8.0.12", "Use 'exists_in_database()' method instead")
|
||||
def am_i_real(self):
|
||||
"""Verifies if this object exists in the database.
|
||||
|
||||
Returns:
|
||||
bool: `True` if object exists in database.
|
||||
|
||||
Raises:
|
||||
NotImplementedError: This method must be implemented.
|
||||
|
||||
.. deprecated:: 8.0.12
|
||||
Use ``exists_in_database()`` method instead.
|
||||
"""
|
||||
return self.exists_in_database()
|
||||
|
||||
@deprecated("8.0.12", "Use 'get_name()' method instead")
|
||||
def who_am_i(self):
|
||||
"""Returns the name of this database object.
|
||||
|
||||
Returns:
|
||||
str: The name of this database object.
|
||||
|
||||
.. deprecated:: 8.0.12
|
||||
Use ``get_name()`` method instead.
|
||||
"""
|
||||
return self.get_name()
|
||||
|
||||
|
||||
class Schema(DatabaseObject):
|
||||
"""A client-side representation of a database schema. Provides access to
|
||||
the schema contents.
|
||||
|
||||
Args:
|
||||
session (mysqlx.XSession): Session object.
|
||||
name (str): The Schema name.
|
||||
"""
|
||||
def __init__(self, session, name):
|
||||
self._session = session
|
||||
super(Schema, self).__init__(self, name)
|
||||
|
||||
def exists_in_database(self):
|
||||
"""Verifies if this object exists in the database.
|
||||
|
||||
Returns:
|
||||
bool: `True` if object exists in database.
|
||||
"""
|
||||
sql = _COUNT_SCHEMAS_QUERY.format(escape(self._name))
|
||||
return self._connection.execute_sql_scalar(sql) == 1
|
||||
|
||||
def get_collections(self):
|
||||
"""Returns a list of collections for this schema.
|
||||
|
||||
Returns:
|
||||
`list`: List of Collection objects.
|
||||
"""
|
||||
rows = self._connection.get_row_result("list_objects",
|
||||
{"schema": self._name})
|
||||
rows.fetch_all()
|
||||
collections = []
|
||||
for row in rows:
|
||||
if row["type"] != "COLLECTION":
|
||||
continue
|
||||
try:
|
||||
collection = Collection(self, row["TABLE_NAME"])
|
||||
except ValueError:
|
||||
collection = Collection(self, row["name"])
|
||||
collections.append(collection)
|
||||
return collections
|
||||
|
||||
def get_collection_as_table(self, name, check_existence=False):
|
||||
"""Returns a a table object for the given collection
|
||||
|
||||
Returns:
|
||||
mysqlx.Table: Table object.
|
||||
|
||||
"""
|
||||
return self.get_table(name, check_existence)
|
||||
|
||||
def get_tables(self):
|
||||
"""Returns a list of tables for this schema.
|
||||
|
||||
Returns:
|
||||
`list`: List of Table objects.
|
||||
"""
|
||||
rows = self._connection.get_row_result("list_objects",
|
||||
{"schema": self._name})
|
||||
rows.fetch_all()
|
||||
tables = []
|
||||
object_types = ("TABLE", "VIEW",)
|
||||
for row in rows:
|
||||
if row["type"] in object_types:
|
||||
try:
|
||||
table = Table(self, row["TABLE_NAME"])
|
||||
except ValueError:
|
||||
table = Table(self, row["name"])
|
||||
tables.append(table)
|
||||
return tables
|
||||
|
||||
def get_table(self, name, check_existence=False):
|
||||
"""Returns the table of the given name for this schema.
|
||||
|
||||
Returns:
|
||||
mysqlx.Table: Table object.
|
||||
"""
|
||||
table = Table(self, name)
|
||||
if check_existence:
|
||||
if not table.exists_in_database():
|
||||
raise ProgrammingError("Table does not exist")
|
||||
return table
|
||||
|
||||
def get_view(self, name, check_existence=False):
|
||||
"""Returns the view of the given name for this schema.
|
||||
|
||||
Returns:
|
||||
mysqlx.View: View object.
|
||||
"""
|
||||
view = View(self, name)
|
||||
if check_existence:
|
||||
if not view.exists_in_database():
|
||||
raise ProgrammingError("View does not exist")
|
||||
return view
|
||||
|
||||
def get_collection(self, name, check_existence=False):
|
||||
"""Returns the collection of the given name for this schema.
|
||||
|
||||
Returns:
|
||||
mysqlx.Collection: Collection object.
|
||||
"""
|
||||
collection = Collection(self, name)
|
||||
if check_existence:
|
||||
if not collection.exists_in_database():
|
||||
raise ProgrammingError("Collection does not exist")
|
||||
return collection
|
||||
|
||||
def drop_collection(self, name):
|
||||
"""Drops a collection.
|
||||
|
||||
Args:
|
||||
name (str): The name of the collection to be dropped.
|
||||
"""
|
||||
self._connection.execute_nonquery(
|
||||
"sql", _DROP_TABLE_QUERY.format(quote_identifier(self._name),
|
||||
quote_identifier(name)), False)
|
||||
|
||||
def create_collection(self, name, reuse_existing=False, validation=None,
|
||||
**kwargs):
|
||||
"""Creates in the current schema a new collection with the specified
|
||||
name and retrieves an object representing the new collection created.
|
||||
|
||||
Args:
|
||||
name (str): The name of the collection.
|
||||
reuse_existing (bool): `True` to reuse an existing collection.
|
||||
validation (Optional[dict]): A dict, containing the keys `level`
|
||||
with the validation level and `schema`
|
||||
with a dict or a string representation
|
||||
of a JSON schema specification.
|
||||
|
||||
Returns:
|
||||
mysqlx.Collection: Collection object.
|
||||
|
||||
Raises:
|
||||
:class:`mysqlx.ProgrammingError`: If ``reuse_existing`` is False
|
||||
and collection exists or the
|
||||
collection name is invalid.
|
||||
:class:`mysqlx.NotSupportedError`: If schema validation is not
|
||||
supported by the server.
|
||||
|
||||
.. versionchanged:: 8.0.21
|
||||
"""
|
||||
if not name:
|
||||
raise ProgrammingError("Collection name is invalid")
|
||||
|
||||
if "reuse" in kwargs:
|
||||
warnings.warn("'reuse' is deprecated since 8.0.21. "
|
||||
"Please use 'reuse_existing' instead",
|
||||
DeprecationWarning)
|
||||
reuse_existing = kwargs["reuse"]
|
||||
|
||||
collection = Collection(self, name)
|
||||
fields = {"schema": self._name, "name": name}
|
||||
|
||||
if validation is not None:
|
||||
if not isinstance(validation, dict) or not validation:
|
||||
raise ProgrammingError("Invalid value for 'validation'")
|
||||
|
||||
valid_options = ("level", "schema")
|
||||
for option in validation:
|
||||
if option not in valid_options:
|
||||
raise ProgrammingError("Invalid option in 'validation': {}"
|
||||
"".format(option))
|
||||
|
||||
options = []
|
||||
|
||||
if "level" in validation:
|
||||
level = validation["level"]
|
||||
if not isinstance(level, str):
|
||||
raise ProgrammingError("Invalid value for 'level'")
|
||||
options.append(("level", level))
|
||||
|
||||
if "schema" in validation:
|
||||
schema = validation["schema"]
|
||||
if not isinstance(schema, (str, dict)):
|
||||
raise ProgrammingError("Invalid value for 'schema'")
|
||||
options.append(
|
||||
("schema", json.dumps(schema)
|
||||
if isinstance(schema, dict) else schema))
|
||||
|
||||
fields["options"] = ("validation", options)
|
||||
|
||||
try:
|
||||
self._connection.execute_nonquery(
|
||||
"mysqlx", "create_collection", True, fields)
|
||||
except OperationalError as err:
|
||||
if err.errno == ER_X_CMD_NUM_ARGUMENTS:
|
||||
raise NotSupportedError(
|
||||
"Your MySQL server does not support the requested "
|
||||
"operation. Please update to MySQL 8.0.19 or a later "
|
||||
"version")
|
||||
if err.errno == ER_TABLE_EXISTS_ERROR:
|
||||
if not reuse_existing:
|
||||
raise ProgrammingError(
|
||||
"Collection '{}' already exists".format(name))
|
||||
else:
|
||||
raise ProgrammingError(err.msg, err.errno)
|
||||
|
||||
return collection
|
||||
|
||||
def modify_collection(self, name, validation=None):
|
||||
"""Modifies a collection using a JSON schema validation.
|
||||
|
||||
Args:
|
||||
name (str): The name of the collection.
|
||||
validation (Optional[dict]): A dict, containing the keys `level`
|
||||
with the validation level and `schema`
|
||||
with a dict or a string representation
|
||||
of a JSON schema specification.
|
||||
|
||||
Raises:
|
||||
:class:`mysqlx.ProgrammingError`: If the collection name or
|
||||
validation is invalid.
|
||||
:class:`mysqlx.NotSupportedError`: If schema validation is not
|
||||
supported by the server.
|
||||
|
||||
.. versionadded:: 8.0.21
|
||||
"""
|
||||
if not name:
|
||||
raise ProgrammingError("Collection name is invalid")
|
||||
|
||||
if not isinstance(validation, dict) or not validation:
|
||||
raise ProgrammingError("Invalid value for 'validation'")
|
||||
|
||||
valid_options = ("level", "schema")
|
||||
for option in validation:
|
||||
if option not in valid_options:
|
||||
raise ProgrammingError("Invalid option in 'validation': {}"
|
||||
"".format(option))
|
||||
options = []
|
||||
|
||||
if "level" in validation:
|
||||
level = validation["level"]
|
||||
if not isinstance(level, str):
|
||||
raise ProgrammingError("Invalid value for 'level'")
|
||||
options.append(("level", level))
|
||||
|
||||
if "schema" in validation:
|
||||
schema = validation["schema"]
|
||||
if not isinstance(schema, (str, dict)):
|
||||
raise ProgrammingError("Invalid value for 'schema'")
|
||||
options.append(
|
||||
("schema", json.dumps(schema)
|
||||
if isinstance(schema, dict) else schema))
|
||||
|
||||
fields = {
|
||||
"schema": self._name,
|
||||
"name": name,
|
||||
"options": ("validation", options)
|
||||
}
|
||||
|
||||
try:
|
||||
self._connection.execute_nonquery(
|
||||
"mysqlx", "modify_collection_options", True, fields)
|
||||
except OperationalError as err:
|
||||
if err.errno == ER_X_INVALID_ADMIN_COMMAND:
|
||||
raise NotSupportedError(
|
||||
"Your MySQL server does not support the requested "
|
||||
"operation. Please update to MySQL 8.0.19 or a later "
|
||||
"version")
|
||||
raise ProgrammingError(err.msg, err.errno)
|
||||
|
||||
|
||||
class Collection(DatabaseObject):
|
||||
"""Represents a collection of documents on a schema.
|
||||
|
||||
Args:
|
||||
schema (mysqlx.Schema): The Schema object.
|
||||
name (str): The collection name.
|
||||
"""
|
||||
|
||||
def exists_in_database(self):
|
||||
"""Verifies if this object exists in the database.
|
||||
|
||||
Returns:
|
||||
bool: `True` if object exists in database.
|
||||
"""
|
||||
sql = _COUNT_TABLES_QUERY.format(escape(self._schema.name),
|
||||
escape(self._name))
|
||||
return self._connection.execute_sql_scalar(sql) == 1
|
||||
|
||||
def find(self, condition=None):
|
||||
"""Retrieves documents from a collection.
|
||||
|
||||
Args:
|
||||
condition (Optional[str]): The string with the filter expression of
|
||||
the documents to be retrieved.
|
||||
"""
|
||||
stmt = FindStatement(self, condition)
|
||||
stmt.stmt_id = self._connection.get_next_statement_id()
|
||||
return stmt
|
||||
|
||||
def add(self, *values):
|
||||
"""Adds a list of documents to a collection.
|
||||
|
||||
Args:
|
||||
*values: The document list to be added into the collection.
|
||||
|
||||
Returns:
|
||||
mysqlx.AddStatement: AddStatement object.
|
||||
"""
|
||||
return AddStatement(self).add(*values)
|
||||
|
||||
def remove(self, condition):
|
||||
"""Removes documents based on the ``condition``.
|
||||
|
||||
Args:
|
||||
condition (str): The string with the filter expression of the
|
||||
documents to be removed.
|
||||
|
||||
Returns:
|
||||
mysqlx.RemoveStatement: RemoveStatement object.
|
||||
|
||||
.. versionchanged:: 8.0.12
|
||||
The ``condition`` parameter is now mandatory.
|
||||
"""
|
||||
stmt = RemoveStatement(self, condition)
|
||||
stmt.stmt_id = self._connection.get_next_statement_id()
|
||||
return stmt
|
||||
|
||||
def modify(self, condition):
|
||||
"""Modifies documents based on the ``condition``.
|
||||
|
||||
Args:
|
||||
condition (str): The string with the filter expression of the
|
||||
documents to be modified.
|
||||
|
||||
Returns:
|
||||
mysqlx.ModifyStatement: ModifyStatement object.
|
||||
|
||||
.. versionchanged:: 8.0.12
|
||||
The ``condition`` parameter is now mandatory.
|
||||
"""
|
||||
stmt = ModifyStatement(self, condition)
|
||||
stmt.stmt_id = self._connection.get_next_statement_id()
|
||||
return stmt
|
||||
|
||||
def count(self):
|
||||
"""Counts the documents in the collection.
|
||||
|
||||
Returns:
|
||||
int: The total of documents in the collection.
|
||||
"""
|
||||
sql = _COUNT_QUERY.format(quote_identifier(self._schema.name),
|
||||
quote_identifier(self._name))
|
||||
try:
|
||||
res = self._connection.execute_sql_scalar(sql)
|
||||
except OperationalError as err:
|
||||
if err.errno == ER_NO_SUCH_TABLE:
|
||||
raise OperationalError(
|
||||
"Collection '{}' does not exist in schema '{}'"
|
||||
"".format(self._name, self._schema.name))
|
||||
raise
|
||||
return res
|
||||
|
||||
def create_index(self, index_name, fields_desc):
|
||||
"""Creates a collection index.
|
||||
|
||||
Args:
|
||||
index_name (str): Index name.
|
||||
fields_desc (dict): A dictionary containing the fields members that
|
||||
constraints the index to be created. It must
|
||||
have the form as shown in the following::
|
||||
|
||||
{"fields": [{"field": member_path,
|
||||
"type": member_type,
|
||||
"required": member_required,
|
||||
"array": array,
|
||||
"collation": collation,
|
||||
"options": options,
|
||||
"srid": srid},
|
||||
# {... more members,
|
||||
# repeated as many times
|
||||
# as needed}
|
||||
],
|
||||
"type": type}
|
||||
"""
|
||||
return CreateCollectionIndexStatement(self, index_name, fields_desc)
|
||||
|
||||
def drop_index(self, index_name):
|
||||
"""Drops a collection index.
|
||||
|
||||
Args:
|
||||
index_name (str): Index name.
|
||||
"""
|
||||
self._connection.execute_nonquery("mysqlx", "drop_collection_index",
|
||||
False, {"schema": self._schema.name,
|
||||
"collection": self._name,
|
||||
"name": index_name})
|
||||
|
||||
def replace_one(self, doc_id, doc):
|
||||
"""Replaces the Document matching the document ID with a new document
|
||||
provided.
|
||||
|
||||
Args:
|
||||
doc_id (str): Document ID
|
||||
doc (:class:`mysqlx.DbDoc` or `dict`): New Document
|
||||
"""
|
||||
if "_id" in doc and doc["_id"] != doc_id:
|
||||
raise ProgrammingError(
|
||||
"Replacement document has an _id that is different than the "
|
||||
"matched document"
|
||||
)
|
||||
return self.modify("_id = :id").set("$", doc) \
|
||||
.bind("id", doc_id).execute()
|
||||
|
||||
def add_or_replace_one(self, doc_id, doc):
|
||||
"""Upserts the Document matching the document ID with a new document
|
||||
provided.
|
||||
|
||||
Args:
|
||||
doc_id (str): Document ID
|
||||
doc (:class:`mysqlx.DbDoc` or dict): New Document
|
||||
"""
|
||||
if "_id" in doc and doc["_id"] != doc_id:
|
||||
raise ProgrammingError(
|
||||
"Replacement document has an _id that is different than the "
|
||||
"matched document"
|
||||
)
|
||||
if not isinstance(doc, DbDoc):
|
||||
doc = DbDoc(doc)
|
||||
return self.add(doc.copy(doc_id)).upsert(True).execute()
|
||||
|
||||
def get_one(self, doc_id):
|
||||
"""Returns a Document matching the Document ID.
|
||||
|
||||
Args:
|
||||
doc_id (str): Document ID
|
||||
|
||||
Returns:
|
||||
mysqlx.DbDoc: The Document matching the Document ID.
|
||||
"""
|
||||
result = self.find("_id = :id").bind("id", doc_id).execute()
|
||||
doc = result.fetch_one()
|
||||
self._connection.fetch_active_result()
|
||||
return doc
|
||||
|
||||
def remove_one(self, doc_id):
|
||||
"""Removes a Document matching the Document ID.
|
||||
|
||||
Args:
|
||||
doc_id (str): Document ID
|
||||
|
||||
Returns:
|
||||
mysqlx.Result: Result object.
|
||||
"""
|
||||
return self.remove("_id = :id").bind("id", doc_id).execute()
|
||||
|
||||
|
||||
class Table(DatabaseObject):
|
||||
"""Represents a database table on a schema.
|
||||
|
||||
Provides access to the table through standard INSERT/SELECT/UPDATE/DELETE
|
||||
statements.
|
||||
|
||||
Args:
|
||||
schema (mysqlx.Schema): The Schema object.
|
||||
name (str): The table name.
|
||||
"""
|
||||
|
||||
def exists_in_database(self):
|
||||
"""Verifies if this object exists in the database.
|
||||
|
||||
Returns:
|
||||
bool: `True` if object exists in database.
|
||||
"""
|
||||
sql = _COUNT_TABLES_QUERY.format(escape(self._schema.name),
|
||||
escape(self._name))
|
||||
return self._connection.execute_sql_scalar(sql) == 1
|
||||
|
||||
def select(self, *fields):
|
||||
"""Creates a new :class:`mysqlx.SelectStatement` object.
|
||||
|
||||
Args:
|
||||
*fields: The fields to be retrieved.
|
||||
|
||||
Returns:
|
||||
mysqlx.SelectStatement: SelectStatement object
|
||||
"""
|
||||
stmt = SelectStatement(self, *fields)
|
||||
stmt.stmt_id = self._connection.get_next_statement_id()
|
||||
return stmt
|
||||
|
||||
def insert(self, *fields):
|
||||
"""Creates a new :class:`mysqlx.InsertStatement` object.
|
||||
|
||||
Args:
|
||||
*fields: The fields to be inserted.
|
||||
|
||||
Returns:
|
||||
mysqlx.InsertStatement: InsertStatement object
|
||||
"""
|
||||
stmt = InsertStatement(self, *fields)
|
||||
stmt.stmt_id = self._connection.get_next_statement_id()
|
||||
return stmt
|
||||
|
||||
def update(self):
|
||||
"""Creates a new :class:`mysqlx.UpdateStatement` object.
|
||||
|
||||
Returns:
|
||||
mysqlx.UpdateStatement: UpdateStatement object
|
||||
"""
|
||||
stmt = UpdateStatement(self)
|
||||
stmt.stmt_id = self._connection.get_next_statement_id()
|
||||
return stmt
|
||||
|
||||
def delete(self):
|
||||
"""Creates a new :class:`mysqlx.DeleteStatement` object.
|
||||
|
||||
Returns:
|
||||
mysqlx.DeleteStatement: DeleteStatement object
|
||||
|
||||
.. versionchanged:: 8.0.12
|
||||
The ``condition`` parameter was removed.
|
||||
"""
|
||||
stmt = DeleteStatement(self)
|
||||
stmt.stmt_id = self._connection.get_next_statement_id()
|
||||
return stmt
|
||||
|
||||
def count(self):
|
||||
"""Counts the rows in the table.
|
||||
|
||||
Returns:
|
||||
int: The total of rows in the table.
|
||||
"""
|
||||
sql = _COUNT_QUERY.format(quote_identifier(self._schema.name),
|
||||
quote_identifier(self._name))
|
||||
try:
|
||||
res = self._connection.execute_sql_scalar(sql)
|
||||
except OperationalError as err:
|
||||
if err.errno == ER_NO_SUCH_TABLE:
|
||||
raise OperationalError(
|
||||
"Table '{}' does not exist in schema '{}'"
|
||||
"".format(self._name, self._schema.name))
|
||||
raise
|
||||
return res
|
||||
|
||||
def is_view(self):
|
||||
"""Determine if the underlying object is a view or not.
|
||||
|
||||
Returns:
|
||||
bool: `True` if the underlying object is a view.
|
||||
"""
|
||||
sql = _COUNT_VIEWS_QUERY.format(escape(self._schema.name),
|
||||
escape(self._name))
|
||||
return self._connection.execute_sql_scalar(sql) == 1
|
||||
|
||||
|
||||
class View(Table):
|
||||
"""Represents a database view on a schema.
|
||||
|
||||
Provides a mechanism for creating, alter and drop views.
|
||||
|
||||
Args:
|
||||
schema (mysqlx.Schema): The Schema object.
|
||||
name (str): The table name.
|
||||
"""
|
||||
|
||||
def exists_in_database(self):
|
||||
"""Verifies if this object exists in the database.
|
||||
|
||||
Returns:
|
||||
bool: `True` if object exists in database.
|
||||
"""
|
||||
sql = _COUNT_VIEWS_QUERY.format(escape(self._schema.name),
|
||||
escape(self._name))
|
||||
return self._connection.execute_sql_scalar(sql) == 1
|
||||
@@ -0,0 +1,114 @@
|
||||
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
"""Implementation of the DbDoc."""
|
||||
|
||||
import json
|
||||
|
||||
from .errors import ProgrammingError
|
||||
|
||||
|
||||
class ExprJSONEncoder(json.JSONEncoder):
|
||||
"""A :class:`json.JSONEncoder` subclass, which enables encoding of
|
||||
:class:`mysqlx.ExprParser` objects."""
|
||||
def default(self, o): # pylint: disable=E0202
|
||||
if hasattr(o, "expr"):
|
||||
return "{0}".format(o)
|
||||
# Let the base class default method raise the TypeError
|
||||
return json.JSONEncoder.default(self, o)
|
||||
|
||||
|
||||
class DbDoc(object):
|
||||
"""Represents a generic document in JSON format.
|
||||
|
||||
Args:
|
||||
value (object): The value can be a JSON string or a dict.
|
||||
|
||||
Raises:
|
||||
ValueError: If ``value`` type is not a basestring or dict.
|
||||
"""
|
||||
def __init__(self, value):
|
||||
if isinstance(value, dict):
|
||||
self.__dict__ = value
|
||||
elif isinstance(value, str):
|
||||
self.__dict__ = json.loads(value)
|
||||
else:
|
||||
raise ValueError("Unable to handle type: {0}".format(type(value)))
|
||||
|
||||
def __str__(self):
|
||||
return self.as_str()
|
||||
|
||||
def __repr__(self):
|
||||
return repr(self.__dict__)
|
||||
|
||||
def __setitem__(self, index, value):
|
||||
if index == "_id":
|
||||
raise ProgrammingError("Cannot modify _id")
|
||||
self.__dict__[index] = value
|
||||
|
||||
def __getitem__(self, index):
|
||||
return self.__dict__[index]
|
||||
|
||||
def __contains__(self, item):
|
||||
return item in self.__dict__
|
||||
|
||||
def copy(self, doc_id=None):
|
||||
"""Returns a new copy of a :class:`mysqlx.DbDoc` object containing the
|
||||
`doc_id` provided. If `doc_id` is not provided, it will be removed from
|
||||
new :class:`mysqlx.DbDoc` object.
|
||||
|
||||
Args:
|
||||
doc_id (Optional[str]): Document ID
|
||||
|
||||
Returns:
|
||||
mysqlx.DbDoc: A new instance of DbDoc containing the _id provided
|
||||
"""
|
||||
new_dict = self.__dict__.copy()
|
||||
if doc_id:
|
||||
new_dict["_id"] = doc_id
|
||||
elif "_id" in new_dict:
|
||||
del new_dict["_id"]
|
||||
return DbDoc(new_dict)
|
||||
|
||||
def keys(self):
|
||||
"""Returns the keys.
|
||||
|
||||
Returns:
|
||||
`list`: The keys.
|
||||
"""
|
||||
return self.__dict__.keys()
|
||||
|
||||
def as_str(self):
|
||||
"""Serialize :class:`mysqlx.DbDoc` to a JSON formatted ``str``.
|
||||
|
||||
Returns:
|
||||
str: A JSON formatted ``str`` representation of the document.
|
||||
|
||||
.. versionadded:: 8.0.16
|
||||
"""
|
||||
return json.dumps(self.__dict__, cls=ExprJSONEncoder)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,269 @@
|
||||
# Copyright (c) 2016, 2020, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
"""Implementation of the Python Database API Specification v2.0 exceptions."""
|
||||
|
||||
from struct import unpack as struct_unpack
|
||||
|
||||
from .locales import get_client_error
|
||||
|
||||
|
||||
class Error(Exception):
|
||||
"""Exception that is base class for all other error exceptions."""
|
||||
def __init__(self, msg=None, errno=None, values=None, sqlstate=None):
|
||||
super(Error, self).__init__()
|
||||
self.msg = msg
|
||||
self._full_msg = self.msg
|
||||
self.errno = errno or -1
|
||||
self.sqlstate = sqlstate
|
||||
|
||||
if not self.msg and (2000 <= self.errno < 3000):
|
||||
self.msg = get_client_error(self.errno)
|
||||
if values is not None:
|
||||
try:
|
||||
self.msg = self.msg % values
|
||||
except TypeError as err:
|
||||
self.msg = "{0} (Warning: {1})".format(self.msg, str(err))
|
||||
elif not self.msg:
|
||||
self._full_msg = self.msg = "Unknown error"
|
||||
|
||||
if self.msg and self.errno != -1:
|
||||
fields = {
|
||||
"errno": self.errno,
|
||||
"msg": self.msg
|
||||
}
|
||||
if self.sqlstate:
|
||||
fmt = "{errno} ({state}): {msg}"
|
||||
fields["state"] = self.sqlstate
|
||||
else:
|
||||
fmt = "{errno}: {msg}"
|
||||
self._full_msg = fmt.format(**fields)
|
||||
|
||||
self.args = (self.errno, self._full_msg, self.sqlstate)
|
||||
|
||||
def __str__(self):
|
||||
return self._full_msg
|
||||
|
||||
|
||||
class InterfaceError(Error):
|
||||
"""Exception for errors related to the interface."""
|
||||
pass
|
||||
|
||||
|
||||
class DatabaseError(Error):
|
||||
"""Exception for errors related to the database."""
|
||||
pass
|
||||
|
||||
|
||||
class InternalError(DatabaseError):
|
||||
"""Exception for errors internal database errors."""
|
||||
pass
|
||||
|
||||
|
||||
class OperationalError(DatabaseError):
|
||||
"""Exception for errors related to the database's operation."""
|
||||
pass
|
||||
|
||||
|
||||
class ProgrammingError(DatabaseError):
|
||||
"""Exception for errors programming errors."""
|
||||
pass
|
||||
|
||||
|
||||
class IntegrityError(DatabaseError):
|
||||
"""Exception for errors regarding relational integrity."""
|
||||
pass
|
||||
|
||||
|
||||
class DataError(DatabaseError):
|
||||
"""Exception for errors reporting problems with processed data."""
|
||||
pass
|
||||
|
||||
|
||||
class NotSupportedError(DatabaseError):
|
||||
"""Exception for errors when an unsupported database feature was used."""
|
||||
pass
|
||||
|
||||
|
||||
class PoolError(Error):
|
||||
"""Exception for errors relating to connection pooling."""
|
||||
pass
|
||||
|
||||
# pylint: disable=W0622
|
||||
class TimeoutError(Error):
|
||||
"""Exception for errors relating to connection timeout."""
|
||||
pass
|
||||
|
||||
|
||||
def intread(buf):
|
||||
"""Unpacks the given buffer to an integer."""
|
||||
try:
|
||||
if isinstance(buf, int):
|
||||
return buf
|
||||
length = len(buf)
|
||||
if length == 1:
|
||||
return buf[0]
|
||||
elif length <= 4:
|
||||
tmp = buf + b"\x00" * (4 - length)
|
||||
return struct_unpack("<I", tmp)[0]
|
||||
tmp = buf + b"\x00" * (8 - length)
|
||||
return struct_unpack("<Q", tmp)[0]
|
||||
except:
|
||||
raise
|
||||
|
||||
|
||||
def read_int(buf, size):
|
||||
"""Read an integer from buffer.
|
||||
|
||||
Returns a tuple (truncated buffer, int).
|
||||
"""
|
||||
|
||||
try:
|
||||
res = intread(buf[0:size])
|
||||
except:
|
||||
raise
|
||||
|
||||
return (buf[size:], res)
|
||||
|
||||
|
||||
def read_bytes(buf, size):
|
||||
"""Reads bytes from a buffer.
|
||||
|
||||
Returns a tuple with buffer less the read bytes, and the bytes.
|
||||
"""
|
||||
res = buf[0:size]
|
||||
return (buf[size:], res)
|
||||
|
||||
|
||||
def get_mysql_exception(errno, msg=None, sqlstate=None):
|
||||
"""Get the exception matching the MySQL error.
|
||||
|
||||
This function will return an exception based on the SQLState. The given
|
||||
message will be passed on in the returned exception.
|
||||
|
||||
Returns an Exception.
|
||||
"""
|
||||
try:
|
||||
return _ERROR_EXCEPTIONS[errno](msg=msg, errno=errno,
|
||||
sqlstate=sqlstate)
|
||||
except KeyError:
|
||||
# Error was not mapped to particular exception
|
||||
pass
|
||||
|
||||
if not sqlstate:
|
||||
return DatabaseError(msg=msg, errno=errno)
|
||||
|
||||
try:
|
||||
return _SQLSTATE_CLASS_EXCEPTION[sqlstate[0:2]](msg=msg, errno=errno,
|
||||
sqlstate=sqlstate)
|
||||
except KeyError:
|
||||
# Return default InterfaceError
|
||||
return DatabaseError(msg=msg, errno=errno, sqlstate=sqlstate)
|
||||
|
||||
|
||||
def get_exception(packet):
|
||||
"""Returns an exception object based on the MySQL error.
|
||||
|
||||
Returns an exception object based on the MySQL error in the given
|
||||
packet.
|
||||
|
||||
Returns an Error-Object.
|
||||
"""
|
||||
errno = errmsg = None
|
||||
|
||||
try:
|
||||
if packet[4] != 255:
|
||||
raise ValueError("Packet is not an error packet")
|
||||
except IndexError as err:
|
||||
return InterfaceError("Failed getting Error information ({0})"
|
||||
"".format(err))
|
||||
|
||||
sqlstate = None
|
||||
try:
|
||||
packet = packet[5:]
|
||||
packet, errno = read_int(packet, 2)
|
||||
if packet[0] != 35:
|
||||
# Error without SQLState
|
||||
if isinstance(packet, (bytes, bytearray)):
|
||||
errmsg = packet.decode("utf8")
|
||||
else:
|
||||
errmsg = packet
|
||||
else:
|
||||
packet, sqlstate = read_bytes(packet[1:], 5)
|
||||
sqlstate = sqlstate.decode("utf8")
|
||||
errmsg = packet.decode("utf8")
|
||||
except Exception as err: # pylint: disable=W0703
|
||||
return InterfaceError("Failed getting Error information ({0})"
|
||||
"".format(err))
|
||||
else:
|
||||
return get_mysql_exception(errno, errmsg, sqlstate)
|
||||
|
||||
|
||||
_SQLSTATE_CLASS_EXCEPTION = {
|
||||
"02": DataError, # no data
|
||||
"07": DatabaseError, # dynamic SQL error
|
||||
"08": OperationalError, # connection exception
|
||||
"0A": NotSupportedError, # feature not supported
|
||||
"21": DataError, # cardinality violation
|
||||
"22": DataError, # data exception
|
||||
"23": IntegrityError, # integrity constraint violation
|
||||
"24": ProgrammingError, # invalid cursor state
|
||||
"25": ProgrammingError, # invalid transaction state
|
||||
"26": ProgrammingError, # invalid SQL statement name
|
||||
"27": ProgrammingError, # triggered data change violation
|
||||
"28": ProgrammingError, # invalid authorization specification
|
||||
"2A": ProgrammingError, # direct SQL syntax error or access rule violation
|
||||
"2B": DatabaseError, # dependent privilege descriptors still exist
|
||||
"2C": ProgrammingError, # invalid character set name
|
||||
"2D": DatabaseError, # invalid transaction termination
|
||||
"2E": DatabaseError, # invalid connection name
|
||||
"33": DatabaseError, # invalid SQL descriptor name
|
||||
"34": ProgrammingError, # invalid cursor name
|
||||
"35": ProgrammingError, # invalid condition number
|
||||
"37": ProgrammingError, # dynamic SQL syntax error or access rule violation
|
||||
"3C": ProgrammingError, # ambiguous cursor name
|
||||
"3D": ProgrammingError, # invalid catalog name
|
||||
"3F": ProgrammingError, # invalid schema name
|
||||
"40": InternalError, # transaction rollback
|
||||
"42": ProgrammingError, # syntax error or access rule violation
|
||||
"44": InternalError, # with check option violation
|
||||
"HZ": OperationalError, # remote database access
|
||||
"XA": IntegrityError,
|
||||
"0K": OperationalError,
|
||||
"HY": DatabaseError, # default when no SQLState provided by MySQL server
|
||||
}
|
||||
|
||||
_ERROR_EXCEPTIONS = {
|
||||
1243: ProgrammingError,
|
||||
1210: ProgrammingError,
|
||||
2002: InterfaceError,
|
||||
2013: OperationalError,
|
||||
2049: NotSupportedError,
|
||||
2055: OperationalError,
|
||||
2061: InterfaceError,
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,213 @@
|
||||
# Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
"""This module contains helper functions."""
|
||||
|
||||
import binascii
|
||||
import decimal
|
||||
import functools
|
||||
import inspect
|
||||
import warnings
|
||||
|
||||
from .constants import TLS_CIPHER_SUITES, TLS_VERSIONS
|
||||
from .errors import InterfaceError
|
||||
|
||||
|
||||
BYTE_TYPES = (bytearray, bytes,)
|
||||
NUMERIC_TYPES = (int, float, decimal.Decimal,)
|
||||
|
||||
|
||||
def encode_to_bytes(value, encoding="utf-8"):
|
||||
"""Returns an encoded version of the string as a bytes object.
|
||||
|
||||
Args:
|
||||
encoding (str): The encoding.
|
||||
|
||||
Resturns:
|
||||
bytes: The encoded version of the string as a bytes object.
|
||||
"""
|
||||
return value if isinstance(value, bytes) else value.encode(encoding)
|
||||
|
||||
|
||||
def decode_from_bytes(value, encoding="utf-8"):
|
||||
"""Returns a string decoded from the given bytes.
|
||||
|
||||
Args:
|
||||
value (bytes): The value to be decoded.
|
||||
encoding (str): The encoding.
|
||||
|
||||
Returns:
|
||||
str: The value decoded from bytes.
|
||||
"""
|
||||
return value.decode(encoding) if isinstance(value, bytes) else value
|
||||
|
||||
|
||||
def get_item_or_attr(obj, key):
|
||||
"""Get item from dictionary or attribute from object.
|
||||
|
||||
Args:
|
||||
obj (object): Dictionary or object.
|
||||
key (str): Key.
|
||||
|
||||
Returns:
|
||||
object: The object for the provided key.
|
||||
"""
|
||||
return obj[key] if isinstance(obj, dict) else getattr(obj, key)
|
||||
|
||||
|
||||
def escape(*args):
|
||||
"""Escapes special characters as they are expected to be when MySQL
|
||||
receives them.
|
||||
As found in MySQL source mysys/charset.c
|
||||
|
||||
Args:
|
||||
value (object): Value to be escaped.
|
||||
|
||||
Returns:
|
||||
str: The value if not a string, or the escaped string.
|
||||
"""
|
||||
def _escape(value):
|
||||
"""Escapes special characters."""
|
||||
if value is None:
|
||||
return value
|
||||
elif isinstance(value, NUMERIC_TYPES):
|
||||
return value
|
||||
if isinstance(value, (bytes, bytearray)):
|
||||
value = value.replace(b'\\', b'\\\\')
|
||||
value = value.replace(b'\n', b'\\n')
|
||||
value = value.replace(b'\r', b'\\r')
|
||||
value = value.replace(b'\047', b'\134\047') # single quotes
|
||||
value = value.replace(b'\042', b'\134\042') # double quotes
|
||||
value = value.replace(b'\032', b'\134\032') # for Win32
|
||||
else:
|
||||
value = value.replace('\\', '\\\\')
|
||||
value = value.replace('\n', '\\n')
|
||||
value = value.replace('\r', '\\r')
|
||||
value = value.replace('\047', '\134\047') # single quotes
|
||||
value = value.replace('\042', '\134\042') # double quotes
|
||||
value = value.replace('\032', '\134\032') # for Win32
|
||||
return value
|
||||
if len(args) > 1:
|
||||
return [_escape(arg) for arg in args]
|
||||
return _escape(args[0])
|
||||
|
||||
|
||||
def quote_identifier(identifier, sql_mode=""):
|
||||
"""Quote the given identifier with backticks, converting backticks (`)
|
||||
in the identifier name with the correct escape sequence (``) unless the
|
||||
identifier is quoted (") as in sql_mode set to ANSI_QUOTES.
|
||||
|
||||
Args:
|
||||
identifier (str): Identifier to quote.
|
||||
|
||||
Returns:
|
||||
str: Returns string with the identifier quoted with backticks.
|
||||
"""
|
||||
if sql_mode == "ANSI_QUOTES":
|
||||
return '"{0}"'.format(identifier.replace('"', '""'))
|
||||
return "`{0}`".format(identifier.replace("`", "``"))
|
||||
|
||||
|
||||
def deprecated(version=None, reason=None):
|
||||
"""This is a decorator used to mark functions as deprecated.
|
||||
|
||||
Args:
|
||||
version (Optional[string]): Version when was deprecated.
|
||||
reason (Optional[string]): Reason or extra information to be shown.
|
||||
|
||||
Usage:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from mysqlx.helpers import deprecated
|
||||
|
||||
@deprecated('8.0.12', 'Please use other_function() instead')
|
||||
def deprecated_function(x, y):
|
||||
return x + y
|
||||
"""
|
||||
def decorate(func):
|
||||
"""Decorate function."""
|
||||
@functools.wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
"""Wrapper function.
|
||||
|
||||
Args:
|
||||
*args: Variable length argument list.
|
||||
**kwargs: Arbitrary keyword arguments.
|
||||
"""
|
||||
message = ["'{}' is deprecated".format(func.__name__)]
|
||||
if version:
|
||||
message.append(" since version {}".format(version))
|
||||
if reason:
|
||||
message.append(". {}".format(reason))
|
||||
frame = inspect.currentframe().f_back
|
||||
warnings.warn_explicit("".join(message),
|
||||
category=DeprecationWarning,
|
||||
filename=inspect.getfile(frame.f_code),
|
||||
lineno=frame.f_lineno)
|
||||
return func(*args, **kwargs)
|
||||
return wrapper
|
||||
return decorate
|
||||
|
||||
|
||||
def iani_to_openssl_cs_name(tls_version, cipher_suites_names):
|
||||
"""Translates a cipher suites names list; from IANI names to OpenSSL names.
|
||||
|
||||
Args:
|
||||
TLS_version (str): The TLS version to look at for a translation.
|
||||
cipher_suite_names (list): A list of cipher suites names.
|
||||
"""
|
||||
translated_names = []
|
||||
|
||||
cipher_suites = {}#TLS_CIPHER_SUITES[TLS_version]
|
||||
|
||||
# Find the previews TLS versions of the given on TLS_version
|
||||
for index in range(TLS_VERSIONS.index(tls_version) + 1):
|
||||
cipher_suites.update(TLS_CIPHER_SUITES[TLS_VERSIONS[index]])
|
||||
|
||||
for name in cipher_suites_names:
|
||||
if "-" in name:
|
||||
translated_names.append(name)
|
||||
elif name in cipher_suites:
|
||||
translated_names.append(cipher_suites[name])
|
||||
else:
|
||||
raise InterfaceError("The '{}' in cipher suites is not a valid "
|
||||
"cipher suite".format(name))
|
||||
return translated_names
|
||||
|
||||
|
||||
def hexlify(data):
|
||||
"""Return the hexadecimal representation of the binary data.
|
||||
|
||||
Args:
|
||||
data (str): The binary data.
|
||||
|
||||
Returns:
|
||||
bytes: The hexadecimal representation of data.
|
||||
"""
|
||||
return binascii.hexlify(data).decode("utf-8")
|
||||
@@ -0,0 +1,73 @@
|
||||
# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
"""Translations"""
|
||||
|
||||
__all__ = ["get_client_error"]
|
||||
|
||||
from .. import errorcode
|
||||
|
||||
|
||||
def get_client_error(error, language="eng"):
|
||||
"""Lookup client error
|
||||
|
||||
This function will lookup the client error message based on the given
|
||||
error and return the error message. If the error was not found,
|
||||
None will be returned.
|
||||
|
||||
Error can be either an integer or a string. For example:
|
||||
error: 2000
|
||||
error: CR_UNKNOWN_ERROR
|
||||
|
||||
The language attribute can be used to retrieve a localized message, when
|
||||
available.
|
||||
|
||||
Returns a string or None.
|
||||
"""
|
||||
try:
|
||||
tmp = __import__("mysqlx.locales.{0}".format(language),
|
||||
globals(), locals(), ["client_error"])
|
||||
except ImportError:
|
||||
raise ImportError("No localization support for language '{0}'"
|
||||
"".format(language))
|
||||
client_error = tmp.client_error
|
||||
|
||||
if isinstance(error, int):
|
||||
errno = error
|
||||
for key, value in errorcode.__dict__.items():
|
||||
if value == errno:
|
||||
error = key
|
||||
break
|
||||
|
||||
if isinstance(error, (str)):
|
||||
try:
|
||||
return getattr(client_error, error)
|
||||
except AttributeError:
|
||||
return None
|
||||
|
||||
raise ValueError("Error argument needs to be either an integer or string")
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,110 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# This file was auto-generated.
|
||||
_GENERATED_ON = '2021-08-11'
|
||||
_MYSQL_VERSION = (8, 0, 27)
|
||||
|
||||
# Start MySQL Error messages
|
||||
CR_UNKNOWN_ERROR = u"Unknown MySQL error"
|
||||
CR_SOCKET_CREATE_ERROR = u"Can't create UNIX socket (%s)"
|
||||
CR_CONNECTION_ERROR = u"Can't connect to local MySQL server through socket '%-.100s' (%s)"
|
||||
CR_CONN_HOST_ERROR = u"Can't connect to MySQL server on '%-.100s:%u' (%s)"
|
||||
CR_IPSOCK_ERROR = u"Can't create TCP/IP socket (%s)"
|
||||
CR_UNKNOWN_HOST = u"Unknown MySQL server host '%-.100s' (%s)"
|
||||
CR_SERVER_GONE_ERROR = u"MySQL server has gone away"
|
||||
CR_VERSION_ERROR = u"Protocol mismatch; server version = %s, client version = %s"
|
||||
CR_OUT_OF_MEMORY = u"MySQL client ran out of memory"
|
||||
CR_WRONG_HOST_INFO = u"Wrong host info"
|
||||
CR_LOCALHOST_CONNECTION = u"Localhost via UNIX socket"
|
||||
CR_TCP_CONNECTION = u"%-.100s via TCP/IP"
|
||||
CR_SERVER_HANDSHAKE_ERR = u"Error in server handshake"
|
||||
CR_SERVER_LOST = u"Lost connection to MySQL server during query"
|
||||
CR_COMMANDS_OUT_OF_SYNC = u"Commands out of sync; you can't run this command now"
|
||||
CR_NAMEDPIPE_CONNECTION = u"Named pipe: %-.32s"
|
||||
CR_NAMEDPIPEWAIT_ERROR = u"Can't wait for named pipe to host: %-.64s pipe: %-.32s (%s)"
|
||||
CR_NAMEDPIPEOPEN_ERROR = u"Can't open named pipe to host: %-.64s pipe: %-.32s (%s)"
|
||||
CR_NAMEDPIPESETSTATE_ERROR = u"Can't set state of named pipe to host: %-.64s pipe: %-.32s (%s)"
|
||||
CR_CANT_READ_CHARSET = u"Can't initialize character set %-.32s (path: %-.100s)"
|
||||
CR_NET_PACKET_TOO_LARGE = u"Got packet bigger than 'max_allowed_packet' bytes"
|
||||
CR_EMBEDDED_CONNECTION = u"Embedded server"
|
||||
CR_PROBE_SLAVE_STATUS = u"Error on SHOW SLAVE STATUS:"
|
||||
CR_PROBE_SLAVE_HOSTS = u"Error on SHOW SLAVE HOSTS:"
|
||||
CR_PROBE_SLAVE_CONNECT = u"Error connecting to slave:"
|
||||
CR_PROBE_MASTER_CONNECT = u"Error connecting to master:"
|
||||
CR_SSL_CONNECTION_ERROR = u"SSL connection error: %-.100s"
|
||||
CR_MALFORMED_PACKET = u"Malformed packet"
|
||||
CR_WRONG_LICENSE = u"This client library is licensed only for use with MySQL servers having '%s' license"
|
||||
CR_NULL_POINTER = u"Invalid use of null pointer"
|
||||
CR_NO_PREPARE_STMT = u"Statement not prepared"
|
||||
CR_PARAMS_NOT_BOUND = u"No data supplied for parameters in prepared statement"
|
||||
CR_DATA_TRUNCATED = u"Data truncated"
|
||||
CR_NO_PARAMETERS_EXISTS = u"No parameters exist in the statement"
|
||||
CR_INVALID_PARAMETER_NO = u"Invalid parameter number"
|
||||
CR_INVALID_BUFFER_USE = u"Can't send long data for non-string/non-binary data types (parameter: %s)"
|
||||
CR_UNSUPPORTED_PARAM_TYPE = u"Using unsupported buffer type: %s (parameter: %s)"
|
||||
CR_SHARED_MEMORY_CONNECTION = u"Shared memory: %-.100s"
|
||||
CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR = u"Can't open shared memory; client could not create request event (%s)"
|
||||
CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR = u"Can't open shared memory; no answer event received from server (%s)"
|
||||
CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR = u"Can't open shared memory; server could not allocate file mapping (%s)"
|
||||
CR_SHARED_MEMORY_CONNECT_MAP_ERROR = u"Can't open shared memory; server could not get pointer to file mapping (%s)"
|
||||
CR_SHARED_MEMORY_FILE_MAP_ERROR = u"Can't open shared memory; client could not allocate file mapping (%s)"
|
||||
CR_SHARED_MEMORY_MAP_ERROR = u"Can't open shared memory; client could not get pointer to file mapping (%s)"
|
||||
CR_SHARED_MEMORY_EVENT_ERROR = u"Can't open shared memory; client could not create %s event (%s)"
|
||||
CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR = u"Can't open shared memory; no answer from server (%s)"
|
||||
CR_SHARED_MEMORY_CONNECT_SET_ERROR = u"Can't open shared memory; cannot send request event to server (%s)"
|
||||
CR_CONN_UNKNOW_PROTOCOL = u"Wrong or unknown protocol"
|
||||
CR_INVALID_CONN_HANDLE = u"Invalid connection handle"
|
||||
CR_UNUSED_1 = u"Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)"
|
||||
CR_FETCH_CANCELED = u"Row retrieval was canceled by mysql_stmt_close() call"
|
||||
CR_NO_DATA = u"Attempt to read column without prior row fetch"
|
||||
CR_NO_STMT_METADATA = u"Prepared statement contains no metadata"
|
||||
CR_NO_RESULT_SET = u"Attempt to read a row while there is no result set associated with the statement"
|
||||
CR_NOT_IMPLEMENTED = u"This feature is not implemented yet"
|
||||
CR_SERVER_LOST_EXTENDED = u"Lost connection to MySQL server at '%s', system error: %s"
|
||||
CR_STMT_CLOSED = u"Statement closed indirectly because of a preceding %s() call"
|
||||
CR_NEW_STMT_METADATA = u"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"
|
||||
CR_ALREADY_CONNECTED = u"This handle is already connected. Use a separate handle for each connection."
|
||||
CR_AUTH_PLUGIN_CANNOT_LOAD = u"Authentication plugin '%s' cannot be loaded: %s"
|
||||
CR_DUPLICATE_CONNECTION_ATTR = u"There is an attribute with the same name already"
|
||||
CR_AUTH_PLUGIN_ERR = u"Authentication plugin '%s' reported error: %s"
|
||||
CR_INSECURE_API_ERR = u"Insecure API function call: '%s' Use instead: '%s'"
|
||||
CR_FILE_NAME_TOO_LONG = u"File name is too long"
|
||||
CR_SSL_FIPS_MODE_ERR = u"Set FIPS mode ON/STRICT failed"
|
||||
CR_DEPRECATED_COMPRESSION_NOT_SUPPORTED = u"Compression protocol not supported with asynchronous protocol"
|
||||
CR_COMPRESSION_WRONGLY_CONFIGURED = u"Connection failed due to wrongly configured compression algorithm"
|
||||
CR_KERBEROS_USER_NOT_FOUND = u"SSO user not found, Please perform SSO authentication using kerberos."
|
||||
CR_LOAD_DATA_LOCAL_INFILE_REJECTED = u"LOAD DATA LOCAL INFILE file request rejected due to restrictions on access."
|
||||
CR_LOAD_DATA_LOCAL_INFILE_REALPATH_FAIL = u"Determining the real path for '%s' failed with error (%s): %s"
|
||||
CR_DNS_SRV_LOOKUP_FAILED = u"DNS SRV lookup failed with error : %s"
|
||||
CR_MANDATORY_TRACKER_NOT_FOUND = u"Client does not recognise tracker type %s marked as mandatory by server."
|
||||
CR_INVALID_FACTOR_NO = u"Invalid first argument for MYSQL_OPT_USER_PASSWORD option. Valid value should be between 1 and 3 inclusive."
|
||||
# End MySQL Error messages
|
||||
|
||||
@@ -0,0 +1,480 @@
|
||||
# Copyright (c) 2017, 2020, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
"""This module contains the implementation of a helper class for MySQL X
|
||||
Protobuf messages."""
|
||||
|
||||
try:
|
||||
ModuleNotFoundError
|
||||
except NameError:
|
||||
ModuleNotFoundError = ImportError
|
||||
|
||||
_SERVER_MESSAGES_TUPLES = (
|
||||
("Mysqlx.ServerMessages.Type.OK",
|
||||
"Mysqlx.Ok"),
|
||||
("Mysqlx.ServerMessages.Type.ERROR",
|
||||
"Mysqlx.Error"),
|
||||
("Mysqlx.ServerMessages.Type.CONN_CAPABILITIES",
|
||||
"Mysqlx.Connection.Capabilities"),
|
||||
("Mysqlx.ServerMessages.Type.SESS_AUTHENTICATE_CONTINUE",
|
||||
"Mysqlx.Session.AuthenticateContinue"),
|
||||
("Mysqlx.ServerMessages.Type.SESS_AUTHENTICATE_OK",
|
||||
"Mysqlx.Session.AuthenticateOk"),
|
||||
("Mysqlx.ServerMessages.Type.NOTICE",
|
||||
"Mysqlx.Notice.Frame"),
|
||||
("Mysqlx.ServerMessages.Type.RESULTSET_COLUMN_META_DATA",
|
||||
"Mysqlx.Resultset.ColumnMetaData"),
|
||||
("Mysqlx.ServerMessages.Type.RESULTSET_ROW",
|
||||
"Mysqlx.Resultset.Row"),
|
||||
("Mysqlx.ServerMessages.Type.RESULTSET_FETCH_DONE",
|
||||
"Mysqlx.Resultset.FetchDone"),
|
||||
("Mysqlx.ServerMessages.Type.RESULTSET_FETCH_SUSPENDED",
|
||||
"Mysqlx.Resultset.FetchSuspended"),
|
||||
("Mysqlx.ServerMessages.Type.RESULTSET_FETCH_DONE_MORE_RESULTSETS",
|
||||
"Mysqlx.Resultset.FetchDoneMoreResultsets"),
|
||||
("Mysqlx.ServerMessages.Type.SQL_STMT_EXECUTE_OK",
|
||||
"Mysqlx.Sql.StmtExecuteOk"),
|
||||
("Mysqlx.ServerMessages.Type.RESULTSET_FETCH_DONE_MORE_OUT_PARAMS",
|
||||
"Mysqlx.Resultset.FetchDoneMoreOutParams"),
|
||||
("Mysqlx.ServerMessages.Type.COMPRESSION",
|
||||
"Mysqlx.Connection.Compression"),
|
||||
)
|
||||
|
||||
PROTOBUF_VERSION = None
|
||||
PROTOBUF_REPEATED_TYPES = [list]
|
||||
|
||||
try:
|
||||
import _mysqlxpb
|
||||
SERVER_MESSAGES = dict([(int(_mysqlxpb.enum_value(key)), val)
|
||||
for key, val in _SERVER_MESSAGES_TUPLES])
|
||||
HAVE_MYSQLXPB_CEXT = True
|
||||
except ImportError:
|
||||
HAVE_MYSQLXPB_CEXT = False
|
||||
|
||||
from ..helpers import BYTE_TYPES, NUMERIC_TYPES, encode_to_bytes
|
||||
|
||||
try:
|
||||
from google import protobuf
|
||||
from google.protobuf import descriptor_database
|
||||
from google.protobuf import descriptor_pb2
|
||||
from google.protobuf import descriptor_pool
|
||||
from google.protobuf import message_factory
|
||||
from google.protobuf.internal.containers import (
|
||||
RepeatedCompositeFieldContainer)
|
||||
try:
|
||||
from google.protobuf.pyext._message import (
|
||||
RepeatedCompositeContainer)
|
||||
PROTOBUF_REPEATED_TYPES.append(RepeatedCompositeContainer)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
PROTOBUF_REPEATED_TYPES.append(RepeatedCompositeFieldContainer)
|
||||
if hasattr(protobuf, "__version__"):
|
||||
# Only Protobuf versions >=3.0.0 provide `__version__`
|
||||
PROTOBUF_VERSION = protobuf.__version__
|
||||
|
||||
from . import mysqlx_connection_pb2
|
||||
from . import mysqlx_crud_pb2
|
||||
from . import mysqlx_cursor_pb2
|
||||
from . import mysqlx_datatypes_pb2
|
||||
from . import mysqlx_expect_pb2
|
||||
from . import mysqlx_expr_pb2
|
||||
from . import mysqlx_notice_pb2
|
||||
from . import mysqlx_pb2
|
||||
from . import mysqlx_prepare_pb2
|
||||
from . import mysqlx_resultset_pb2
|
||||
from . import mysqlx_session_pb2
|
||||
from . import mysqlx_sql_pb2
|
||||
|
||||
# Dictionary with all messages descriptors
|
||||
_MESSAGES = {}
|
||||
|
||||
# Mysqlx
|
||||
for key, val in mysqlx_pb2.ClientMessages.Type.items():
|
||||
_MESSAGES["Mysqlx.ClientMessages.Type.{0}".format(key)] = val
|
||||
for key, val in mysqlx_pb2.ServerMessages.Type.items():
|
||||
_MESSAGES["Mysqlx.ServerMessages.Type.{0}".format(key)] = val
|
||||
for key, val in mysqlx_pb2.Error.Severity.items():
|
||||
_MESSAGES["Mysqlx.Error.Severity.{0}".format(key)] = val
|
||||
|
||||
# Mysqlx.Crud
|
||||
for key, val in mysqlx_crud_pb2.DataModel.items():
|
||||
_MESSAGES["Mysqlx.Crud.DataModel.{0}".format(key)] = val
|
||||
for key, val in mysqlx_crud_pb2.Find.RowLock.items():
|
||||
_MESSAGES["Mysqlx.Crud.Find.RowLock.{0}".format(key)] = val
|
||||
for key, val in mysqlx_crud_pb2.Order.Direction.items():
|
||||
_MESSAGES["Mysqlx.Crud.Order.Direction.{0}".format(key)] = val
|
||||
for key, val in mysqlx_crud_pb2.UpdateOperation.UpdateType.items():
|
||||
_MESSAGES["Mysqlx.Crud.UpdateOperation.UpdateType.{0}".format(key)] = val
|
||||
|
||||
# Mysqlx.Datatypes
|
||||
for key, val in mysqlx_datatypes_pb2.Scalar.Type.items():
|
||||
_MESSAGES["Mysqlx.Datatypes.Scalar.Type.{0}".format(key)] = val
|
||||
for key, val in mysqlx_datatypes_pb2.Any.Type.items():
|
||||
_MESSAGES["Mysqlx.Datatypes.Any.Type.{0}".format(key)] = val
|
||||
|
||||
# Mysqlx.Expect
|
||||
for key, val in mysqlx_expect_pb2.Open.Condition.ConditionOperation.items():
|
||||
_MESSAGES["Mysqlx.Expect.Open.Condition.ConditionOperation.{0}"
|
||||
"".format(key)] = val
|
||||
for key, val in mysqlx_expect_pb2.Open.Condition.Key.items():
|
||||
_MESSAGES["Mysqlx.Expect.Open.Condition.Key.{0}"
|
||||
"".format(key)] = val
|
||||
for key, val in mysqlx_expect_pb2.Open.CtxOperation.items():
|
||||
_MESSAGES["Mysqlx.Expect.Open.CtxOperation.{0}".format(key)] = val
|
||||
|
||||
# Mysqlx.Expr
|
||||
for key, val in mysqlx_expr_pb2.Expr.Type.items():
|
||||
_MESSAGES["Mysqlx.Expr.Expr.Type.{0}".format(key)] = val
|
||||
for key, val in mysqlx_expr_pb2.DocumentPathItem.Type.items():
|
||||
_MESSAGES["Mysqlx.Expr.DocumentPathItem.Type.{0}".format(key)] = val
|
||||
|
||||
# Mysqlx.Notice
|
||||
for key, val in mysqlx_notice_pb2.Frame.Scope.items():
|
||||
_MESSAGES["Mysqlx.Notice.Frame.Scope.{0}".format(key)] = val
|
||||
for key, val in mysqlx_notice_pb2.Warning.Level.items():
|
||||
_MESSAGES["Mysqlx.Notice.Warning.Level.{0}".format(key)] = val
|
||||
for key, val in mysqlx_notice_pb2.SessionStateChanged.Parameter.items():
|
||||
_MESSAGES["Mysqlx.Notice.SessionStateChanged.Parameter.{0}"
|
||||
"".format(key)] = val
|
||||
|
||||
# Mysql.Prepare
|
||||
for key, val in mysqlx_prepare_pb2.Prepare.OneOfMessage.Type.items():
|
||||
_MESSAGES["Mysqlx.Prepare.Prepare.OneOfMessage.Type.{0}"
|
||||
"".format(key)] = val
|
||||
|
||||
# Mysql.Resultset
|
||||
for key, val in mysqlx_resultset_pb2.ColumnMetaData.FieldType.items():
|
||||
_MESSAGES["Mysqlx.Resultset.ColumnMetaData.FieldType.{0}".format(key)] = val
|
||||
|
||||
# Add messages to the descriptor pool
|
||||
_DESCRIPTOR_DB = descriptor_database.DescriptorDatabase()
|
||||
_DESCRIPTOR_POOL = descriptor_pool.DescriptorPool(_DESCRIPTOR_DB)
|
||||
|
||||
_DESCRIPTOR_DB.Add(descriptor_pb2.FileDescriptorProto.FromString(
|
||||
mysqlx_connection_pb2.DESCRIPTOR.serialized_pb))
|
||||
_DESCRIPTOR_DB.Add(descriptor_pb2.FileDescriptorProto.FromString(
|
||||
mysqlx_crud_pb2.DESCRIPTOR.serialized_pb))
|
||||
_DESCRIPTOR_DB.Add(descriptor_pb2.FileDescriptorProto.FromString(
|
||||
mysqlx_cursor_pb2.DESCRIPTOR.serialized_pb))
|
||||
_DESCRIPTOR_DB.Add(descriptor_pb2.FileDescriptorProto.FromString(
|
||||
mysqlx_datatypes_pb2.DESCRIPTOR.serialized_pb))
|
||||
_DESCRIPTOR_DB.Add(descriptor_pb2.FileDescriptorProto.FromString(
|
||||
mysqlx_expect_pb2.DESCRIPTOR.serialized_pb))
|
||||
_DESCRIPTOR_DB.Add(descriptor_pb2.FileDescriptorProto.FromString(
|
||||
mysqlx_expr_pb2.DESCRIPTOR.serialized_pb))
|
||||
_DESCRIPTOR_DB.Add(descriptor_pb2.FileDescriptorProto.FromString(
|
||||
mysqlx_notice_pb2.DESCRIPTOR.serialized_pb))
|
||||
_DESCRIPTOR_DB.Add(descriptor_pb2.FileDescriptorProto.FromString(
|
||||
mysqlx_pb2.DESCRIPTOR.serialized_pb))
|
||||
_DESCRIPTOR_DB.Add(descriptor_pb2.FileDescriptorProto.FromString(
|
||||
mysqlx_prepare_pb2.DESCRIPTOR.serialized_pb))
|
||||
_DESCRIPTOR_DB.Add(descriptor_pb2.FileDescriptorProto.FromString(
|
||||
mysqlx_resultset_pb2.DESCRIPTOR.serialized_pb))
|
||||
_DESCRIPTOR_DB.Add(descriptor_pb2.FileDescriptorProto.FromString(
|
||||
mysqlx_session_pb2.DESCRIPTOR.serialized_pb))
|
||||
_DESCRIPTOR_DB.Add(descriptor_pb2.FileDescriptorProto.FromString(
|
||||
mysqlx_sql_pb2.DESCRIPTOR.serialized_pb))
|
||||
|
||||
SERVER_MESSAGES = dict(
|
||||
[(_MESSAGES[key], val) for key, val in _SERVER_MESSAGES_TUPLES]
|
||||
)
|
||||
HAVE_PROTOBUF = True
|
||||
HAVE_PROTOBUF_ERROR = None
|
||||
|
||||
class _mysqlxpb_pure(object):
|
||||
"""This class implements the methods in pure Python used by the
|
||||
_mysqlxpb C++ extension."""
|
||||
|
||||
factory = message_factory.MessageFactory()
|
||||
|
||||
@staticmethod
|
||||
def new_message(name):
|
||||
cls = _mysqlxpb_pure.factory.GetPrototype(
|
||||
_DESCRIPTOR_POOL.FindMessageTypeByName(name))
|
||||
return cls()
|
||||
|
||||
@staticmethod
|
||||
def enum_value(key):
|
||||
return _MESSAGES[key]
|
||||
|
||||
@staticmethod
|
||||
def serialize_message(msg):
|
||||
return msg.SerializeToString()
|
||||
|
||||
@staticmethod
|
||||
def serialize_partial_message(msg):
|
||||
return msg.SerializePartialToString()
|
||||
|
||||
@staticmethod
|
||||
def parse_message(msg_type_name, payload):
|
||||
msg = _mysqlxpb_pure.new_message(msg_type_name)
|
||||
msg.ParseFromString(payload)
|
||||
return msg
|
||||
|
||||
@staticmethod
|
||||
def parse_server_message(msg_type, payload):
|
||||
msg_type_name = SERVER_MESSAGES.get(msg_type)
|
||||
if not msg_type_name:
|
||||
raise ValueError("Unknown msg_type: {0}".format(msg_type))
|
||||
msg = _mysqlxpb_pure.new_message(msg_type_name)
|
||||
msg.ParseFromString(payload)
|
||||
return msg
|
||||
except (ImportError, ModuleNotFoundError, SyntaxError, TypeError) as err:
|
||||
HAVE_PROTOBUF = False
|
||||
HAVE_PROTOBUF_ERROR = err if PROTOBUF_VERSION is not None \
|
||||
else "Protobuf >=3.0.0 is required"
|
||||
if not HAVE_MYSQLXPB_CEXT:
|
||||
raise ImportError("Protobuf is not available: {}"
|
||||
"".format(HAVE_PROTOBUF_ERROR))
|
||||
|
||||
CRUD_PREPARE_MAPPING = {
|
||||
"Mysqlx.ClientMessages.Type.CRUD_FIND": (
|
||||
"Mysqlx.Prepare.Prepare.OneOfMessage.Type.FIND", "find"),
|
||||
"Mysqlx.ClientMessages.Type.CRUD_INSERT": (
|
||||
"Mysqlx.Prepare.Prepare.OneOfMessage.Type.INSERT", "insert"),
|
||||
"Mysqlx.ClientMessages.Type.CRUD_UPDATE": (
|
||||
"Mysqlx.Prepare.Prepare.OneOfMessage.Type.UPDATE", "update"),
|
||||
"Mysqlx.ClientMessages.Type.CRUD_DELETE": (
|
||||
"Mysqlx.Prepare.Prepare.OneOfMessage.Type.DELETE", "delete"),
|
||||
"Mysqlx.ClientMessages.Type.SQL_STMT_EXECUTE": (
|
||||
"Mysqlx.Prepare.Prepare.OneOfMessage.Type.STMT", "stmt_execute")
|
||||
}
|
||||
|
||||
|
||||
class Protobuf(object):
|
||||
"""Protobuf class acts as a container of the Protobuf message class.
|
||||
It allows the switch between the C extension and pure Python implementation
|
||||
message handlers, by patching the `mysqlxpb` class attribute.
|
||||
"""
|
||||
mysqlxpb = _mysqlxpb if HAVE_MYSQLXPB_CEXT else _mysqlxpb_pure
|
||||
use_pure = False if HAVE_MYSQLXPB_CEXT else True
|
||||
|
||||
@staticmethod
|
||||
def set_use_pure(use_pure):
|
||||
"""Sets whether to use the C extension or pure Python implementation.
|
||||
|
||||
Args:
|
||||
use_pure (bool): `True` to use pure Python implementation.
|
||||
"""
|
||||
if use_pure and not HAVE_PROTOBUF:
|
||||
raise ImportError("Protobuf is not available: {}"
|
||||
"".format(HAVE_PROTOBUF_ERROR))
|
||||
elif not use_pure and not HAVE_MYSQLXPB_CEXT:
|
||||
raise ImportError("MySQL X Protobuf C extension is not available")
|
||||
Protobuf.mysqlxpb = _mysqlxpb_pure if use_pure else _mysqlxpb
|
||||
Protobuf.use_pure = use_pure
|
||||
|
||||
|
||||
class Message(object):
|
||||
"""Helper class for interfacing with the MySQL X Protobuf extension.
|
||||
|
||||
Args:
|
||||
msg_type_name (string): Protobuf type name.
|
||||
**kwargs: Arbitrary keyword arguments with values for the message.
|
||||
"""
|
||||
def __init__(self, msg_type_name=None, **kwargs):
|
||||
self.__dict__["_msg"] = Protobuf.mysqlxpb.new_message(msg_type_name) \
|
||||
if msg_type_name else None
|
||||
for key, value in kwargs.items():
|
||||
self.__setattr__(key, value)
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
if Protobuf.use_pure:
|
||||
if isinstance(value, str):
|
||||
setattr(self._msg, name, encode_to_bytes(value))
|
||||
elif isinstance(value, (NUMERIC_TYPES, BYTE_TYPES)):
|
||||
setattr(self._msg, name, value)
|
||||
elif isinstance(value, list):
|
||||
getattr(self._msg, name).extend(value)
|
||||
elif isinstance(value, Message):
|
||||
getattr(self._msg, name).MergeFrom(value.get_message())
|
||||
else:
|
||||
getattr(self._msg, name).MergeFrom(value)
|
||||
else:
|
||||
self._msg[name] = value.get_message() \
|
||||
if isinstance(value, Message) else value
|
||||
|
||||
def __getattr__(self, name):
|
||||
try:
|
||||
return self._msg[name] if not Protobuf.use_pure \
|
||||
else getattr(self._msg, name)
|
||||
except KeyError:
|
||||
raise AttributeError
|
||||
|
||||
def __setitem__(self, name, value):
|
||||
self.__setattr__(name, value)
|
||||
|
||||
def __getitem__(self, name):
|
||||
return self.__getattr__(name)
|
||||
|
||||
def get(self, name, default=None):
|
||||
"""Returns the value of an element of the message dictionary.
|
||||
|
||||
Args:
|
||||
name (string): Key name.
|
||||
default (object): The default value if the key does not exists.
|
||||
|
||||
Returns:
|
||||
object: The value of the provided key name.
|
||||
"""
|
||||
return self.__dict__["_msg"].get(name, default) \
|
||||
if not Protobuf.use_pure \
|
||||
else getattr(self.__dict__["_msg"], name, default)
|
||||
|
||||
def set_message(self, msg):
|
||||
"""Sets the message.
|
||||
|
||||
Args:
|
||||
msg (dict): Dictionary representing a message.
|
||||
"""
|
||||
self.__dict__["_msg"] = msg
|
||||
|
||||
def get_message(self):
|
||||
"""Returns the dictionary representing a message containing parsed
|
||||
data.
|
||||
|
||||
Returns:
|
||||
dict: The dictionary representing a message containing parsed data.
|
||||
"""
|
||||
return self.__dict__["_msg"]
|
||||
|
||||
def serialize_to_string(self):
|
||||
"""Serializes a message to a string.
|
||||
|
||||
Returns:
|
||||
str: A string representing a message containing parsed data.
|
||||
"""
|
||||
return Protobuf.mysqlxpb.serialize_message(self._msg)
|
||||
|
||||
def serialize_partial_to_string(self):
|
||||
"""Serializes the protocol message to a binary string.
|
||||
|
||||
This method is similar to serialize_to_string but doesn't check if the
|
||||
message is initialized.
|
||||
|
||||
Returns:
|
||||
str: A string representation of the partial message.
|
||||
"""
|
||||
return Protobuf.mysqlxpb.serialize_partial_message(self._msg)
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
"""string: Message type name."""
|
||||
return self._msg["_mysqlxpb_type_name"] if not Protobuf.use_pure \
|
||||
else self._msg.DESCRIPTOR.full_name
|
||||
|
||||
@staticmethod
|
||||
def parse(msg_type_name, payload):
|
||||
"""Creates a new message, initialized with parsed data.
|
||||
|
||||
Args:
|
||||
msg_type_name (string): Message type name.
|
||||
payload (string): Serialized message data.
|
||||
|
||||
Returns:
|
||||
dict: The dictionary representing a message containing parsed data.
|
||||
|
||||
.. versionadded:: 8.0.21
|
||||
"""
|
||||
return Protobuf.mysqlxpb.parse_message(msg_type_name, payload)
|
||||
|
||||
@staticmethod
|
||||
def byte_size(msg):
|
||||
"""Returns the size of the message in bytes.
|
||||
|
||||
Args:
|
||||
msg (mysqlx.protobuf.Message): MySQL X Protobuf Message.
|
||||
|
||||
Returns:
|
||||
int: Size of the message in bytes.
|
||||
|
||||
.. versionadded:: 8.0.21
|
||||
"""
|
||||
return msg.ByteSize() if Protobuf.use_pure \
|
||||
else len(encode_to_bytes(msg.serialize_to_string()))
|
||||
|
||||
@staticmethod
|
||||
def parse_from_server(msg_type, payload):
|
||||
"""Creates a new server-side message, initialized with parsed data.
|
||||
|
||||
Args:
|
||||
msg_type (int): Message type.
|
||||
payload (string): Serialized message data.
|
||||
|
||||
Returns:
|
||||
dict: The dictionary representing a message containing parsed data.
|
||||
"""
|
||||
return Protobuf.mysqlxpb.parse_server_message(msg_type, payload)
|
||||
|
||||
@classmethod
|
||||
def from_message(cls, msg_type_name, payload):
|
||||
"""Creates a new message, initialized with parsed data and returns a
|
||||
:class:`mysqlx.protobuf.Message` object.
|
||||
|
||||
Args:
|
||||
msg_type_name (string): Message type name.
|
||||
payload (string): Serialized message data.
|
||||
|
||||
Returns:
|
||||
mysqlx.protobuf.Message: The Message representing a message
|
||||
containing parsed data.
|
||||
"""
|
||||
msg = cls()
|
||||
msg.set_message(Protobuf.mysqlxpb.parse_message(msg_type_name, payload))
|
||||
return msg
|
||||
|
||||
@classmethod
|
||||
def from_server_message(cls, msg_type, payload):
|
||||
"""Creates a new server-side message, initialized with parsed data and
|
||||
returns a :class:`mysqlx.protobuf.Message` object.
|
||||
|
||||
Args:
|
||||
msg_type (int): Message type.
|
||||
payload (string): Serialized message data.
|
||||
|
||||
Returns:
|
||||
mysqlx.protobuf.Message: The Message representing a message
|
||||
containing parsed data.
|
||||
"""
|
||||
msg = cls()
|
||||
msg.set_message(
|
||||
Protobuf.mysqlxpb.parse_server_message(msg_type, payload))
|
||||
return msg
|
||||
|
||||
|
||||
def mysqlxpb_enum(name):
|
||||
"""Returns the value of a MySQL X Protobuf enumerator.
|
||||
|
||||
Args:
|
||||
name (string): MySQL X Protobuf numerator name.
|
||||
|
||||
Returns:
|
||||
int: Value of the enumerator.
|
||||
"""
|
||||
return Protobuf.mysqlxpb.enum_value(name)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,316 @@
|
||||
# Copyright (c) 2017, 2020, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: mysqlx_connection.proto
|
||||
|
||||
import sys
|
||||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf import descriptor_pb2
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
from mysqlx.protobuf import mysqlx_datatypes_pb2 as mysqlx__datatypes__pb2
|
||||
from mysqlx.protobuf import mysqlx_pb2 as mysqlx__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='mysqlx_connection.proto',
|
||||
package='Mysqlx.Connection',
|
||||
syntax='proto2',
|
||||
serialized_pb=_b('\n\x17mysqlx_connection.proto\x12\x11Mysqlx.Connection\x1a\x16mysqlx_datatypes.proto\x1a\x0cmysqlx.proto\"@\n\nCapability\x12\x0c\n\x04name\x18\x01 \x02(\t\x12$\n\x05value\x18\x02 \x02(\x0b\x32\x15.Mysqlx.Datatypes.Any\"C\n\x0c\x43\x61pabilities\x12\x33\n\x0c\x63\x61pabilities\x18\x01 \x03(\x0b\x32\x1d.Mysqlx.Connection.Capability\"\x11\n\x0f\x43\x61pabilitiesGet\"H\n\x0f\x43\x61pabilitiesSet\x12\x35\n\x0c\x63\x61pabilities\x18\x01 \x02(\x0b\x32\x1f.Mysqlx.Connection.Capabilities\"\x07\n\x05\x43lose\"\xa5\x01\n\x0b\x43ompression\x12\x19\n\x11uncompressed_size\x18\x01 \x01(\x04\x12\x34\n\x0fserver_messages\x18\x02 \x01(\x0e\x32\x1b.Mysqlx.ServerMessages.Type\x12\x34\n\x0f\x63lient_messages\x18\x03 \x01(\x0e\x32\x1b.Mysqlx.ClientMessages.Type\x12\x0f\n\x07payload\x18\x04 \x02(\x0c\x42\x1b\n\x17\x63om.mysql.cj.x.protobufH\x03')
|
||||
,
|
||||
dependencies=[mysqlx__datatypes__pb2.DESCRIPTOR,mysqlx__pb2.DESCRIPTOR,])
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
|
||||
_CAPABILITY = _descriptor.Descriptor(
|
||||
name='Capability',
|
||||
full_name='Mysqlx.Connection.Capability',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='name', full_name='Mysqlx.Connection.Capability.name', index=0,
|
||||
number=1, type=9, cpp_type=9, label=2,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='value', full_name='Mysqlx.Connection.Capability.value', index=1,
|
||||
number=2, type=11, cpp_type=10, label=2,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=84,
|
||||
serialized_end=148,
|
||||
)
|
||||
|
||||
|
||||
_CAPABILITIES = _descriptor.Descriptor(
|
||||
name='Capabilities',
|
||||
full_name='Mysqlx.Connection.Capabilities',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='capabilities', full_name='Mysqlx.Connection.Capabilities.capabilities', index=0,
|
||||
number=1, type=11, cpp_type=10, label=3,
|
||||
has_default_value=False, default_value=[],
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=150,
|
||||
serialized_end=217,
|
||||
)
|
||||
|
||||
|
||||
_CAPABILITIESGET = _descriptor.Descriptor(
|
||||
name='CapabilitiesGet',
|
||||
full_name='Mysqlx.Connection.CapabilitiesGet',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=219,
|
||||
serialized_end=236,
|
||||
)
|
||||
|
||||
|
||||
_CAPABILITIESSET = _descriptor.Descriptor(
|
||||
name='CapabilitiesSet',
|
||||
full_name='Mysqlx.Connection.CapabilitiesSet',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='capabilities', full_name='Mysqlx.Connection.CapabilitiesSet.capabilities', index=0,
|
||||
number=1, type=11, cpp_type=10, label=2,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=238,
|
||||
serialized_end=310,
|
||||
)
|
||||
|
||||
|
||||
_CLOSE = _descriptor.Descriptor(
|
||||
name='Close',
|
||||
full_name='Mysqlx.Connection.Close',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=312,
|
||||
serialized_end=319,
|
||||
)
|
||||
|
||||
|
||||
_COMPRESSION = _descriptor.Descriptor(
|
||||
name='Compression',
|
||||
full_name='Mysqlx.Connection.Compression',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='uncompressed_size', full_name='Mysqlx.Connection.Compression.uncompressed_size', index=0,
|
||||
number=1, type=4, cpp_type=4, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='server_messages', full_name='Mysqlx.Connection.Compression.server_messages', index=1,
|
||||
number=2, type=14, cpp_type=8, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='client_messages', full_name='Mysqlx.Connection.Compression.client_messages', index=2,
|
||||
number=3, type=14, cpp_type=8, label=1,
|
||||
has_default_value=False, default_value=1,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='payload', full_name='Mysqlx.Connection.Compression.payload', index=3,
|
||||
number=4, type=12, cpp_type=9, label=2,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=322,
|
||||
serialized_end=487,
|
||||
)
|
||||
|
||||
_CAPABILITY.fields_by_name['value'].message_type = mysqlx__datatypes__pb2._ANY
|
||||
_CAPABILITIES.fields_by_name['capabilities'].message_type = _CAPABILITY
|
||||
_CAPABILITIESSET.fields_by_name['capabilities'].message_type = _CAPABILITIES
|
||||
_COMPRESSION.fields_by_name['server_messages'].enum_type = mysqlx__pb2._SERVERMESSAGES_TYPE
|
||||
_COMPRESSION.fields_by_name['client_messages'].enum_type = mysqlx__pb2._CLIENTMESSAGES_TYPE
|
||||
DESCRIPTOR.message_types_by_name['Capability'] = _CAPABILITY
|
||||
DESCRIPTOR.message_types_by_name['Capabilities'] = _CAPABILITIES
|
||||
DESCRIPTOR.message_types_by_name['CapabilitiesGet'] = _CAPABILITIESGET
|
||||
DESCRIPTOR.message_types_by_name['CapabilitiesSet'] = _CAPABILITIESSET
|
||||
DESCRIPTOR.message_types_by_name['Close'] = _CLOSE
|
||||
DESCRIPTOR.message_types_by_name['Compression'] = _COMPRESSION
|
||||
|
||||
Capability = _reflection.GeneratedProtocolMessageType('Capability', (_message.Message,), dict(
|
||||
DESCRIPTOR = _CAPABILITY,
|
||||
__module__ = 'mysqlx_connection_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Connection.Capability)
|
||||
))
|
||||
_sym_db.RegisterMessage(Capability)
|
||||
|
||||
Capabilities = _reflection.GeneratedProtocolMessageType('Capabilities', (_message.Message,), dict(
|
||||
DESCRIPTOR = _CAPABILITIES,
|
||||
__module__ = 'mysqlx_connection_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Connection.Capabilities)
|
||||
))
|
||||
_sym_db.RegisterMessage(Capabilities)
|
||||
|
||||
CapabilitiesGet = _reflection.GeneratedProtocolMessageType('CapabilitiesGet', (_message.Message,), dict(
|
||||
DESCRIPTOR = _CAPABILITIESGET,
|
||||
__module__ = 'mysqlx_connection_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Connection.CapabilitiesGet)
|
||||
))
|
||||
_sym_db.RegisterMessage(CapabilitiesGet)
|
||||
|
||||
CapabilitiesSet = _reflection.GeneratedProtocolMessageType('CapabilitiesSet', (_message.Message,), dict(
|
||||
DESCRIPTOR = _CAPABILITIESSET,
|
||||
__module__ = 'mysqlx_connection_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Connection.CapabilitiesSet)
|
||||
))
|
||||
_sym_db.RegisterMessage(CapabilitiesSet)
|
||||
|
||||
Close = _reflection.GeneratedProtocolMessageType('Close', (_message.Message,), dict(
|
||||
DESCRIPTOR = _CLOSE,
|
||||
__module__ = 'mysqlx_connection_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Connection.Close)
|
||||
))
|
||||
_sym_db.RegisterMessage(Close)
|
||||
|
||||
Compression = _reflection.GeneratedProtocolMessageType('Compression', (_message.Message,), dict(
|
||||
DESCRIPTOR = _COMPRESSION,
|
||||
__module__ = 'mysqlx_connection_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Connection.Compression)
|
||||
))
|
||||
_sym_db.RegisterMessage(Compression)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\027com.mysql.cj.x.protobufH\003'))
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,269 @@
|
||||
# Copyright (c) 2017, 2020, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: mysqlx_cursor.proto
|
||||
|
||||
import sys
|
||||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf import descriptor_pb2
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
from mysqlx.protobuf import mysqlx_prepare_pb2 as mysqlx__prepare__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='mysqlx_cursor.proto',
|
||||
package='Mysqlx.Cursor',
|
||||
syntax='proto2',
|
||||
serialized_pb=_b('\n\x13mysqlx_cursor.proto\x12\rMysqlx.Cursor\x1a\x14mysqlx_prepare.proto\"\xf2\x01\n\x04Open\x12\x11\n\tcursor_id\x18\x01 \x02(\r\x12.\n\x04stmt\x18\x04 \x02(\x0b\x32 .Mysqlx.Cursor.Open.OneOfMessage\x12\x12\n\nfetch_rows\x18\x05 \x01(\x04\x1a\x92\x01\n\x0cOneOfMessage\x12\x33\n\x04type\x18\x01 \x02(\x0e\x32%.Mysqlx.Cursor.Open.OneOfMessage.Type\x12\x30\n\x0fprepare_execute\x18\x02 \x01(\x0b\x32\x17.Mysqlx.Prepare.Execute\"\x1b\n\x04Type\x12\x13\n\x0fPREPARE_EXECUTE\x10\x00\".\n\x05\x46\x65tch\x12\x11\n\tcursor_id\x18\x01 \x02(\r\x12\x12\n\nfetch_rows\x18\x05 \x01(\x04\"\x1a\n\x05\x43lose\x12\x11\n\tcursor_id\x18\x01 \x02(\rB\x1b\n\x17\x63om.mysql.cj.x.protobufH\x03')
|
||||
,
|
||||
dependencies=[mysqlx__prepare__pb2.DESCRIPTOR,])
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
_OPEN_ONEOFMESSAGE_TYPE = _descriptor.EnumDescriptor(
|
||||
name='Type',
|
||||
full_name='Mysqlx.Cursor.Open.OneOfMessage.Type',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='PREPARE_EXECUTE', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=276,
|
||||
serialized_end=303,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_OPEN_ONEOFMESSAGE_TYPE)
|
||||
|
||||
|
||||
_OPEN_ONEOFMESSAGE = _descriptor.Descriptor(
|
||||
name='OneOfMessage',
|
||||
full_name='Mysqlx.Cursor.Open.OneOfMessage',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='type', full_name='Mysqlx.Cursor.Open.OneOfMessage.type', index=0,
|
||||
number=1, type=14, cpp_type=8, label=2,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='prepare_execute', full_name='Mysqlx.Cursor.Open.OneOfMessage.prepare_execute', index=1,
|
||||
number=2, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_OPEN_ONEOFMESSAGE_TYPE,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=157,
|
||||
serialized_end=303,
|
||||
)
|
||||
|
||||
_OPEN = _descriptor.Descriptor(
|
||||
name='Open',
|
||||
full_name='Mysqlx.Cursor.Open',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='cursor_id', full_name='Mysqlx.Cursor.Open.cursor_id', index=0,
|
||||
number=1, type=13, cpp_type=3, label=2,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='stmt', full_name='Mysqlx.Cursor.Open.stmt', index=1,
|
||||
number=4, type=11, cpp_type=10, label=2,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='fetch_rows', full_name='Mysqlx.Cursor.Open.fetch_rows', index=2,
|
||||
number=5, type=4, cpp_type=4, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[_OPEN_ONEOFMESSAGE, ],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=61,
|
||||
serialized_end=303,
|
||||
)
|
||||
|
||||
|
||||
_FETCH = _descriptor.Descriptor(
|
||||
name='Fetch',
|
||||
full_name='Mysqlx.Cursor.Fetch',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='cursor_id', full_name='Mysqlx.Cursor.Fetch.cursor_id', index=0,
|
||||
number=1, type=13, cpp_type=3, label=2,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='fetch_rows', full_name='Mysqlx.Cursor.Fetch.fetch_rows', index=1,
|
||||
number=5, type=4, cpp_type=4, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=305,
|
||||
serialized_end=351,
|
||||
)
|
||||
|
||||
|
||||
_CLOSE = _descriptor.Descriptor(
|
||||
name='Close',
|
||||
full_name='Mysqlx.Cursor.Close',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='cursor_id', full_name='Mysqlx.Cursor.Close.cursor_id', index=0,
|
||||
number=1, type=13, cpp_type=3, label=2,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=353,
|
||||
serialized_end=379,
|
||||
)
|
||||
|
||||
_OPEN_ONEOFMESSAGE.fields_by_name['type'].enum_type = _OPEN_ONEOFMESSAGE_TYPE
|
||||
_OPEN_ONEOFMESSAGE.fields_by_name['prepare_execute'].message_type = mysqlx__prepare__pb2._EXECUTE
|
||||
_OPEN_ONEOFMESSAGE.containing_type = _OPEN
|
||||
_OPEN_ONEOFMESSAGE_TYPE.containing_type = _OPEN_ONEOFMESSAGE
|
||||
_OPEN.fields_by_name['stmt'].message_type = _OPEN_ONEOFMESSAGE
|
||||
DESCRIPTOR.message_types_by_name['Open'] = _OPEN
|
||||
DESCRIPTOR.message_types_by_name['Fetch'] = _FETCH
|
||||
DESCRIPTOR.message_types_by_name['Close'] = _CLOSE
|
||||
|
||||
Open = _reflection.GeneratedProtocolMessageType('Open', (_message.Message,), dict(
|
||||
|
||||
OneOfMessage = _reflection.GeneratedProtocolMessageType('OneOfMessage', (_message.Message,), dict(
|
||||
DESCRIPTOR = _OPEN_ONEOFMESSAGE,
|
||||
__module__ = 'mysqlx_cursor_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Cursor.Open.OneOfMessage)
|
||||
))
|
||||
,
|
||||
DESCRIPTOR = _OPEN,
|
||||
__module__ = 'mysqlx_cursor_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Cursor.Open)
|
||||
))
|
||||
_sym_db.RegisterMessage(Open)
|
||||
_sym_db.RegisterMessage(Open.OneOfMessage)
|
||||
|
||||
Fetch = _reflection.GeneratedProtocolMessageType('Fetch', (_message.Message,), dict(
|
||||
DESCRIPTOR = _FETCH,
|
||||
__module__ = 'mysqlx_cursor_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Cursor.Fetch)
|
||||
))
|
||||
_sym_db.RegisterMessage(Fetch)
|
||||
|
||||
Close = _reflection.GeneratedProtocolMessageType('Close', (_message.Message,), dict(
|
||||
DESCRIPTOR = _CLOSE,
|
||||
__module__ = 'mysqlx_cursor_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Cursor.Close)
|
||||
))
|
||||
_sym_db.RegisterMessage(Close)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\027com.mysql.cj.x.protobufH\003'))
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,510 @@
|
||||
# Copyright (c) 2017, 2020, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: mysqlx_datatypes.proto
|
||||
|
||||
import sys
|
||||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf import descriptor_pb2
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='mysqlx_datatypes.proto',
|
||||
package='Mysqlx.Datatypes',
|
||||
syntax='proto2',
|
||||
serialized_pb=_b('\n\x16mysqlx_datatypes.proto\x12\x10Mysqlx.Datatypes\"\xc6\x03\n\x06Scalar\x12+\n\x04type\x18\x01 \x02(\x0e\x32\x1d.Mysqlx.Datatypes.Scalar.Type\x12\x14\n\x0cv_signed_int\x18\x02 \x01(\x12\x12\x16\n\x0ev_unsigned_int\x18\x03 \x01(\x04\x12\x31\n\x08v_octets\x18\x05 \x01(\x0b\x32\x1f.Mysqlx.Datatypes.Scalar.Octets\x12\x10\n\x08v_double\x18\x06 \x01(\x01\x12\x0f\n\x07v_float\x18\x07 \x01(\x02\x12\x0e\n\x06v_bool\x18\x08 \x01(\x08\x12\x31\n\x08v_string\x18\t \x01(\x0b\x32\x1f.Mysqlx.Datatypes.Scalar.String\x1a*\n\x06String\x12\r\n\x05value\x18\x01 \x02(\x0c\x12\x11\n\tcollation\x18\x02 \x01(\x04\x1a-\n\x06Octets\x12\r\n\x05value\x18\x01 \x02(\x0c\x12\x14\n\x0c\x63ontent_type\x18\x02 \x01(\r\"m\n\x04Type\x12\n\n\x06V_SINT\x10\x01\x12\n\n\x06V_UINT\x10\x02\x12\n\n\x06V_NULL\x10\x03\x12\x0c\n\x08V_OCTETS\x10\x04\x12\x0c\n\x08V_DOUBLE\x10\x05\x12\x0b\n\x07V_FLOAT\x10\x06\x12\n\n\x06V_BOOL\x10\x07\x12\x0c\n\x08V_STRING\x10\x08\"}\n\x06Object\x12\x31\n\x03\x66ld\x18\x01 \x03(\x0b\x32$.Mysqlx.Datatypes.Object.ObjectField\x1a@\n\x0bObjectField\x12\x0b\n\x03key\x18\x01 \x02(\t\x12$\n\x05value\x18\x02 \x02(\x0b\x32\x15.Mysqlx.Datatypes.Any\"-\n\x05\x41rray\x12$\n\x05value\x18\x01 \x03(\x0b\x32\x15.Mysqlx.Datatypes.Any\"\xd3\x01\n\x03\x41ny\x12(\n\x04type\x18\x01 \x02(\x0e\x32\x1a.Mysqlx.Datatypes.Any.Type\x12(\n\x06scalar\x18\x02 \x01(\x0b\x32\x18.Mysqlx.Datatypes.Scalar\x12%\n\x03obj\x18\x03 \x01(\x0b\x32\x18.Mysqlx.Datatypes.Object\x12&\n\x05\x61rray\x18\x04 \x01(\x0b\x32\x17.Mysqlx.Datatypes.Array\")\n\x04Type\x12\n\n\x06SCALAR\x10\x01\x12\n\n\x06OBJECT\x10\x02\x12\t\n\x05\x41RRAY\x10\x03\x42\x1b\n\x17\x63om.mysql.cj.x.protobufH\x03')
|
||||
)
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
_SCALAR_TYPE = _descriptor.EnumDescriptor(
|
||||
name='Type',
|
||||
full_name='Mysqlx.Datatypes.Scalar.Type',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_SINT', index=0, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_UINT', index=1, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_NULL', index=2, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_OCTETS', index=3, number=4,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_DOUBLE', index=4, number=5,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_FLOAT', index=5, number=6,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_BOOL', index=6, number=7,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_STRING', index=7, number=8,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=390,
|
||||
serialized_end=499,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_SCALAR_TYPE)
|
||||
|
||||
_ANY_TYPE = _descriptor.EnumDescriptor(
|
||||
name='Type',
|
||||
full_name='Mysqlx.Datatypes.Any.Type',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SCALAR', index=0, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='OBJECT', index=1, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ARRAY', index=2, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=846,
|
||||
serialized_end=887,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_ANY_TYPE)
|
||||
|
||||
|
||||
_SCALAR_STRING = _descriptor.Descriptor(
|
||||
name='String',
|
||||
full_name='Mysqlx.Datatypes.Scalar.String',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='value', full_name='Mysqlx.Datatypes.Scalar.String.value', index=0,
|
||||
number=1, type=12, cpp_type=9, label=2,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='collation', full_name='Mysqlx.Datatypes.Scalar.String.collation', index=1,
|
||||
number=2, type=4, cpp_type=4, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=299,
|
||||
serialized_end=341,
|
||||
)
|
||||
|
||||
_SCALAR_OCTETS = _descriptor.Descriptor(
|
||||
name='Octets',
|
||||
full_name='Mysqlx.Datatypes.Scalar.Octets',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='value', full_name='Mysqlx.Datatypes.Scalar.Octets.value', index=0,
|
||||
number=1, type=12, cpp_type=9, label=2,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='content_type', full_name='Mysqlx.Datatypes.Scalar.Octets.content_type', index=1,
|
||||
number=2, type=13, cpp_type=3, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=343,
|
||||
serialized_end=388,
|
||||
)
|
||||
|
||||
_SCALAR = _descriptor.Descriptor(
|
||||
name='Scalar',
|
||||
full_name='Mysqlx.Datatypes.Scalar',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='type', full_name='Mysqlx.Datatypes.Scalar.type', index=0,
|
||||
number=1, type=14, cpp_type=8, label=2,
|
||||
has_default_value=False, default_value=1,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='v_signed_int', full_name='Mysqlx.Datatypes.Scalar.v_signed_int', index=1,
|
||||
number=2, type=18, cpp_type=2, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='v_unsigned_int', full_name='Mysqlx.Datatypes.Scalar.v_unsigned_int', index=2,
|
||||
number=3, type=4, cpp_type=4, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='v_octets', full_name='Mysqlx.Datatypes.Scalar.v_octets', index=3,
|
||||
number=5, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='v_double', full_name='Mysqlx.Datatypes.Scalar.v_double', index=4,
|
||||
number=6, type=1, cpp_type=5, label=1,
|
||||
has_default_value=False, default_value=float(0),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='v_float', full_name='Mysqlx.Datatypes.Scalar.v_float', index=5,
|
||||
number=7, type=2, cpp_type=6, label=1,
|
||||
has_default_value=False, default_value=float(0),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='v_bool', full_name='Mysqlx.Datatypes.Scalar.v_bool', index=6,
|
||||
number=8, type=8, cpp_type=7, label=1,
|
||||
has_default_value=False, default_value=False,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='v_string', full_name='Mysqlx.Datatypes.Scalar.v_string', index=7,
|
||||
number=9, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[_SCALAR_STRING, _SCALAR_OCTETS, ],
|
||||
enum_types=[
|
||||
_SCALAR_TYPE,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=45,
|
||||
serialized_end=499,
|
||||
)
|
||||
|
||||
|
||||
_OBJECT_OBJECTFIELD = _descriptor.Descriptor(
|
||||
name='ObjectField',
|
||||
full_name='Mysqlx.Datatypes.Object.ObjectField',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='key', full_name='Mysqlx.Datatypes.Object.ObjectField.key', index=0,
|
||||
number=1, type=9, cpp_type=9, label=2,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='value', full_name='Mysqlx.Datatypes.Object.ObjectField.value', index=1,
|
||||
number=2, type=11, cpp_type=10, label=2,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=562,
|
||||
serialized_end=626,
|
||||
)
|
||||
|
||||
_OBJECT = _descriptor.Descriptor(
|
||||
name='Object',
|
||||
full_name='Mysqlx.Datatypes.Object',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='fld', full_name='Mysqlx.Datatypes.Object.fld', index=0,
|
||||
number=1, type=11, cpp_type=10, label=3,
|
||||
has_default_value=False, default_value=[],
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[_OBJECT_OBJECTFIELD, ],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=501,
|
||||
serialized_end=626,
|
||||
)
|
||||
|
||||
|
||||
_ARRAY = _descriptor.Descriptor(
|
||||
name='Array',
|
||||
full_name='Mysqlx.Datatypes.Array',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='value', full_name='Mysqlx.Datatypes.Array.value', index=0,
|
||||
number=1, type=11, cpp_type=10, label=3,
|
||||
has_default_value=False, default_value=[],
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=628,
|
||||
serialized_end=673,
|
||||
)
|
||||
|
||||
|
||||
_ANY = _descriptor.Descriptor(
|
||||
name='Any',
|
||||
full_name='Mysqlx.Datatypes.Any',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='type', full_name='Mysqlx.Datatypes.Any.type', index=0,
|
||||
number=1, type=14, cpp_type=8, label=2,
|
||||
has_default_value=False, default_value=1,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='scalar', full_name='Mysqlx.Datatypes.Any.scalar', index=1,
|
||||
number=2, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='obj', full_name='Mysqlx.Datatypes.Any.obj', index=2,
|
||||
number=3, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='array', full_name='Mysqlx.Datatypes.Any.array', index=3,
|
||||
number=4, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_ANY_TYPE,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=676,
|
||||
serialized_end=887,
|
||||
)
|
||||
|
||||
_SCALAR_STRING.containing_type = _SCALAR
|
||||
_SCALAR_OCTETS.containing_type = _SCALAR
|
||||
_SCALAR.fields_by_name['type'].enum_type = _SCALAR_TYPE
|
||||
_SCALAR.fields_by_name['v_octets'].message_type = _SCALAR_OCTETS
|
||||
_SCALAR.fields_by_name['v_string'].message_type = _SCALAR_STRING
|
||||
_SCALAR_TYPE.containing_type = _SCALAR
|
||||
_OBJECT_OBJECTFIELD.fields_by_name['value'].message_type = _ANY
|
||||
_OBJECT_OBJECTFIELD.containing_type = _OBJECT
|
||||
_OBJECT.fields_by_name['fld'].message_type = _OBJECT_OBJECTFIELD
|
||||
_ARRAY.fields_by_name['value'].message_type = _ANY
|
||||
_ANY.fields_by_name['type'].enum_type = _ANY_TYPE
|
||||
_ANY.fields_by_name['scalar'].message_type = _SCALAR
|
||||
_ANY.fields_by_name['obj'].message_type = _OBJECT
|
||||
_ANY.fields_by_name['array'].message_type = _ARRAY
|
||||
_ANY_TYPE.containing_type = _ANY
|
||||
DESCRIPTOR.message_types_by_name['Scalar'] = _SCALAR
|
||||
DESCRIPTOR.message_types_by_name['Object'] = _OBJECT
|
||||
DESCRIPTOR.message_types_by_name['Array'] = _ARRAY
|
||||
DESCRIPTOR.message_types_by_name['Any'] = _ANY
|
||||
|
||||
Scalar = _reflection.GeneratedProtocolMessageType('Scalar', (_message.Message,), dict(
|
||||
|
||||
String = _reflection.GeneratedProtocolMessageType('String', (_message.Message,), dict(
|
||||
DESCRIPTOR = _SCALAR_STRING,
|
||||
__module__ = 'mysqlx_datatypes_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Datatypes.Scalar.String)
|
||||
))
|
||||
,
|
||||
|
||||
Octets = _reflection.GeneratedProtocolMessageType('Octets', (_message.Message,), dict(
|
||||
DESCRIPTOR = _SCALAR_OCTETS,
|
||||
__module__ = 'mysqlx_datatypes_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Datatypes.Scalar.Octets)
|
||||
))
|
||||
,
|
||||
DESCRIPTOR = _SCALAR,
|
||||
__module__ = 'mysqlx_datatypes_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Datatypes.Scalar)
|
||||
))
|
||||
_sym_db.RegisterMessage(Scalar)
|
||||
_sym_db.RegisterMessage(Scalar.String)
|
||||
_sym_db.RegisterMessage(Scalar.Octets)
|
||||
|
||||
Object = _reflection.GeneratedProtocolMessageType('Object', (_message.Message,), dict(
|
||||
|
||||
ObjectField = _reflection.GeneratedProtocolMessageType('ObjectField', (_message.Message,), dict(
|
||||
DESCRIPTOR = _OBJECT_OBJECTFIELD,
|
||||
__module__ = 'mysqlx_datatypes_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Datatypes.Object.ObjectField)
|
||||
))
|
||||
,
|
||||
DESCRIPTOR = _OBJECT,
|
||||
__module__ = 'mysqlx_datatypes_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Datatypes.Object)
|
||||
))
|
||||
_sym_db.RegisterMessage(Object)
|
||||
_sym_db.RegisterMessage(Object.ObjectField)
|
||||
|
||||
Array = _reflection.GeneratedProtocolMessageType('Array', (_message.Message,), dict(
|
||||
DESCRIPTOR = _ARRAY,
|
||||
__module__ = 'mysqlx_datatypes_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Datatypes.Array)
|
||||
))
|
||||
_sym_db.RegisterMessage(Array)
|
||||
|
||||
Any = _reflection.GeneratedProtocolMessageType('Any', (_message.Message,), dict(
|
||||
DESCRIPTOR = _ANY,
|
||||
__module__ = 'mysqlx_datatypes_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Datatypes.Any)
|
||||
))
|
||||
_sym_db.RegisterMessage(Any)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\027com.mysql.cj.x.protobufH\003'))
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,270 @@
|
||||
# Copyright (c) 2017, 2020, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: mysqlx_expect.proto
|
||||
|
||||
import sys
|
||||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf import descriptor_pb2
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='mysqlx_expect.proto',
|
||||
package='Mysqlx.Expect',
|
||||
syntax='proto2',
|
||||
serialized_pb=_b('\n\x13mysqlx_expect.proto\x12\rMysqlx.Expect\"\xd0\x03\n\x04Open\x12\x42\n\x02op\x18\x01 \x01(\x0e\x32 .Mysqlx.Expect.Open.CtxOperation:\x14\x45XPECT_CTX_COPY_PREV\x12+\n\x04\x63ond\x18\x02 \x03(\x0b\x32\x1d.Mysqlx.Expect.Open.Condition\x1a\x96\x02\n\tCondition\x12\x15\n\rcondition_key\x18\x01 \x02(\r\x12\x17\n\x0f\x63ondition_value\x18\x02 \x01(\x0c\x12K\n\x02op\x18\x03 \x01(\x0e\x32\x30.Mysqlx.Expect.Open.Condition.ConditionOperation:\rEXPECT_OP_SET\"N\n\x03Key\x12\x13\n\x0f\x45XPECT_NO_ERROR\x10\x01\x12\x16\n\x12\x45XPECT_FIELD_EXIST\x10\x02\x12\x1a\n\x16\x45XPECT_DOCID_GENERATED\x10\x03\"<\n\x12\x43onditionOperation\x12\x11\n\rEXPECT_OP_SET\x10\x00\x12\x13\n\x0f\x45XPECT_OP_UNSET\x10\x01\">\n\x0c\x43txOperation\x12\x18\n\x14\x45XPECT_CTX_COPY_PREV\x10\x00\x12\x14\n\x10\x45XPECT_CTX_EMPTY\x10\x01\"\x07\n\x05\x43loseB\x1b\n\x17\x63om.mysql.cj.x.protobufH\x03')
|
||||
)
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
_OPEN_CONDITION_KEY = _descriptor.EnumDescriptor(
|
||||
name='Key',
|
||||
full_name='Mysqlx.Expect.Open.Condition.Key',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='EXPECT_NO_ERROR', index=0, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='EXPECT_FIELD_EXIST', index=1, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='EXPECT_DOCID_GENERATED', index=2, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=299,
|
||||
serialized_end=377,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_OPEN_CONDITION_KEY)
|
||||
|
||||
_OPEN_CONDITION_CONDITIONOPERATION = _descriptor.EnumDescriptor(
|
||||
name='ConditionOperation',
|
||||
full_name='Mysqlx.Expect.Open.Condition.ConditionOperation',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='EXPECT_OP_SET', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='EXPECT_OP_UNSET', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=379,
|
||||
serialized_end=439,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_OPEN_CONDITION_CONDITIONOPERATION)
|
||||
|
||||
_OPEN_CTXOPERATION = _descriptor.EnumDescriptor(
|
||||
name='CtxOperation',
|
||||
full_name='Mysqlx.Expect.Open.CtxOperation',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='EXPECT_CTX_COPY_PREV', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='EXPECT_CTX_EMPTY', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=441,
|
||||
serialized_end=503,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_OPEN_CTXOPERATION)
|
||||
|
||||
|
||||
_OPEN_CONDITION = _descriptor.Descriptor(
|
||||
name='Condition',
|
||||
full_name='Mysqlx.Expect.Open.Condition',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='condition_key', full_name='Mysqlx.Expect.Open.Condition.condition_key', index=0,
|
||||
number=1, type=13, cpp_type=3, label=2,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='condition_value', full_name='Mysqlx.Expect.Open.Condition.condition_value', index=1,
|
||||
number=2, type=12, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='op', full_name='Mysqlx.Expect.Open.Condition.op', index=2,
|
||||
number=3, type=14, cpp_type=8, label=1,
|
||||
has_default_value=True, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_OPEN_CONDITION_KEY,
|
||||
_OPEN_CONDITION_CONDITIONOPERATION,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=161,
|
||||
serialized_end=439,
|
||||
)
|
||||
|
||||
_OPEN = _descriptor.Descriptor(
|
||||
name='Open',
|
||||
full_name='Mysqlx.Expect.Open',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='op', full_name='Mysqlx.Expect.Open.op', index=0,
|
||||
number=1, type=14, cpp_type=8, label=1,
|
||||
has_default_value=True, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='cond', full_name='Mysqlx.Expect.Open.cond', index=1,
|
||||
number=2, type=11, cpp_type=10, label=3,
|
||||
has_default_value=False, default_value=[],
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[_OPEN_CONDITION, ],
|
||||
enum_types=[
|
||||
_OPEN_CTXOPERATION,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=39,
|
||||
serialized_end=503,
|
||||
)
|
||||
|
||||
|
||||
_CLOSE = _descriptor.Descriptor(
|
||||
name='Close',
|
||||
full_name='Mysqlx.Expect.Close',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=505,
|
||||
serialized_end=512,
|
||||
)
|
||||
|
||||
_OPEN_CONDITION.fields_by_name['op'].enum_type = _OPEN_CONDITION_CONDITIONOPERATION
|
||||
_OPEN_CONDITION.containing_type = _OPEN
|
||||
_OPEN_CONDITION_KEY.containing_type = _OPEN_CONDITION
|
||||
_OPEN_CONDITION_CONDITIONOPERATION.containing_type = _OPEN_CONDITION
|
||||
_OPEN.fields_by_name['op'].enum_type = _OPEN_CTXOPERATION
|
||||
_OPEN.fields_by_name['cond'].message_type = _OPEN_CONDITION
|
||||
_OPEN_CTXOPERATION.containing_type = _OPEN
|
||||
DESCRIPTOR.message_types_by_name['Open'] = _OPEN
|
||||
DESCRIPTOR.message_types_by_name['Close'] = _CLOSE
|
||||
|
||||
Open = _reflection.GeneratedProtocolMessageType('Open', (_message.Message,), dict(
|
||||
|
||||
Condition = _reflection.GeneratedProtocolMessageType('Condition', (_message.Message,), dict(
|
||||
DESCRIPTOR = _OPEN_CONDITION,
|
||||
__module__ = 'mysqlx_expect_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Expect.Open.Condition)
|
||||
))
|
||||
,
|
||||
DESCRIPTOR = _OPEN,
|
||||
__module__ = 'mysqlx_expect_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Expect.Open)
|
||||
))
|
||||
_sym_db.RegisterMessage(Open)
|
||||
_sym_db.RegisterMessage(Open.Condition)
|
||||
|
||||
Close = _reflection.GeneratedProtocolMessageType('Close', (_message.Message,), dict(
|
||||
DESCRIPTOR = _CLOSE,
|
||||
__module__ = 'mysqlx_expect_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Expect.Close)
|
||||
))
|
||||
_sym_db.RegisterMessage(Close)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\027com.mysql.cj.x.protobufH\003'))
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,631 @@
|
||||
# Copyright (c) 2017, 2020, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: mysqlx_expr.proto
|
||||
|
||||
import sys
|
||||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf import descriptor_pb2
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
from mysqlx.protobuf import mysqlx_datatypes_pb2 as mysqlx__datatypes__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='mysqlx_expr.proto',
|
||||
package='Mysqlx.Expr',
|
||||
syntax='proto2',
|
||||
serialized_pb=_b('\n\x11mysqlx_expr.proto\x12\x0bMysqlx.Expr\x1a\x16mysqlx_datatypes.proto\"\xc4\x03\n\x04\x45xpr\x12$\n\x04type\x18\x01 \x02(\x0e\x32\x16.Mysqlx.Expr.Expr.Type\x12\x31\n\nidentifier\x18\x02 \x01(\x0b\x32\x1d.Mysqlx.Expr.ColumnIdentifier\x12\x10\n\x08variable\x18\x03 \x01(\t\x12)\n\x07literal\x18\x04 \x01(\x0b\x32\x18.Mysqlx.Datatypes.Scalar\x12\x30\n\rfunction_call\x18\x05 \x01(\x0b\x32\x19.Mysqlx.Expr.FunctionCall\x12\'\n\x08operator\x18\x06 \x01(\x0b\x32\x15.Mysqlx.Expr.Operator\x12\x10\n\x08position\x18\x07 \x01(\r\x12#\n\x06object\x18\x08 \x01(\x0b\x32\x13.Mysqlx.Expr.Object\x12!\n\x05\x61rray\x18\t \x01(\x0b\x32\x12.Mysqlx.Expr.Array\"q\n\x04Type\x12\t\n\x05IDENT\x10\x01\x12\x0b\n\x07LITERAL\x10\x02\x12\x0c\n\x08VARIABLE\x10\x03\x12\r\n\tFUNC_CALL\x10\x04\x12\x0c\n\x08OPERATOR\x10\x05\x12\x0f\n\x0bPLACEHOLDER\x10\x06\x12\n\n\x06OBJECT\x10\x07\x12\t\n\x05\x41RRAY\x10\x08\"/\n\nIdentifier\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\x13\n\x0bschema_name\x18\x02 \x01(\t\"\xcb\x01\n\x10\x44ocumentPathItem\x12\x30\n\x04type\x18\x01 \x02(\x0e\x32\".Mysqlx.Expr.DocumentPathItem.Type\x12\r\n\x05value\x18\x02 \x01(\t\x12\r\n\x05index\x18\x03 \x01(\r\"g\n\x04Type\x12\n\n\x06MEMBER\x10\x01\x12\x13\n\x0fMEMBER_ASTERISK\x10\x02\x12\x0f\n\x0b\x41RRAY_INDEX\x10\x03\x12\x18\n\x14\x41RRAY_INDEX_ASTERISK\x10\x04\x12\x13\n\x0f\x44OUBLE_ASTERISK\x10\x05\"\x7f\n\x10\x43olumnIdentifier\x12\x34\n\rdocument_path\x18\x01 \x03(\x0b\x32\x1d.Mysqlx.Expr.DocumentPathItem\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x12\n\ntable_name\x18\x03 \x01(\t\x12\x13\n\x0bschema_name\x18\x04 \x01(\t\"W\n\x0c\x46unctionCall\x12%\n\x04name\x18\x01 \x02(\x0b\x32\x17.Mysqlx.Expr.Identifier\x12 \n\x05param\x18\x02 \x03(\x0b\x32\x11.Mysqlx.Expr.Expr\":\n\x08Operator\x12\x0c\n\x04name\x18\x01 \x02(\t\x12 \n\x05param\x18\x02 \x03(\x0b\x32\x11.Mysqlx.Expr.Expr\"t\n\x06Object\x12,\n\x03\x66ld\x18\x01 \x03(\x0b\x32\x1f.Mysqlx.Expr.Object.ObjectField\x1a<\n\x0bObjectField\x12\x0b\n\x03key\x18\x01 \x02(\t\x12 \n\x05value\x18\x02 \x02(\x0b\x32\x11.Mysqlx.Expr.Expr\")\n\x05\x41rray\x12 \n\x05value\x18\x01 \x03(\x0b\x32\x11.Mysqlx.Expr.ExprB\x1b\n\x17\x63om.mysql.cj.x.protobufH\x03')
|
||||
,
|
||||
dependencies=[mysqlx__datatypes__pb2.DESCRIPTOR,])
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
_EXPR_TYPE = _descriptor.EnumDescriptor(
|
||||
name='Type',
|
||||
full_name='Mysqlx.Expr.Expr.Type',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='IDENT', index=0, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='LITERAL', index=1, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='VARIABLE', index=2, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='FUNC_CALL', index=3, number=4,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='OPERATOR', index=4, number=5,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='PLACEHOLDER', index=5, number=6,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='OBJECT', index=6, number=7,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ARRAY', index=7, number=8,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=398,
|
||||
serialized_end=511,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_EXPR_TYPE)
|
||||
|
||||
_DOCUMENTPATHITEM_TYPE = _descriptor.EnumDescriptor(
|
||||
name='Type',
|
||||
full_name='Mysqlx.Expr.DocumentPathItem.Type',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='MEMBER', index=0, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='MEMBER_ASTERISK', index=1, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ARRAY_INDEX', index=2, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ARRAY_INDEX_ASTERISK', index=3, number=4,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='DOUBLE_ASTERISK', index=4, number=5,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=663,
|
||||
serialized_end=766,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_DOCUMENTPATHITEM_TYPE)
|
||||
|
||||
|
||||
_EXPR = _descriptor.Descriptor(
|
||||
name='Expr',
|
||||
full_name='Mysqlx.Expr.Expr',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='type', full_name='Mysqlx.Expr.Expr.type', index=0,
|
||||
number=1, type=14, cpp_type=8, label=2,
|
||||
has_default_value=False, default_value=1,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='identifier', full_name='Mysqlx.Expr.Expr.identifier', index=1,
|
||||
number=2, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='variable', full_name='Mysqlx.Expr.Expr.variable', index=2,
|
||||
number=3, type=9, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='literal', full_name='Mysqlx.Expr.Expr.literal', index=3,
|
||||
number=4, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='function_call', full_name='Mysqlx.Expr.Expr.function_call', index=4,
|
||||
number=5, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='operator', full_name='Mysqlx.Expr.Expr.operator', index=5,
|
||||
number=6, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='position', full_name='Mysqlx.Expr.Expr.position', index=6,
|
||||
number=7, type=13, cpp_type=3, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='object', full_name='Mysqlx.Expr.Expr.object', index=7,
|
||||
number=8, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='array', full_name='Mysqlx.Expr.Expr.array', index=8,
|
||||
number=9, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_EXPR_TYPE,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=59,
|
||||
serialized_end=511,
|
||||
)
|
||||
|
||||
|
||||
_IDENTIFIER = _descriptor.Descriptor(
|
||||
name='Identifier',
|
||||
full_name='Mysqlx.Expr.Identifier',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='name', full_name='Mysqlx.Expr.Identifier.name', index=0,
|
||||
number=1, type=9, cpp_type=9, label=2,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='schema_name', full_name='Mysqlx.Expr.Identifier.schema_name', index=1,
|
||||
number=2, type=9, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=513,
|
||||
serialized_end=560,
|
||||
)
|
||||
|
||||
|
||||
_DOCUMENTPATHITEM = _descriptor.Descriptor(
|
||||
name='DocumentPathItem',
|
||||
full_name='Mysqlx.Expr.DocumentPathItem',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='type', full_name='Mysqlx.Expr.DocumentPathItem.type', index=0,
|
||||
number=1, type=14, cpp_type=8, label=2,
|
||||
has_default_value=False, default_value=1,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='value', full_name='Mysqlx.Expr.DocumentPathItem.value', index=1,
|
||||
number=2, type=9, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='index', full_name='Mysqlx.Expr.DocumentPathItem.index', index=2,
|
||||
number=3, type=13, cpp_type=3, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_DOCUMENTPATHITEM_TYPE,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=563,
|
||||
serialized_end=766,
|
||||
)
|
||||
|
||||
|
||||
_COLUMNIDENTIFIER = _descriptor.Descriptor(
|
||||
name='ColumnIdentifier',
|
||||
full_name='Mysqlx.Expr.ColumnIdentifier',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='document_path', full_name='Mysqlx.Expr.ColumnIdentifier.document_path', index=0,
|
||||
number=1, type=11, cpp_type=10, label=3,
|
||||
has_default_value=False, default_value=[],
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='name', full_name='Mysqlx.Expr.ColumnIdentifier.name', index=1,
|
||||
number=2, type=9, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='table_name', full_name='Mysqlx.Expr.ColumnIdentifier.table_name', index=2,
|
||||
number=3, type=9, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='schema_name', full_name='Mysqlx.Expr.ColumnIdentifier.schema_name', index=3,
|
||||
number=4, type=9, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=768,
|
||||
serialized_end=895,
|
||||
)
|
||||
|
||||
|
||||
_FUNCTIONCALL = _descriptor.Descriptor(
|
||||
name='FunctionCall',
|
||||
full_name='Mysqlx.Expr.FunctionCall',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='name', full_name='Mysqlx.Expr.FunctionCall.name', index=0,
|
||||
number=1, type=11, cpp_type=10, label=2,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='param', full_name='Mysqlx.Expr.FunctionCall.param', index=1,
|
||||
number=2, type=11, cpp_type=10, label=3,
|
||||
has_default_value=False, default_value=[],
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=897,
|
||||
serialized_end=984,
|
||||
)
|
||||
|
||||
|
||||
_OPERATOR = _descriptor.Descriptor(
|
||||
name='Operator',
|
||||
full_name='Mysqlx.Expr.Operator',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='name', full_name='Mysqlx.Expr.Operator.name', index=0,
|
||||
number=1, type=9, cpp_type=9, label=2,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='param', full_name='Mysqlx.Expr.Operator.param', index=1,
|
||||
number=2, type=11, cpp_type=10, label=3,
|
||||
has_default_value=False, default_value=[],
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=986,
|
||||
serialized_end=1044,
|
||||
)
|
||||
|
||||
|
||||
_OBJECT_OBJECTFIELD = _descriptor.Descriptor(
|
||||
name='ObjectField',
|
||||
full_name='Mysqlx.Expr.Object.ObjectField',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='key', full_name='Mysqlx.Expr.Object.ObjectField.key', index=0,
|
||||
number=1, type=9, cpp_type=9, label=2,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='value', full_name='Mysqlx.Expr.Object.ObjectField.value', index=1,
|
||||
number=2, type=11, cpp_type=10, label=2,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=1102,
|
||||
serialized_end=1162,
|
||||
)
|
||||
|
||||
_OBJECT = _descriptor.Descriptor(
|
||||
name='Object',
|
||||
full_name='Mysqlx.Expr.Object',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='fld', full_name='Mysqlx.Expr.Object.fld', index=0,
|
||||
number=1, type=11, cpp_type=10, label=3,
|
||||
has_default_value=False, default_value=[],
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[_OBJECT_OBJECTFIELD, ],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=1046,
|
||||
serialized_end=1162,
|
||||
)
|
||||
|
||||
|
||||
_ARRAY = _descriptor.Descriptor(
|
||||
name='Array',
|
||||
full_name='Mysqlx.Expr.Array',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='value', full_name='Mysqlx.Expr.Array.value', index=0,
|
||||
number=1, type=11, cpp_type=10, label=3,
|
||||
has_default_value=False, default_value=[],
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=1164,
|
||||
serialized_end=1205,
|
||||
)
|
||||
|
||||
_EXPR.fields_by_name['type'].enum_type = _EXPR_TYPE
|
||||
_EXPR.fields_by_name['identifier'].message_type = _COLUMNIDENTIFIER
|
||||
_EXPR.fields_by_name['literal'].message_type = mysqlx__datatypes__pb2._SCALAR
|
||||
_EXPR.fields_by_name['function_call'].message_type = _FUNCTIONCALL
|
||||
_EXPR.fields_by_name['operator'].message_type = _OPERATOR
|
||||
_EXPR.fields_by_name['object'].message_type = _OBJECT
|
||||
_EXPR.fields_by_name['array'].message_type = _ARRAY
|
||||
_EXPR_TYPE.containing_type = _EXPR
|
||||
_DOCUMENTPATHITEM.fields_by_name['type'].enum_type = _DOCUMENTPATHITEM_TYPE
|
||||
_DOCUMENTPATHITEM_TYPE.containing_type = _DOCUMENTPATHITEM
|
||||
_COLUMNIDENTIFIER.fields_by_name['document_path'].message_type = _DOCUMENTPATHITEM
|
||||
_FUNCTIONCALL.fields_by_name['name'].message_type = _IDENTIFIER
|
||||
_FUNCTIONCALL.fields_by_name['param'].message_type = _EXPR
|
||||
_OPERATOR.fields_by_name['param'].message_type = _EXPR
|
||||
_OBJECT_OBJECTFIELD.fields_by_name['value'].message_type = _EXPR
|
||||
_OBJECT_OBJECTFIELD.containing_type = _OBJECT
|
||||
_OBJECT.fields_by_name['fld'].message_type = _OBJECT_OBJECTFIELD
|
||||
_ARRAY.fields_by_name['value'].message_type = _EXPR
|
||||
DESCRIPTOR.message_types_by_name['Expr'] = _EXPR
|
||||
DESCRIPTOR.message_types_by_name['Identifier'] = _IDENTIFIER
|
||||
DESCRIPTOR.message_types_by_name['DocumentPathItem'] = _DOCUMENTPATHITEM
|
||||
DESCRIPTOR.message_types_by_name['ColumnIdentifier'] = _COLUMNIDENTIFIER
|
||||
DESCRIPTOR.message_types_by_name['FunctionCall'] = _FUNCTIONCALL
|
||||
DESCRIPTOR.message_types_by_name['Operator'] = _OPERATOR
|
||||
DESCRIPTOR.message_types_by_name['Object'] = _OBJECT
|
||||
DESCRIPTOR.message_types_by_name['Array'] = _ARRAY
|
||||
|
||||
Expr = _reflection.GeneratedProtocolMessageType('Expr', (_message.Message,), dict(
|
||||
DESCRIPTOR = _EXPR,
|
||||
__module__ = 'mysqlx_expr_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Expr.Expr)
|
||||
))
|
||||
_sym_db.RegisterMessage(Expr)
|
||||
|
||||
Identifier = _reflection.GeneratedProtocolMessageType('Identifier', (_message.Message,), dict(
|
||||
DESCRIPTOR = _IDENTIFIER,
|
||||
__module__ = 'mysqlx_expr_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Expr.Identifier)
|
||||
))
|
||||
_sym_db.RegisterMessage(Identifier)
|
||||
|
||||
DocumentPathItem = _reflection.GeneratedProtocolMessageType('DocumentPathItem', (_message.Message,), dict(
|
||||
DESCRIPTOR = _DOCUMENTPATHITEM,
|
||||
__module__ = 'mysqlx_expr_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Expr.DocumentPathItem)
|
||||
))
|
||||
_sym_db.RegisterMessage(DocumentPathItem)
|
||||
|
||||
ColumnIdentifier = _reflection.GeneratedProtocolMessageType('ColumnIdentifier', (_message.Message,), dict(
|
||||
DESCRIPTOR = _COLUMNIDENTIFIER,
|
||||
__module__ = 'mysqlx_expr_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Expr.ColumnIdentifier)
|
||||
))
|
||||
_sym_db.RegisterMessage(ColumnIdentifier)
|
||||
|
||||
FunctionCall = _reflection.GeneratedProtocolMessageType('FunctionCall', (_message.Message,), dict(
|
||||
DESCRIPTOR = _FUNCTIONCALL,
|
||||
__module__ = 'mysqlx_expr_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Expr.FunctionCall)
|
||||
))
|
||||
_sym_db.RegisterMessage(FunctionCall)
|
||||
|
||||
Operator = _reflection.GeneratedProtocolMessageType('Operator', (_message.Message,), dict(
|
||||
DESCRIPTOR = _OPERATOR,
|
||||
__module__ = 'mysqlx_expr_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Expr.Operator)
|
||||
))
|
||||
_sym_db.RegisterMessage(Operator)
|
||||
|
||||
Object = _reflection.GeneratedProtocolMessageType('Object', (_message.Message,), dict(
|
||||
|
||||
ObjectField = _reflection.GeneratedProtocolMessageType('ObjectField', (_message.Message,), dict(
|
||||
DESCRIPTOR = _OBJECT_OBJECTFIELD,
|
||||
__module__ = 'mysqlx_expr_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Expr.Object.ObjectField)
|
||||
))
|
||||
,
|
||||
DESCRIPTOR = _OBJECT,
|
||||
__module__ = 'mysqlx_expr_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Expr.Object)
|
||||
))
|
||||
_sym_db.RegisterMessage(Object)
|
||||
_sym_db.RegisterMessage(Object.ObjectField)
|
||||
|
||||
Array = _reflection.GeneratedProtocolMessageType('Array', (_message.Message,), dict(
|
||||
DESCRIPTOR = _ARRAY,
|
||||
__module__ = 'mysqlx_expr_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Expr.Array)
|
||||
))
|
||||
_sym_db.RegisterMessage(Array)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\027com.mysql.cj.x.protobufH\003'))
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,523 @@
|
||||
# Copyright (c) 2017, 2020, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: mysqlx_notice.proto
|
||||
|
||||
import sys
|
||||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf import descriptor_pb2
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
from mysqlx.protobuf import mysqlx_datatypes_pb2 as mysqlx__datatypes__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='mysqlx_notice.proto',
|
||||
package='Mysqlx.Notice',
|
||||
syntax='proto2',
|
||||
serialized_pb=_b('\n\x13mysqlx_notice.proto\x12\rMysqlx.Notice\x1a\x16mysqlx_datatypes.proto\"\xff\x01\n\x05\x46rame\x12\x0c\n\x04type\x18\x01 \x02(\r\x12\x31\n\x05scope\x18\x02 \x01(\x0e\x32\x1a.Mysqlx.Notice.Frame.Scope:\x06GLOBAL\x12\x0f\n\x07payload\x18\x03 \x01(\x0c\"\x1e\n\x05Scope\x12\n\n\x06GLOBAL\x10\x01\x12\t\n\x05LOCAL\x10\x02\"\x83\x01\n\x04Type\x12\x0b\n\x07WARNING\x10\x01\x12\x1c\n\x18SESSION_VARIABLE_CHANGED\x10\x02\x12\x19\n\x15SESSION_STATE_CHANGED\x10\x03\x12#\n\x1fGROUP_REPLICATION_STATE_CHANGED\x10\x04\x12\x10\n\x0cSERVER_HELLO\x10\x05\"\x85\x01\n\x07Warning\x12\x34\n\x05level\x18\x01 \x01(\x0e\x32\x1c.Mysqlx.Notice.Warning.Level:\x07WARNING\x12\x0c\n\x04\x63ode\x18\x02 \x02(\r\x12\x0b\n\x03msg\x18\x03 \x02(\t\")\n\x05Level\x12\x08\n\x04NOTE\x10\x01\x12\x0b\n\x07WARNING\x10\x02\x12\t\n\x05\x45RROR\x10\x03\"P\n\x16SessionVariableChanged\x12\r\n\x05param\x18\x01 \x02(\t\x12\'\n\x05value\x18\x02 \x01(\x0b\x32\x18.Mysqlx.Datatypes.Scalar\"\xf1\x02\n\x13SessionStateChanged\x12;\n\x05param\x18\x01 \x02(\x0e\x32,.Mysqlx.Notice.SessionStateChanged.Parameter\x12\'\n\x05value\x18\x02 \x03(\x0b\x32\x18.Mysqlx.Datatypes.Scalar\"\xf3\x01\n\tParameter\x12\x12\n\x0e\x43URRENT_SCHEMA\x10\x01\x12\x13\n\x0f\x41\x43\x43OUNT_EXPIRED\x10\x02\x12\x17\n\x13GENERATED_INSERT_ID\x10\x03\x12\x11\n\rROWS_AFFECTED\x10\x04\x12\x0e\n\nROWS_FOUND\x10\x05\x12\x10\n\x0cROWS_MATCHED\x10\x06\x12\x11\n\rTRX_COMMITTED\x10\x07\x12\x12\n\x0eTRX_ROLLEDBACK\x10\t\x12\x14\n\x10PRODUCED_MESSAGE\x10\n\x12\x16\n\x12\x43LIENT_ID_ASSIGNED\x10\x0b\x12\x1a\n\x16GENERATED_DOCUMENT_IDS\x10\x0c\"\xae\x01\n\x1cGroupReplicationStateChanged\x12\x0c\n\x04type\x18\x01 \x02(\r\x12\x0f\n\x07view_id\x18\x02 \x01(\t\"o\n\x04Type\x12\x1a\n\x16MEMBERSHIP_QUORUM_LOSS\x10\x01\x12\x1a\n\x16MEMBERSHIP_VIEW_CHANGE\x10\x02\x12\x16\n\x12MEMBER_ROLE_CHANGE\x10\x03\x12\x17\n\x13MEMBER_STATE_CHANGE\x10\x04\"\r\n\x0bServerHelloB\x1b\n\x17\x63om.mysql.cj.x.protobufH\x03')
|
||||
,
|
||||
dependencies=[mysqlx__datatypes__pb2.DESCRIPTOR,])
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
_FRAME_SCOPE = _descriptor.EnumDescriptor(
|
||||
name='Scope',
|
||||
full_name='Mysqlx.Notice.Frame.Scope',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='GLOBAL', index=0, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='LOCAL', index=1, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=154,
|
||||
serialized_end=184,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_FRAME_SCOPE)
|
||||
|
||||
_FRAME_TYPE = _descriptor.EnumDescriptor(
|
||||
name='Type',
|
||||
full_name='Mysqlx.Notice.Frame.Type',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='WARNING', index=0, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SESSION_VARIABLE_CHANGED', index=1, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SESSION_STATE_CHANGED', index=2, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='GROUP_REPLICATION_STATE_CHANGED', index=3, number=4,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SERVER_HELLO', index=4, number=5,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=187,
|
||||
serialized_end=318,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_FRAME_TYPE)
|
||||
|
||||
_WARNING_LEVEL = _descriptor.EnumDescriptor(
|
||||
name='Level',
|
||||
full_name='Mysqlx.Notice.Warning.Level',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='NOTE', index=0, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='WARNING', index=1, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ERROR', index=2, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=413,
|
||||
serialized_end=454,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_WARNING_LEVEL)
|
||||
|
||||
_SESSIONSTATECHANGED_PARAMETER = _descriptor.EnumDescriptor(
|
||||
name='Parameter',
|
||||
full_name='Mysqlx.Notice.SessionStateChanged.Parameter',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CURRENT_SCHEMA', index=0, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ACCOUNT_EXPIRED', index=1, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='GENERATED_INSERT_ID', index=2, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ROWS_AFFECTED', index=3, number=4,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ROWS_FOUND', index=4, number=5,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ROWS_MATCHED', index=5, number=6,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='TRX_COMMITTED', index=6, number=7,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='TRX_ROLLEDBACK', index=7, number=9,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='PRODUCED_MESSAGE', index=8, number=10,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CLIENT_ID_ASSIGNED', index=9, number=11,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='GENERATED_DOCUMENT_IDS', index=10, number=12,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=665,
|
||||
serialized_end=908,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_SESSIONSTATECHANGED_PARAMETER)
|
||||
|
||||
_GROUPREPLICATIONSTATECHANGED_TYPE = _descriptor.EnumDescriptor(
|
||||
name='Type',
|
||||
full_name='Mysqlx.Notice.GroupReplicationStateChanged.Type',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='MEMBERSHIP_QUORUM_LOSS', index=0, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='MEMBERSHIP_VIEW_CHANGE', index=1, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='MEMBER_ROLE_CHANGE', index=2, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='MEMBER_STATE_CHANGE', index=3, number=4,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=974,
|
||||
serialized_end=1085,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_GROUPREPLICATIONSTATECHANGED_TYPE)
|
||||
|
||||
|
||||
_FRAME = _descriptor.Descriptor(
|
||||
name='Frame',
|
||||
full_name='Mysqlx.Notice.Frame',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='type', full_name='Mysqlx.Notice.Frame.type', index=0,
|
||||
number=1, type=13, cpp_type=3, label=2,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='scope', full_name='Mysqlx.Notice.Frame.scope', index=1,
|
||||
number=2, type=14, cpp_type=8, label=1,
|
||||
has_default_value=True, default_value=1,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='payload', full_name='Mysqlx.Notice.Frame.payload', index=2,
|
||||
number=3, type=12, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_FRAME_SCOPE,
|
||||
_FRAME_TYPE,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=63,
|
||||
serialized_end=318,
|
||||
)
|
||||
|
||||
|
||||
_WARNING = _descriptor.Descriptor(
|
||||
name='Warning',
|
||||
full_name='Mysqlx.Notice.Warning',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='level', full_name='Mysqlx.Notice.Warning.level', index=0,
|
||||
number=1, type=14, cpp_type=8, label=1,
|
||||
has_default_value=True, default_value=2,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='code', full_name='Mysqlx.Notice.Warning.code', index=1,
|
||||
number=2, type=13, cpp_type=3, label=2,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='msg', full_name='Mysqlx.Notice.Warning.msg', index=2,
|
||||
number=3, type=9, cpp_type=9, label=2,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_WARNING_LEVEL,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=321,
|
||||
serialized_end=454,
|
||||
)
|
||||
|
||||
|
||||
_SESSIONVARIABLECHANGED = _descriptor.Descriptor(
|
||||
name='SessionVariableChanged',
|
||||
full_name='Mysqlx.Notice.SessionVariableChanged',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='param', full_name='Mysqlx.Notice.SessionVariableChanged.param', index=0,
|
||||
number=1, type=9, cpp_type=9, label=2,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='value', full_name='Mysqlx.Notice.SessionVariableChanged.value', index=1,
|
||||
number=2, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=456,
|
||||
serialized_end=536,
|
||||
)
|
||||
|
||||
|
||||
_SESSIONSTATECHANGED = _descriptor.Descriptor(
|
||||
name='SessionStateChanged',
|
||||
full_name='Mysqlx.Notice.SessionStateChanged',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='param', full_name='Mysqlx.Notice.SessionStateChanged.param', index=0,
|
||||
number=1, type=14, cpp_type=8, label=2,
|
||||
has_default_value=False, default_value=1,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='value', full_name='Mysqlx.Notice.SessionStateChanged.value', index=1,
|
||||
number=2, type=11, cpp_type=10, label=3,
|
||||
has_default_value=False, default_value=[],
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_SESSIONSTATECHANGED_PARAMETER,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=539,
|
||||
serialized_end=908,
|
||||
)
|
||||
|
||||
|
||||
_GROUPREPLICATIONSTATECHANGED = _descriptor.Descriptor(
|
||||
name='GroupReplicationStateChanged',
|
||||
full_name='Mysqlx.Notice.GroupReplicationStateChanged',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='type', full_name='Mysqlx.Notice.GroupReplicationStateChanged.type', index=0,
|
||||
number=1, type=13, cpp_type=3, label=2,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='view_id', full_name='Mysqlx.Notice.GroupReplicationStateChanged.view_id', index=1,
|
||||
number=2, type=9, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_GROUPREPLICATIONSTATECHANGED_TYPE,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=911,
|
||||
serialized_end=1085,
|
||||
)
|
||||
|
||||
|
||||
_SERVERHELLO = _descriptor.Descriptor(
|
||||
name='ServerHello',
|
||||
full_name='Mysqlx.Notice.ServerHello',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=1087,
|
||||
serialized_end=1100,
|
||||
)
|
||||
|
||||
_FRAME.fields_by_name['scope'].enum_type = _FRAME_SCOPE
|
||||
_FRAME_SCOPE.containing_type = _FRAME
|
||||
_FRAME_TYPE.containing_type = _FRAME
|
||||
_WARNING.fields_by_name['level'].enum_type = _WARNING_LEVEL
|
||||
_WARNING_LEVEL.containing_type = _WARNING
|
||||
_SESSIONVARIABLECHANGED.fields_by_name['value'].message_type = mysqlx__datatypes__pb2._SCALAR
|
||||
_SESSIONSTATECHANGED.fields_by_name['param'].enum_type = _SESSIONSTATECHANGED_PARAMETER
|
||||
_SESSIONSTATECHANGED.fields_by_name['value'].message_type = mysqlx__datatypes__pb2._SCALAR
|
||||
_SESSIONSTATECHANGED_PARAMETER.containing_type = _SESSIONSTATECHANGED
|
||||
_GROUPREPLICATIONSTATECHANGED_TYPE.containing_type = _GROUPREPLICATIONSTATECHANGED
|
||||
DESCRIPTOR.message_types_by_name['Frame'] = _FRAME
|
||||
DESCRIPTOR.message_types_by_name['Warning'] = _WARNING
|
||||
DESCRIPTOR.message_types_by_name['SessionVariableChanged'] = _SESSIONVARIABLECHANGED
|
||||
DESCRIPTOR.message_types_by_name['SessionStateChanged'] = _SESSIONSTATECHANGED
|
||||
DESCRIPTOR.message_types_by_name['GroupReplicationStateChanged'] = _GROUPREPLICATIONSTATECHANGED
|
||||
DESCRIPTOR.message_types_by_name['ServerHello'] = _SERVERHELLO
|
||||
|
||||
Frame = _reflection.GeneratedProtocolMessageType('Frame', (_message.Message,), dict(
|
||||
DESCRIPTOR = _FRAME,
|
||||
__module__ = 'mysqlx_notice_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Notice.Frame)
|
||||
))
|
||||
_sym_db.RegisterMessage(Frame)
|
||||
|
||||
Warning = _reflection.GeneratedProtocolMessageType('Warning', (_message.Message,), dict(
|
||||
DESCRIPTOR = _WARNING,
|
||||
__module__ = 'mysqlx_notice_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Notice.Warning)
|
||||
))
|
||||
_sym_db.RegisterMessage(Warning)
|
||||
|
||||
SessionVariableChanged = _reflection.GeneratedProtocolMessageType('SessionVariableChanged', (_message.Message,), dict(
|
||||
DESCRIPTOR = _SESSIONVARIABLECHANGED,
|
||||
__module__ = 'mysqlx_notice_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Notice.SessionVariableChanged)
|
||||
))
|
||||
_sym_db.RegisterMessage(SessionVariableChanged)
|
||||
|
||||
SessionStateChanged = _reflection.GeneratedProtocolMessageType('SessionStateChanged', (_message.Message,), dict(
|
||||
DESCRIPTOR = _SESSIONSTATECHANGED,
|
||||
__module__ = 'mysqlx_notice_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Notice.SessionStateChanged)
|
||||
))
|
||||
_sym_db.RegisterMessage(SessionStateChanged)
|
||||
|
||||
GroupReplicationStateChanged = _reflection.GeneratedProtocolMessageType('GroupReplicationStateChanged', (_message.Message,), dict(
|
||||
DESCRIPTOR = _GROUPREPLICATIONSTATECHANGED,
|
||||
__module__ = 'mysqlx_notice_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Notice.GroupReplicationStateChanged)
|
||||
))
|
||||
_sym_db.RegisterMessage(GroupReplicationStateChanged)
|
||||
|
||||
ServerHello = _reflection.GeneratedProtocolMessageType('ServerHello', (_message.Message,), dict(
|
||||
DESCRIPTOR = _SERVERHELLO,
|
||||
__module__ = 'mysqlx_notice_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Notice.ServerHello)
|
||||
))
|
||||
_sym_db.RegisterMessage(ServerHello)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\027com.mysql.cj.x.protobufH\003'))
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,432 @@
|
||||
# Copyright (c) 2017, 2020, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: mysqlx.proto
|
||||
|
||||
import sys
|
||||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf import descriptor_pb2
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='mysqlx.proto',
|
||||
package='Mysqlx',
|
||||
syntax='proto2',
|
||||
serialized_pb=_b('\n\x0cmysqlx.proto\x12\x06Mysqlx\"\xfc\x03\n\x0e\x43lientMessages\"\xe9\x03\n\x04Type\x12\x18\n\x14\x43ON_CAPABILITIES_GET\x10\x01\x12\x18\n\x14\x43ON_CAPABILITIES_SET\x10\x02\x12\r\n\tCON_CLOSE\x10\x03\x12\x1b\n\x17SESS_AUTHENTICATE_START\x10\x04\x12\x1e\n\x1aSESS_AUTHENTICATE_CONTINUE\x10\x05\x12\x0e\n\nSESS_RESET\x10\x06\x12\x0e\n\nSESS_CLOSE\x10\x07\x12\x14\n\x10SQL_STMT_EXECUTE\x10\x0c\x12\r\n\tCRUD_FIND\x10\x11\x12\x0f\n\x0b\x43RUD_INSERT\x10\x12\x12\x0f\n\x0b\x43RUD_UPDATE\x10\x13\x12\x0f\n\x0b\x43RUD_DELETE\x10\x14\x12\x0f\n\x0b\x45XPECT_OPEN\x10\x18\x12\x10\n\x0c\x45XPECT_CLOSE\x10\x19\x12\x14\n\x10\x43RUD_CREATE_VIEW\x10\x1e\x12\x14\n\x10\x43RUD_MODIFY_VIEW\x10\x1f\x12\x12\n\x0e\x43RUD_DROP_VIEW\x10 \x12\x13\n\x0fPREPARE_PREPARE\x10(\x12\x13\n\x0fPREPARE_EXECUTE\x10)\x12\x16\n\x12PREPARE_DEALLOCATE\x10*\x12\x0f\n\x0b\x43URSOR_OPEN\x10+\x12\x10\n\x0c\x43URSOR_CLOSE\x10,\x12\x10\n\x0c\x43URSOR_FETCH\x10-\x12\x0f\n\x0b\x43OMPRESSION\x10.\"\xf3\x02\n\x0eServerMessages\"\xe0\x02\n\x04Type\x12\x06\n\x02OK\x10\x00\x12\t\n\x05\x45RROR\x10\x01\x12\x15\n\x11\x43ONN_CAPABILITIES\x10\x02\x12\x1e\n\x1aSESS_AUTHENTICATE_CONTINUE\x10\x03\x12\x18\n\x14SESS_AUTHENTICATE_OK\x10\x04\x12\n\n\x06NOTICE\x10\x0b\x12\x1e\n\x1aRESULTSET_COLUMN_META_DATA\x10\x0c\x12\x11\n\rRESULTSET_ROW\x10\r\x12\x18\n\x14RESULTSET_FETCH_DONE\x10\x0e\x12\x1d\n\x19RESULTSET_FETCH_SUSPENDED\x10\x0f\x12(\n$RESULTSET_FETCH_DONE_MORE_RESULTSETS\x10\x10\x12\x17\n\x13SQL_STMT_EXECUTE_OK\x10\x11\x12(\n$RESULTSET_FETCH_DONE_MORE_OUT_PARAMS\x10\x12\x12\x0f\n\x0b\x43OMPRESSION\x10\x13\"\x11\n\x02Ok\x12\x0b\n\x03msg\x18\x01 \x01(\t\"\x88\x01\n\x05\x45rror\x12/\n\x08severity\x18\x01 \x01(\x0e\x32\x16.Mysqlx.Error.Severity:\x05\x45RROR\x12\x0c\n\x04\x63ode\x18\x02 \x02(\r\x12\x11\n\tsql_state\x18\x04 \x02(\t\x12\x0b\n\x03msg\x18\x03 \x02(\t\" \n\x08Severity\x12\t\n\x05\x45RROR\x10\x00\x12\t\n\x05\x46\x41TAL\x10\x01\x42\x1b\n\x17\x63om.mysql.cj.x.protobufH\x03')
|
||||
)
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
_CLIENTMESSAGES_TYPE = _descriptor.EnumDescriptor(
|
||||
name='Type',
|
||||
full_name='Mysqlx.ClientMessages.Type',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CON_CAPABILITIES_GET', index=0, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CON_CAPABILITIES_SET', index=1, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CON_CLOSE', index=2, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SESS_AUTHENTICATE_START', index=3, number=4,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SESS_AUTHENTICATE_CONTINUE', index=4, number=5,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SESS_RESET', index=5, number=6,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SESS_CLOSE', index=6, number=7,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SQL_STMT_EXECUTE', index=7, number=12,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CRUD_FIND', index=8, number=17,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CRUD_INSERT', index=9, number=18,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CRUD_UPDATE', index=10, number=19,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CRUD_DELETE', index=11, number=20,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='EXPECT_OPEN', index=12, number=24,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='EXPECT_CLOSE', index=13, number=25,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CRUD_CREATE_VIEW', index=14, number=30,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CRUD_MODIFY_VIEW', index=15, number=31,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CRUD_DROP_VIEW', index=16, number=32,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='PREPARE_PREPARE', index=17, number=40,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='PREPARE_EXECUTE', index=18, number=41,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='PREPARE_DEALLOCATE', index=19, number=42,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CURSOR_OPEN', index=20, number=43,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CURSOR_CLOSE', index=21, number=44,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CURSOR_FETCH', index=22, number=45,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='COMPRESSION', index=23, number=46,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=44,
|
||||
serialized_end=533,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_CLIENTMESSAGES_TYPE)
|
||||
|
||||
_SERVERMESSAGES_TYPE = _descriptor.EnumDescriptor(
|
||||
name='Type',
|
||||
full_name='Mysqlx.ServerMessages.Type',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='OK', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ERROR', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CONN_CAPABILITIES', index=2, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SESS_AUTHENTICATE_CONTINUE', index=3, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SESS_AUTHENTICATE_OK', index=4, number=4,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='NOTICE', index=5, number=11,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='RESULTSET_COLUMN_META_DATA', index=6, number=12,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='RESULTSET_ROW', index=7, number=13,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='RESULTSET_FETCH_DONE', index=8, number=14,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='RESULTSET_FETCH_SUSPENDED', index=9, number=15,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='RESULTSET_FETCH_DONE_MORE_RESULTSETS', index=10, number=16,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SQL_STMT_EXECUTE_OK', index=11, number=17,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='RESULTSET_FETCH_DONE_MORE_OUT_PARAMS', index=12, number=18,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='COMPRESSION', index=13, number=19,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=555,
|
||||
serialized_end=907,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_SERVERMESSAGES_TYPE)
|
||||
|
||||
_ERROR_SEVERITY = _descriptor.EnumDescriptor(
|
||||
name='Severity',
|
||||
full_name='Mysqlx.Error.Severity',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ERROR', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='FATAL', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=1033,
|
||||
serialized_end=1065,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_ERROR_SEVERITY)
|
||||
|
||||
|
||||
_CLIENTMESSAGES = _descriptor.Descriptor(
|
||||
name='ClientMessages',
|
||||
full_name='Mysqlx.ClientMessages',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_CLIENTMESSAGES_TYPE,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=25,
|
||||
serialized_end=533,
|
||||
)
|
||||
|
||||
|
||||
_SERVERMESSAGES = _descriptor.Descriptor(
|
||||
name='ServerMessages',
|
||||
full_name='Mysqlx.ServerMessages',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_SERVERMESSAGES_TYPE,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=536,
|
||||
serialized_end=907,
|
||||
)
|
||||
|
||||
|
||||
_OK = _descriptor.Descriptor(
|
||||
name='Ok',
|
||||
full_name='Mysqlx.Ok',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='msg', full_name='Mysqlx.Ok.msg', index=0,
|
||||
number=1, type=9, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=909,
|
||||
serialized_end=926,
|
||||
)
|
||||
|
||||
|
||||
_ERROR = _descriptor.Descriptor(
|
||||
name='Error',
|
||||
full_name='Mysqlx.Error',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='severity', full_name='Mysqlx.Error.severity', index=0,
|
||||
number=1, type=14, cpp_type=8, label=1,
|
||||
has_default_value=True, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='code', full_name='Mysqlx.Error.code', index=1,
|
||||
number=2, type=13, cpp_type=3, label=2,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='sql_state', full_name='Mysqlx.Error.sql_state', index=2,
|
||||
number=4, type=9, cpp_type=9, label=2,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='msg', full_name='Mysqlx.Error.msg', index=3,
|
||||
number=3, type=9, cpp_type=9, label=2,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_ERROR_SEVERITY,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=929,
|
||||
serialized_end=1065,
|
||||
)
|
||||
|
||||
_CLIENTMESSAGES_TYPE.containing_type = _CLIENTMESSAGES
|
||||
_SERVERMESSAGES_TYPE.containing_type = _SERVERMESSAGES
|
||||
_ERROR.fields_by_name['severity'].enum_type = _ERROR_SEVERITY
|
||||
_ERROR_SEVERITY.containing_type = _ERROR
|
||||
DESCRIPTOR.message_types_by_name['ClientMessages'] = _CLIENTMESSAGES
|
||||
DESCRIPTOR.message_types_by_name['ServerMessages'] = _SERVERMESSAGES
|
||||
DESCRIPTOR.message_types_by_name['Ok'] = _OK
|
||||
DESCRIPTOR.message_types_by_name['Error'] = _ERROR
|
||||
|
||||
ClientMessages = _reflection.GeneratedProtocolMessageType('ClientMessages', (_message.Message,), dict(
|
||||
DESCRIPTOR = _CLIENTMESSAGES,
|
||||
__module__ = 'mysqlx_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.ClientMessages)
|
||||
))
|
||||
_sym_db.RegisterMessage(ClientMessages)
|
||||
|
||||
ServerMessages = _reflection.GeneratedProtocolMessageType('ServerMessages', (_message.Message,), dict(
|
||||
DESCRIPTOR = _SERVERMESSAGES,
|
||||
__module__ = 'mysqlx_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.ServerMessages)
|
||||
))
|
||||
_sym_db.RegisterMessage(ServerMessages)
|
||||
|
||||
Ok = _reflection.GeneratedProtocolMessageType('Ok', (_message.Message,), dict(
|
||||
DESCRIPTOR = _OK,
|
||||
__module__ = 'mysqlx_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Ok)
|
||||
))
|
||||
_sym_db.RegisterMessage(Ok)
|
||||
|
||||
Error = _reflection.GeneratedProtocolMessageType('Error', (_message.Message,), dict(
|
||||
DESCRIPTOR = _ERROR,
|
||||
__module__ = 'mysqlx_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Error)
|
||||
))
|
||||
_sym_db.RegisterMessage(Error)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\027com.mysql.cj.x.protobufH\003'))
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,320 @@
|
||||
# Copyright (c) 2017, 2020, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: mysqlx_prepare.proto
|
||||
|
||||
import sys
|
||||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf import descriptor_pb2
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
from mysqlx.protobuf import mysqlx_sql_pb2 as mysqlx__sql__pb2
|
||||
from mysqlx.protobuf import mysqlx_crud_pb2 as mysqlx__crud__pb2
|
||||
from mysqlx.protobuf import mysqlx_datatypes_pb2 as mysqlx__datatypes__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='mysqlx_prepare.proto',
|
||||
package='Mysqlx.Prepare',
|
||||
syntax='proto2',
|
||||
serialized_pb=_b('\n\x14mysqlx_prepare.proto\x12\x0eMysqlx.Prepare\x1a\x10mysqlx_sql.proto\x1a\x11mysqlx_crud.proto\x1a\x16mysqlx_datatypes.proto\"\x97\x03\n\x07Prepare\x12\x0f\n\x07stmt_id\x18\x01 \x02(\r\x12\x32\n\x04stmt\x18\x02 \x02(\x0b\x32$.Mysqlx.Prepare.Prepare.OneOfMessage\x1a\xc6\x02\n\x0cOneOfMessage\x12\x37\n\x04type\x18\x01 \x02(\x0e\x32).Mysqlx.Prepare.Prepare.OneOfMessage.Type\x12\x1f\n\x04\x66ind\x18\x02 \x01(\x0b\x32\x11.Mysqlx.Crud.Find\x12#\n\x06insert\x18\x03 \x01(\x0b\x32\x13.Mysqlx.Crud.Insert\x12#\n\x06update\x18\x04 \x01(\x0b\x32\x13.Mysqlx.Crud.Update\x12#\n\x06\x64\x65lete\x18\x05 \x01(\x0b\x32\x13.Mysqlx.Crud.Delete\x12-\n\x0cstmt_execute\x18\x06 \x01(\x0b\x32\x17.Mysqlx.Sql.StmtExecute\">\n\x04Type\x12\x08\n\x04\x46IND\x10\x00\x12\n\n\x06INSERT\x10\x01\x12\n\n\x06UPDATE\x10\x02\x12\n\n\x06\x44\x45LETE\x10\x04\x12\x08\n\x04STMT\x10\x05\"`\n\x07\x45xecute\x12\x0f\n\x07stmt_id\x18\x01 \x02(\r\x12#\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\x15.Mysqlx.Datatypes.Any\x12\x1f\n\x10\x63ompact_metadata\x18\x03 \x01(\x08:\x05\x66\x61lse\"\x1d\n\nDeallocate\x12\x0f\n\x07stmt_id\x18\x01 \x02(\rB\x1b\n\x17\x63om.mysql.cj.x.protobufH\x03')
|
||||
,
|
||||
dependencies=[mysqlx__sql__pb2.DESCRIPTOR,mysqlx__crud__pb2.DESCRIPTOR,mysqlx__datatypes__pb2.DESCRIPTOR,])
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
_PREPARE_ONEOFMESSAGE_TYPE = _descriptor.EnumDescriptor(
|
||||
name='Type',
|
||||
full_name='Mysqlx.Prepare.Prepare.OneOfMessage.Type',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='FIND', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='INSERT', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='UPDATE', index=2, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='DELETE', index=3, number=4,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='STMT', index=4, number=5,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=447,
|
||||
serialized_end=509,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_PREPARE_ONEOFMESSAGE_TYPE)
|
||||
|
||||
|
||||
_PREPARE_ONEOFMESSAGE = _descriptor.Descriptor(
|
||||
name='OneOfMessage',
|
||||
full_name='Mysqlx.Prepare.Prepare.OneOfMessage',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='type', full_name='Mysqlx.Prepare.Prepare.OneOfMessage.type', index=0,
|
||||
number=1, type=14, cpp_type=8, label=2,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='find', full_name='Mysqlx.Prepare.Prepare.OneOfMessage.find', index=1,
|
||||
number=2, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='insert', full_name='Mysqlx.Prepare.Prepare.OneOfMessage.insert', index=2,
|
||||
number=3, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='update', full_name='Mysqlx.Prepare.Prepare.OneOfMessage.update', index=3,
|
||||
number=4, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='delete', full_name='Mysqlx.Prepare.Prepare.OneOfMessage.delete', index=4,
|
||||
number=5, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='stmt_execute', full_name='Mysqlx.Prepare.Prepare.OneOfMessage.stmt_execute', index=5,
|
||||
number=6, type=11, cpp_type=10, label=1,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_PREPARE_ONEOFMESSAGE_TYPE,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=183,
|
||||
serialized_end=509,
|
||||
)
|
||||
|
||||
_PREPARE = _descriptor.Descriptor(
|
||||
name='Prepare',
|
||||
full_name='Mysqlx.Prepare.Prepare',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='stmt_id', full_name='Mysqlx.Prepare.Prepare.stmt_id', index=0,
|
||||
number=1, type=13, cpp_type=3, label=2,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='stmt', full_name='Mysqlx.Prepare.Prepare.stmt', index=1,
|
||||
number=2, type=11, cpp_type=10, label=2,
|
||||
has_default_value=False, default_value=None,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[_PREPARE_ONEOFMESSAGE, ],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=102,
|
||||
serialized_end=509,
|
||||
)
|
||||
|
||||
|
||||
_EXECUTE = _descriptor.Descriptor(
|
||||
name='Execute',
|
||||
full_name='Mysqlx.Prepare.Execute',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='stmt_id', full_name='Mysqlx.Prepare.Execute.stmt_id', index=0,
|
||||
number=1, type=13, cpp_type=3, label=2,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='args', full_name='Mysqlx.Prepare.Execute.args', index=1,
|
||||
number=2, type=11, cpp_type=10, label=3,
|
||||
has_default_value=False, default_value=[],
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='compact_metadata', full_name='Mysqlx.Prepare.Execute.compact_metadata', index=2,
|
||||
number=3, type=8, cpp_type=7, label=1,
|
||||
has_default_value=True, default_value=False,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=511,
|
||||
serialized_end=607,
|
||||
)
|
||||
|
||||
|
||||
_DEALLOCATE = _descriptor.Descriptor(
|
||||
name='Deallocate',
|
||||
full_name='Mysqlx.Prepare.Deallocate',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='stmt_id', full_name='Mysqlx.Prepare.Deallocate.stmt_id', index=0,
|
||||
number=1, type=13, cpp_type=3, label=2,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=609,
|
||||
serialized_end=638,
|
||||
)
|
||||
|
||||
_PREPARE_ONEOFMESSAGE.fields_by_name['type'].enum_type = _PREPARE_ONEOFMESSAGE_TYPE
|
||||
_PREPARE_ONEOFMESSAGE.fields_by_name['find'].message_type = mysqlx__crud__pb2._FIND
|
||||
_PREPARE_ONEOFMESSAGE.fields_by_name['insert'].message_type = mysqlx__crud__pb2._INSERT
|
||||
_PREPARE_ONEOFMESSAGE.fields_by_name['update'].message_type = mysqlx__crud__pb2._UPDATE
|
||||
_PREPARE_ONEOFMESSAGE.fields_by_name['delete'].message_type = mysqlx__crud__pb2._DELETE
|
||||
_PREPARE_ONEOFMESSAGE.fields_by_name['stmt_execute'].message_type = mysqlx__sql__pb2._STMTEXECUTE
|
||||
_PREPARE_ONEOFMESSAGE.containing_type = _PREPARE
|
||||
_PREPARE_ONEOFMESSAGE_TYPE.containing_type = _PREPARE_ONEOFMESSAGE
|
||||
_PREPARE.fields_by_name['stmt'].message_type = _PREPARE_ONEOFMESSAGE
|
||||
_EXECUTE.fields_by_name['args'].message_type = mysqlx__datatypes__pb2._ANY
|
||||
DESCRIPTOR.message_types_by_name['Prepare'] = _PREPARE
|
||||
DESCRIPTOR.message_types_by_name['Execute'] = _EXECUTE
|
||||
DESCRIPTOR.message_types_by_name['Deallocate'] = _DEALLOCATE
|
||||
|
||||
Prepare = _reflection.GeneratedProtocolMessageType('Prepare', (_message.Message,), dict(
|
||||
|
||||
OneOfMessage = _reflection.GeneratedProtocolMessageType('OneOfMessage', (_message.Message,), dict(
|
||||
DESCRIPTOR = _PREPARE_ONEOFMESSAGE,
|
||||
__module__ = 'mysqlx_prepare_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Prepare.Prepare.OneOfMessage)
|
||||
))
|
||||
,
|
||||
DESCRIPTOR = _PREPARE,
|
||||
__module__ = 'mysqlx_prepare_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Prepare.Prepare)
|
||||
))
|
||||
_sym_db.RegisterMessage(Prepare)
|
||||
_sym_db.RegisterMessage(Prepare.OneOfMessage)
|
||||
|
||||
Execute = _reflection.GeneratedProtocolMessageType('Execute', (_message.Message,), dict(
|
||||
DESCRIPTOR = _EXECUTE,
|
||||
__module__ = 'mysqlx_prepare_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Prepare.Execute)
|
||||
))
|
||||
_sym_db.RegisterMessage(Execute)
|
||||
|
||||
Deallocate = _reflection.GeneratedProtocolMessageType('Deallocate', (_message.Message,), dict(
|
||||
DESCRIPTOR = _DEALLOCATE,
|
||||
__module__ = 'mysqlx_prepare_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Prepare.Deallocate)
|
||||
))
|
||||
_sym_db.RegisterMessage(Deallocate)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\027com.mysql.cj.x.protobufH\003'))
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,462 @@
|
||||
# Copyright (c) 2017, 2020, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: mysqlx_resultset.proto
|
||||
|
||||
import sys
|
||||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
||||
from google.protobuf.internal import enum_type_wrapper
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf import descriptor_pb2
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='mysqlx_resultset.proto',
|
||||
package='Mysqlx.Resultset',
|
||||
syntax='proto2',
|
||||
serialized_pb=_b('\n\x16mysqlx_resultset.proto\x12\x10Mysqlx.Resultset\"\x18\n\x16\x46\x65tchDoneMoreOutParams\"\x19\n\x17\x46\x65tchDoneMoreResultsets\"\x0b\n\tFetchDone\"\x10\n\x0e\x46\x65tchSuspended\"\x9f\x03\n\x0e\x43olumnMetaData\x12\x38\n\x04type\x18\x01 \x02(\x0e\x32*.Mysqlx.Resultset.ColumnMetaData.FieldType\x12\x0c\n\x04name\x18\x02 \x01(\x0c\x12\x15\n\roriginal_name\x18\x03 \x01(\x0c\x12\r\n\x05table\x18\x04 \x01(\x0c\x12\x16\n\x0eoriginal_table\x18\x05 \x01(\x0c\x12\x0e\n\x06schema\x18\x06 \x01(\x0c\x12\x0f\n\x07\x63\x61talog\x18\x07 \x01(\x0c\x12\x11\n\tcollation\x18\x08 \x01(\x04\x12\x19\n\x11\x66ractional_digits\x18\t \x01(\r\x12\x0e\n\x06length\x18\n \x01(\r\x12\r\n\x05\x66lags\x18\x0b \x01(\r\x12\x14\n\x0c\x63ontent_type\x18\x0c \x01(\r\"\x82\x01\n\tFieldType\x12\x08\n\x04SINT\x10\x01\x12\x08\n\x04UINT\x10\x02\x12\n\n\x06\x44OUBLE\x10\x05\x12\t\n\x05\x46LOAT\x10\x06\x12\t\n\x05\x42YTES\x10\x07\x12\x08\n\x04TIME\x10\n\x12\x0c\n\x08\x44\x41TETIME\x10\x0c\x12\x07\n\x03SET\x10\x0f\x12\x08\n\x04\x45NUM\x10\x10\x12\x07\n\x03\x42IT\x10\x11\x12\x0b\n\x07\x44\x45\x43IMAL\x10\x12\"\x14\n\x03Row\x12\r\n\x05\x66ield\x18\x01 \x03(\x0c*4\n\x11\x43ontentType_BYTES\x12\x0c\n\x08GEOMETRY\x10\x01\x12\x08\n\x04JSON\x10\x02\x12\x07\n\x03XML\x10\x03*.\n\x14\x43ontentType_DATETIME\x12\x08\n\x04\x44\x41TE\x10\x01\x12\x0c\n\x08\x44\x41TETIME\x10\x02\x42\x1b\n\x17\x63om.mysql.cj.x.protobufH\x03')
|
||||
)
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
_CONTENTTYPE_BYTES = _descriptor.EnumDescriptor(
|
||||
name='ContentType_BYTES',
|
||||
full_name='Mysqlx.Resultset.ContentType_BYTES',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='GEOMETRY', index=0, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='JSON', index=1, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='XML', index=2, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=568,
|
||||
serialized_end=620,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_CONTENTTYPE_BYTES)
|
||||
|
||||
ContentType_BYTES = enum_type_wrapper.EnumTypeWrapper(_CONTENTTYPE_BYTES)
|
||||
_CONTENTTYPE_DATETIME = _descriptor.EnumDescriptor(
|
||||
name='ContentType_DATETIME',
|
||||
full_name='Mysqlx.Resultset.ContentType_DATETIME',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='DATE', index=0, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='DATETIME', index=1, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=622,
|
||||
serialized_end=668,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_CONTENTTYPE_DATETIME)
|
||||
|
||||
ContentType_DATETIME = enum_type_wrapper.EnumTypeWrapper(_CONTENTTYPE_DATETIME)
|
||||
GEOMETRY = 1
|
||||
JSON = 2
|
||||
XML = 3
|
||||
DATE = 1
|
||||
DATETIME = 2
|
||||
|
||||
|
||||
_COLUMNMETADATA_FIELDTYPE = _descriptor.EnumDescriptor(
|
||||
name='FieldType',
|
||||
full_name='Mysqlx.Resultset.ColumnMetaData.FieldType',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SINT', index=0, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='UINT', index=1, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='DOUBLE', index=2, number=5,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='FLOAT', index=3, number=6,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='BYTES', index=4, number=7,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='TIME', index=5, number=10,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='DATETIME', index=6, number=12,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SET', index=7, number=15,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ENUM', index=8, number=16,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='BIT', index=9, number=17,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='DECIMAL', index=10, number=18,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=414,
|
||||
serialized_end=544,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_COLUMNMETADATA_FIELDTYPE)
|
||||
|
||||
|
||||
_FETCHDONEMOREOUTPARAMS = _descriptor.Descriptor(
|
||||
name='FetchDoneMoreOutParams',
|
||||
full_name='Mysqlx.Resultset.FetchDoneMoreOutParams',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=44,
|
||||
serialized_end=68,
|
||||
)
|
||||
|
||||
|
||||
_FETCHDONEMORERESULTSETS = _descriptor.Descriptor(
|
||||
name='FetchDoneMoreResultsets',
|
||||
full_name='Mysqlx.Resultset.FetchDoneMoreResultsets',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=70,
|
||||
serialized_end=95,
|
||||
)
|
||||
|
||||
|
||||
_FETCHDONE = _descriptor.Descriptor(
|
||||
name='FetchDone',
|
||||
full_name='Mysqlx.Resultset.FetchDone',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=97,
|
||||
serialized_end=108,
|
||||
)
|
||||
|
||||
|
||||
_FETCHSUSPENDED = _descriptor.Descriptor(
|
||||
name='FetchSuspended',
|
||||
full_name='Mysqlx.Resultset.FetchSuspended',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=110,
|
||||
serialized_end=126,
|
||||
)
|
||||
|
||||
|
||||
_COLUMNMETADATA = _descriptor.Descriptor(
|
||||
name='ColumnMetaData',
|
||||
full_name='Mysqlx.Resultset.ColumnMetaData',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='type', full_name='Mysqlx.Resultset.ColumnMetaData.type', index=0,
|
||||
number=1, type=14, cpp_type=8, label=2,
|
||||
has_default_value=False, default_value=1,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='name', full_name='Mysqlx.Resultset.ColumnMetaData.name', index=1,
|
||||
number=2, type=12, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='original_name', full_name='Mysqlx.Resultset.ColumnMetaData.original_name', index=2,
|
||||
number=3, type=12, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='table', full_name='Mysqlx.Resultset.ColumnMetaData.table', index=3,
|
||||
number=4, type=12, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='original_table', full_name='Mysqlx.Resultset.ColumnMetaData.original_table', index=4,
|
||||
number=5, type=12, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='schema', full_name='Mysqlx.Resultset.ColumnMetaData.schema', index=5,
|
||||
number=6, type=12, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='catalog', full_name='Mysqlx.Resultset.ColumnMetaData.catalog', index=6,
|
||||
number=7, type=12, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='collation', full_name='Mysqlx.Resultset.ColumnMetaData.collation', index=7,
|
||||
number=8, type=4, cpp_type=4, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='fractional_digits', full_name='Mysqlx.Resultset.ColumnMetaData.fractional_digits', index=8,
|
||||
number=9, type=13, cpp_type=3, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='length', full_name='Mysqlx.Resultset.ColumnMetaData.length', index=9,
|
||||
number=10, type=13, cpp_type=3, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='flags', full_name='Mysqlx.Resultset.ColumnMetaData.flags', index=10,
|
||||
number=11, type=13, cpp_type=3, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='content_type', full_name='Mysqlx.Resultset.ColumnMetaData.content_type', index=11,
|
||||
number=12, type=13, cpp_type=3, label=1,
|
||||
has_default_value=False, default_value=0,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_COLUMNMETADATA_FIELDTYPE,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=129,
|
||||
serialized_end=544,
|
||||
)
|
||||
|
||||
|
||||
_ROW = _descriptor.Descriptor(
|
||||
name='Row',
|
||||
full_name='Mysqlx.Resultset.Row',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='field', full_name='Mysqlx.Resultset.Row.field', index=0,
|
||||
number=1, type=12, cpp_type=9, label=3,
|
||||
has_default_value=False, default_value=[],
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=546,
|
||||
serialized_end=566,
|
||||
)
|
||||
|
||||
_COLUMNMETADATA.fields_by_name['type'].enum_type = _COLUMNMETADATA_FIELDTYPE
|
||||
_COLUMNMETADATA_FIELDTYPE.containing_type = _COLUMNMETADATA
|
||||
DESCRIPTOR.message_types_by_name['FetchDoneMoreOutParams'] = _FETCHDONEMOREOUTPARAMS
|
||||
DESCRIPTOR.message_types_by_name['FetchDoneMoreResultsets'] = _FETCHDONEMORERESULTSETS
|
||||
DESCRIPTOR.message_types_by_name['FetchDone'] = _FETCHDONE
|
||||
DESCRIPTOR.message_types_by_name['FetchSuspended'] = _FETCHSUSPENDED
|
||||
DESCRIPTOR.message_types_by_name['ColumnMetaData'] = _COLUMNMETADATA
|
||||
DESCRIPTOR.message_types_by_name['Row'] = _ROW
|
||||
DESCRIPTOR.enum_types_by_name['ContentType_BYTES'] = _CONTENTTYPE_BYTES
|
||||
DESCRIPTOR.enum_types_by_name['ContentType_DATETIME'] = _CONTENTTYPE_DATETIME
|
||||
|
||||
FetchDoneMoreOutParams = _reflection.GeneratedProtocolMessageType('FetchDoneMoreOutParams', (_message.Message,), dict(
|
||||
DESCRIPTOR = _FETCHDONEMOREOUTPARAMS,
|
||||
__module__ = 'mysqlx_resultset_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Resultset.FetchDoneMoreOutParams)
|
||||
))
|
||||
_sym_db.RegisterMessage(FetchDoneMoreOutParams)
|
||||
|
||||
FetchDoneMoreResultsets = _reflection.GeneratedProtocolMessageType('FetchDoneMoreResultsets', (_message.Message,), dict(
|
||||
DESCRIPTOR = _FETCHDONEMORERESULTSETS,
|
||||
__module__ = 'mysqlx_resultset_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Resultset.FetchDoneMoreResultsets)
|
||||
))
|
||||
_sym_db.RegisterMessage(FetchDoneMoreResultsets)
|
||||
|
||||
FetchDone = _reflection.GeneratedProtocolMessageType('FetchDone', (_message.Message,), dict(
|
||||
DESCRIPTOR = _FETCHDONE,
|
||||
__module__ = 'mysqlx_resultset_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Resultset.FetchDone)
|
||||
))
|
||||
_sym_db.RegisterMessage(FetchDone)
|
||||
|
||||
FetchSuspended = _reflection.GeneratedProtocolMessageType('FetchSuspended', (_message.Message,), dict(
|
||||
DESCRIPTOR = _FETCHSUSPENDED,
|
||||
__module__ = 'mysqlx_resultset_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Resultset.FetchSuspended)
|
||||
))
|
||||
_sym_db.RegisterMessage(FetchSuspended)
|
||||
|
||||
ColumnMetaData = _reflection.GeneratedProtocolMessageType('ColumnMetaData', (_message.Message,), dict(
|
||||
DESCRIPTOR = _COLUMNMETADATA,
|
||||
__module__ = 'mysqlx_resultset_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Resultset.ColumnMetaData)
|
||||
))
|
||||
_sym_db.RegisterMessage(ColumnMetaData)
|
||||
|
||||
Row = _reflection.GeneratedProtocolMessageType('Row', (_message.Message,), dict(
|
||||
DESCRIPTOR = _ROW,
|
||||
__module__ = 'mysqlx_resultset_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Resultset.Row)
|
||||
))
|
||||
_sym_db.RegisterMessage(Row)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\027com.mysql.cj.x.protobufH\003'))
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,262 @@
|
||||
# Copyright (c) 2017, 2020, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: mysqlx_session.proto
|
||||
|
||||
import sys
|
||||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf import descriptor_pb2
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='mysqlx_session.proto',
|
||||
package='Mysqlx.Session',
|
||||
syntax='proto2',
|
||||
serialized_pb=_b('\n\x14mysqlx_session.proto\x12\x0eMysqlx.Session\"S\n\x11\x41uthenticateStart\x12\x11\n\tmech_name\x18\x01 \x02(\t\x12\x11\n\tauth_data\x18\x02 \x01(\x0c\x12\x18\n\x10initial_response\x18\x03 \x01(\x0c\")\n\x14\x41uthenticateContinue\x12\x11\n\tauth_data\x18\x01 \x02(\x0c\"#\n\x0e\x41uthenticateOk\x12\x11\n\tauth_data\x18\x01 \x01(\x0c\"!\n\x05Reset\x12\x18\n\tkeep_open\x18\x01 \x01(\x08:\x05\x66\x61lse\"\x07\n\x05\x43loseB\x1b\n\x17\x63om.mysql.cj.x.protobufH\x03')
|
||||
)
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
|
||||
_AUTHENTICATESTART = _descriptor.Descriptor(
|
||||
name='AuthenticateStart',
|
||||
full_name='Mysqlx.Session.AuthenticateStart',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='mech_name', full_name='Mysqlx.Session.AuthenticateStart.mech_name', index=0,
|
||||
number=1, type=9, cpp_type=9, label=2,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='auth_data', full_name='Mysqlx.Session.AuthenticateStart.auth_data', index=1,
|
||||
number=2, type=12, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='initial_response', full_name='Mysqlx.Session.AuthenticateStart.initial_response', index=2,
|
||||
number=3, type=12, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=40,
|
||||
serialized_end=123,
|
||||
)
|
||||
|
||||
|
||||
_AUTHENTICATECONTINUE = _descriptor.Descriptor(
|
||||
name='AuthenticateContinue',
|
||||
full_name='Mysqlx.Session.AuthenticateContinue',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='auth_data', full_name='Mysqlx.Session.AuthenticateContinue.auth_data', index=0,
|
||||
number=1, type=12, cpp_type=9, label=2,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=125,
|
||||
serialized_end=166,
|
||||
)
|
||||
|
||||
|
||||
_AUTHENTICATEOK = _descriptor.Descriptor(
|
||||
name='AuthenticateOk',
|
||||
full_name='Mysqlx.Session.AuthenticateOk',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='auth_data', full_name='Mysqlx.Session.AuthenticateOk.auth_data', index=0,
|
||||
number=1, type=12, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=168,
|
||||
serialized_end=203,
|
||||
)
|
||||
|
||||
|
||||
_RESET = _descriptor.Descriptor(
|
||||
name='Reset',
|
||||
full_name='Mysqlx.Session.Reset',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='keep_open', full_name='Mysqlx.Session.Reset.keep_open', index=0,
|
||||
number=1, type=8, cpp_type=7, label=1,
|
||||
has_default_value=True, default_value=False,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=205,
|
||||
serialized_end=238,
|
||||
)
|
||||
|
||||
|
||||
_CLOSE = _descriptor.Descriptor(
|
||||
name='Close',
|
||||
full_name='Mysqlx.Session.Close',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=240,
|
||||
serialized_end=247,
|
||||
)
|
||||
|
||||
DESCRIPTOR.message_types_by_name['AuthenticateStart'] = _AUTHENTICATESTART
|
||||
DESCRIPTOR.message_types_by_name['AuthenticateContinue'] = _AUTHENTICATECONTINUE
|
||||
DESCRIPTOR.message_types_by_name['AuthenticateOk'] = _AUTHENTICATEOK
|
||||
DESCRIPTOR.message_types_by_name['Reset'] = _RESET
|
||||
DESCRIPTOR.message_types_by_name['Close'] = _CLOSE
|
||||
|
||||
AuthenticateStart = _reflection.GeneratedProtocolMessageType('AuthenticateStart', (_message.Message,), dict(
|
||||
DESCRIPTOR = _AUTHENTICATESTART,
|
||||
__module__ = 'mysqlx_session_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Session.AuthenticateStart)
|
||||
))
|
||||
_sym_db.RegisterMessage(AuthenticateStart)
|
||||
|
||||
AuthenticateContinue = _reflection.GeneratedProtocolMessageType('AuthenticateContinue', (_message.Message,), dict(
|
||||
DESCRIPTOR = _AUTHENTICATECONTINUE,
|
||||
__module__ = 'mysqlx_session_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Session.AuthenticateContinue)
|
||||
))
|
||||
_sym_db.RegisterMessage(AuthenticateContinue)
|
||||
|
||||
AuthenticateOk = _reflection.GeneratedProtocolMessageType('AuthenticateOk', (_message.Message,), dict(
|
||||
DESCRIPTOR = _AUTHENTICATEOK,
|
||||
__module__ = 'mysqlx_session_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Session.AuthenticateOk)
|
||||
))
|
||||
_sym_db.RegisterMessage(AuthenticateOk)
|
||||
|
||||
Reset = _reflection.GeneratedProtocolMessageType('Reset', (_message.Message,), dict(
|
||||
DESCRIPTOR = _RESET,
|
||||
__module__ = 'mysqlx_session_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Session.Reset)
|
||||
))
|
||||
_sym_db.RegisterMessage(Reset)
|
||||
|
||||
Close = _reflection.GeneratedProtocolMessageType('Close', (_message.Message,), dict(
|
||||
DESCRIPTOR = _CLOSE,
|
||||
__module__ = 'mysqlx_session_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Session.Close)
|
||||
))
|
||||
_sym_db.RegisterMessage(Close)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\027com.mysql.cj.x.protobufH\003'))
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,155 @@
|
||||
# Copyright (c) 2017, 2020, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an
|
||||
# additional permission to link the program and your derivative works
|
||||
# with the separately licensed software that they have included with
|
||||
# MySQL.
|
||||
#
|
||||
# Without limiting anything contained in the foregoing, this file,
|
||||
# which is part of MySQL Connector/Python, is also subject to the
|
||||
# Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
# http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: mysqlx_sql.proto
|
||||
|
||||
import sys
|
||||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import reflection as _reflection
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf import descriptor_pb2
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
from mysqlx.protobuf import mysqlx_datatypes_pb2 as mysqlx__datatypes__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='mysqlx_sql.proto',
|
||||
package='Mysqlx.Sql',
|
||||
syntax='proto2',
|
||||
serialized_pb=_b('\n\x10mysqlx_sql.proto\x12\nMysqlx.Sql\x1a\x16mysqlx_datatypes.proto\"y\n\x0bStmtExecute\x12\x16\n\tnamespace\x18\x03 \x01(\t:\x03sql\x12\x0c\n\x04stmt\x18\x01 \x02(\x0c\x12#\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\x15.Mysqlx.Datatypes.Any\x12\x1f\n\x10\x63ompact_metadata\x18\x04 \x01(\x08:\x05\x66\x61lse\"\x0f\n\rStmtExecuteOkB\x1b\n\x17\x63om.mysql.cj.x.protobufH\x03')
|
||||
,
|
||||
dependencies=[mysqlx__datatypes__pb2.DESCRIPTOR,])
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
|
||||
_STMTEXECUTE = _descriptor.Descriptor(
|
||||
name='StmtExecute',
|
||||
full_name='Mysqlx.Sql.StmtExecute',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='namespace', full_name='Mysqlx.Sql.StmtExecute.namespace', index=0,
|
||||
number=3, type=9, cpp_type=9, label=1,
|
||||
has_default_value=True, default_value=_b("sql").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='stmt', full_name='Mysqlx.Sql.StmtExecute.stmt', index=1,
|
||||
number=1, type=12, cpp_type=9, label=2,
|
||||
has_default_value=False, default_value=_b(""),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='args', full_name='Mysqlx.Sql.StmtExecute.args', index=2,
|
||||
number=2, type=11, cpp_type=10, label=3,
|
||||
has_default_value=False, default_value=[],
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='compact_metadata', full_name='Mysqlx.Sql.StmtExecute.compact_metadata', index=3,
|
||||
number=4, type=8, cpp_type=7, label=1,
|
||||
has_default_value=True, default_value=False,
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
options=None),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=56,
|
||||
serialized_end=177,
|
||||
)
|
||||
|
||||
|
||||
_STMTEXECUTEOK = _descriptor.Descriptor(
|
||||
name='StmtExecuteOk',
|
||||
full_name='Mysqlx.Sql.StmtExecuteOk',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto2',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=179,
|
||||
serialized_end=194,
|
||||
)
|
||||
|
||||
_STMTEXECUTE.fields_by_name['args'].message_type = mysqlx__datatypes__pb2._ANY
|
||||
DESCRIPTOR.message_types_by_name['StmtExecute'] = _STMTEXECUTE
|
||||
DESCRIPTOR.message_types_by_name['StmtExecuteOk'] = _STMTEXECUTEOK
|
||||
|
||||
StmtExecute = _reflection.GeneratedProtocolMessageType('StmtExecute', (_message.Message,), dict(
|
||||
DESCRIPTOR = _STMTEXECUTE,
|
||||
__module__ = 'mysqlx_sql_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Sql.StmtExecute)
|
||||
))
|
||||
_sym_db.RegisterMessage(StmtExecute)
|
||||
|
||||
StmtExecuteOk = _reflection.GeneratedProtocolMessageType('StmtExecuteOk', (_message.Message,), dict(
|
||||
DESCRIPTOR = _STMTEXECUTEOK,
|
||||
__module__ = 'mysqlx_sql_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Sql.StmtExecuteOk)
|
||||
))
|
||||
_sym_db.RegisterMessage(StmtExecuteOk)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\027com.mysql.cj.x.protobufH\003'))
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user