forked from Raiza.dev/EliteBot
Cleaned up the directories
This commit is contained in:
parent
f708506d68
commit
a683fcffea
1340 changed files with 554582 additions and 6840 deletions
250
elitebot/lib/python3.11/site-packages/mysqlx/__init__.py
Normal file
250
elitebot/lib/python3.11/site-packages/mysqlx/__init__.py
Normal file
|
@ -0,0 +1,250 @@
|
|||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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
|
||||
|
||||
from . import constants
|
||||
|
||||
from .compat import STRING_TYPES, urlparse, unquote, parse_qsl
|
||||
from .connection import XSession, NodeSession
|
||||
from .crud import Schema, Collection, Table, View
|
||||
from .dbdoc import DbDoc
|
||||
from .errors import (Error, Warning, InterfaceError, DatabaseError,
|
||||
NotSupportedError, DataError, IntegrityError,
|
||||
ProgrammingError, OperationalError, InternalError)
|
||||
from .result import (ColumnMetaData, Row, Result, BufferingResult, RowResult,
|
||||
SqlResult, ColumnType)
|
||||
from .statement import (Statement, FilterableStatement, SqlStatement,
|
||||
FindStatement, AddStatement, RemoveStatement,
|
||||
ModifyStatement, SelectStatement, InsertStatement,
|
||||
DeleteStatement, UpdateStatement,
|
||||
CreateCollectionIndexStatement,
|
||||
DropCollectionIndexStatement, CreateViewStatement,
|
||||
AlterViewStatement, ColumnDef,
|
||||
GeneratedColumnDef, ForeignKeyDef, Expr)
|
||||
|
||||
|
||||
def _parse_address_list(address_list):
|
||||
"""Parses a list of host, port pairs
|
||||
|
||||
Args:
|
||||
address_list: String containing a list of routers or just router
|
||||
|
||||
Returns:
|
||||
Returns a dict with parsed values of host, port and priority if
|
||||
specified.
|
||||
"""
|
||||
is_list = re.compile(r'^\[(?![^,]*\]).*]$')
|
||||
hst_list = re.compile(r',(?![^\(\)]*\))')
|
||||
pri_addr = re.compile(r'^\(address\s*=\s*(?P<address>.+)\s*,\s*priority\s*=\s*(?P<priority>\d+)\)$')
|
||||
|
||||
routers = []
|
||||
if is_list.match(address_list):
|
||||
address_list = address_list.strip("[]")
|
||||
address_list = hst_list.split(address_list)
|
||||
else:
|
||||
match = urlparse("//{0}".format(address_list))
|
||||
return {
|
||||
"host": match.hostname,
|
||||
"port": match.port
|
||||
}
|
||||
|
||||
while address_list:
|
||||
router = {}
|
||||
address = address_list.pop(0).strip()
|
||||
match = pri_addr.match(address)
|
||||
if match:
|
||||
address = match.group("address").strip()
|
||||
router["priority"] = int(match.group("priority"))
|
||||
|
||||
match = urlparse("//{0}".format(address))
|
||||
if not match.hostname:
|
||||
raise InterfaceError("Invalid address: {0}".format(address))
|
||||
|
||||
router["host"] = match.hostname
|
||||
router["port"] = match.port
|
||||
routers.append(router)
|
||||
|
||||
return { "routers": routers }
|
||||
|
||||
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.
|
||||
"""
|
||||
settings = {"schema": ""}
|
||||
uri = "{0}{1}".format("" if uri.startswith("mysqlx://")
|
||||
else "mysqlx://", uri)
|
||||
scheme, temp = uri.split("://", 1)
|
||||
userinfo, temp = temp.partition("@")[::2]
|
||||
host, query_str = temp.partition("?")[::2]
|
||||
|
||||
pos = host.rfind("/")
|
||||
if host[pos:].find(")") is -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))
|
||||
settings["user"], settings["password"] = userinfo.split(":", 1)
|
||||
|
||||
if host.startswith(("/", "..", ".")):
|
||||
settings["socket"] = unquote(host)
|
||||
elif host.startswith("\\."):
|
||||
raise InterfaceError("Windows Pipe is not supported.")
|
||||
else:
|
||||
settings.update(_parse_address_list(host))
|
||||
|
||||
for opt, val in dict(parse_qsl(query_str, True)).items():
|
||||
settings[opt] = unquote(val.strip("()")) or True
|
||||
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.
|
||||
"""
|
||||
if "priority" in settings and settings["priority"]:
|
||||
try:
|
||||
settings["priority"] = int(settings["priority"])
|
||||
except NameError:
|
||||
raise InterfaceError("Invalid priority")
|
||||
|
||||
if "port" in settings and settings["port"]:
|
||||
try:
|
||||
settings["port"] = int(settings["port"])
|
||||
except NameError:
|
||||
raise InterfaceError("Invalid port")
|
||||
elif "host" in settings:
|
||||
settings["port"] = 33060
|
||||
|
||||
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.XSession: XSession object.
|
||||
"""
|
||||
settings = {}
|
||||
if args:
|
||||
if isinstance(args[0], STRING_TYPES):
|
||||
settings = _parse_connection_uri(args[0])
|
||||
elif isinstance(args[0], dict):
|
||||
settings.update(args[0])
|
||||
elif kwargs:
|
||||
settings.update(kwargs)
|
||||
|
||||
if not settings:
|
||||
raise InterfaceError("Settings not provided")
|
||||
|
||||
if "routers" in settings:
|
||||
for router in settings.get("routers"):
|
||||
_validate_settings(router)
|
||||
else:
|
||||
_validate_settings(settings)
|
||||
|
||||
return settings
|
||||
|
||||
def get_session(*args, **kwargs):
|
||||
"""Creates a XSession instance using the provided connection data.
|
||||
|
||||
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.XSession: XSession object.
|
||||
"""
|
||||
settings = _get_connection_settings(*args, **kwargs)
|
||||
return XSession(settings)
|
||||
|
||||
|
||||
def get_node_session(*args, **kwargs):
|
||||
"""Creates a NodeSession instance using the provided connection data.
|
||||
|
||||
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.XSession: XSession object.
|
||||
"""
|
||||
settings = _get_connection_settings(*args, **kwargs)
|
||||
if "routers" in settings:
|
||||
raise InterfaceError("NodeSession expects only one pair of host and port")
|
||||
|
||||
return NodeSession(settings)
|
||||
|
||||
|
||||
__all__ = [
|
||||
# mysqlx.connection
|
||||
"XSession", "NodeSession", "get_session", "get_node_session",
|
||||
|
||||
# mysqlx.constants
|
||||
"constants",
|
||||
|
||||
# mysqlx.crud
|
||||
"Schema", "Collection", "Table", "View",
|
||||
|
||||
# mysqlx.errors
|
||||
"Error", "Warning", "InterfaceError", "DatabaseError", "NotSupportedError",
|
||||
"DataError", "IntegrityError", "ProgrammingError", "OperationalError",
|
||||
"InternalError",
|
||||
|
||||
# mysqlx.result
|
||||
"ColumnMetaData", "Row", "Result", "BufferingResult", "RowResult",
|
||||
"SqlResult", "ColumnType",
|
||||
|
||||
# mysqlx.statement
|
||||
"DbDoc", "Statement", "FilterableStatement", "SqlStatement",
|
||||
"FindStatement", "AddStatement", "RemoveStatement", "ModifyStatement",
|
||||
"SelectStatement", "InsertStatement", "DeleteStatement", "UpdateStatement",
|
||||
"CreateCollectionIndexStatement", "DropCollectionIndexStatement",
|
||||
"CreateViewStatement", "AlterViewStatement",
|
||||
"ColumnDef", "GeneratedColumnDef", "ForeignKeyDef", "Expr",
|
||||
]
|
|
@ -0,0 +1,65 @@
|
|||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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 .compat import PY3, UNICODE_TYPES, hexlify
|
||||
|
||||
|
||||
class MySQL41AuthPlugin(object):
|
||||
def __init__(self, username, password):
|
||||
self._username = username
|
||||
self._password = password.encode("utf-8") \
|
||||
if isinstance(password, UNICODE_TYPES) else password
|
||||
|
||||
def name(self):
|
||||
return "MySQL 4.1 Authentication Plugin"
|
||||
|
||||
def auth_name(self):
|
||||
return "MYSQL41"
|
||||
|
||||
def xor_string(self, hash1, hash2):
|
||||
"""Encrypt/Decrypt function used for password encryption in
|
||||
authentication, using a simple XOR.
|
||||
"""
|
||||
if PY3:
|
||||
xored = [h1 ^ h2 for (h1, h2) in zip(hash1, hash2)]
|
||||
else:
|
||||
xored = [ord(h1) ^ ord(h2) for (h1, h2) in zip(hash1, hash2)]
|
||||
return struct.pack("20B", *xored)
|
||||
|
||||
def build_authentication_response(self, data):
|
||||
"""Hashing for MySQL 4.1 authentication
|
||||
"""
|
||||
if self._password:
|
||||
h1 = hashlib.sha1(self._password).digest()
|
||||
h2 = hashlib.sha1(h1).digest()
|
||||
auth_response = self.xor_string(
|
||||
h1, hashlib.sha1(data + h2).digest())
|
||||
return "{0}\0{1}\0*{2}\0".format("", self._username,
|
||||
hexlify(auth_response))
|
||||
else:
|
||||
return "{0}\0{1}\0".format("", self._username)
|
286
elitebot/lib/python3.11/site-packages/mysqlx/charsets.py
Normal file
286
elitebot/lib/python3.11/site-packages/mysqlx/charsets.py
Normal file
|
@ -0,0 +1,286 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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 = '2016-06-06'
|
||||
_MYSQL_VERSION = (5, 7, 12)
|
||||
|
||||
"""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", True), # 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
|
||||
None,
|
||||
("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
|
||||
]
|
||||
|
57
elitebot/lib/python3.11/site-packages/mysqlx/compat.py
Normal file
57
elitebot/lib/python3.11/site-packages/mysqlx/compat.py
Normal file
|
@ -0,0 +1,57 @@
|
|||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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 handles compatibility issues between Python 2 and Python 3."""
|
||||
|
||||
import sys
|
||||
import decimal
|
||||
import binascii
|
||||
|
||||
|
||||
PY3 = sys.version_info.major == 3
|
||||
|
||||
|
||||
if PY3:
|
||||
from urllib.parse import urlparse, unquote, parse_qsl
|
||||
|
||||
def hexlify(data):
|
||||
return binascii.hexlify(data).decode("utf-8")
|
||||
|
||||
NUMERIC_TYPES = (int, float, decimal.Decimal,)
|
||||
INT_TYPES = (int,)
|
||||
UNICODE_TYPES = (str,)
|
||||
STRING_TYPES = (str,)
|
||||
BYTE_TYPES = (bytearray, bytes,)
|
||||
|
||||
|
||||
else:
|
||||
from urlparse import urlparse, unquote, parse_qsl
|
||||
|
||||
def hexlify(data):
|
||||
return data.encode("hex")
|
||||
|
||||
NUMERIC_TYPES = (int, float, decimal.Decimal, long,)
|
||||
INT_TYPES = (int, long,)
|
||||
UNICODE_TYPES = (unicode,)
|
||||
STRING_TYPES = (str, unicode,)
|
||||
BYTE_TYPES = (bytearray,)
|
495
elitebot/lib/python3.11/site-packages/mysqlx/connection.py
Normal file
495
elitebot/lib/python3.11/site-packages/mysqlx/connection.py
Normal file
|
@ -0,0 +1,495 @@
|
|||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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 communication for MySQL X servers."""
|
||||
|
||||
try:
|
||||
import ssl
|
||||
SSL_AVAILABLE = True
|
||||
except:
|
||||
SSL_AVAILABLE = False
|
||||
|
||||
import sys
|
||||
import socket
|
||||
|
||||
from functools import wraps
|
||||
|
||||
from .authentication import MySQL41AuthPlugin
|
||||
from .errors import InterfaceError, OperationalError, ProgrammingError
|
||||
from .crud import Schema
|
||||
from .protocol import Protocol, MessageReaderWriter
|
||||
from .result import Result, RowResult, DocResult
|
||||
from .statement import SqlStatement, AddStatement
|
||||
|
||||
|
||||
_DROP_DATABASE_QUERY = "DROP DATABASE IF EXISTS `{0}`"
|
||||
_CREATE_DATABASE_QUERY = "CREATE DATABASE IF NOT EXISTS `{0}`"
|
||||
|
||||
|
||||
class SocketStream(object):
|
||||
def __init__(self):
|
||||
self._socket = None
|
||||
self._is_ssl = False
|
||||
|
||||
def connect(self, params):
|
||||
s_type = socket.AF_INET if isinstance(params, tuple) else socket.AF_UNIX
|
||||
self._socket = socket.socket(s_type, socket.SOCK_STREAM)
|
||||
self._socket.connect(params)
|
||||
|
||||
def read(self, count):
|
||||
if self._socket is None:
|
||||
raise OperationalError("MySQLx Connection not available")
|
||||
buf = []
|
||||
while count > 0:
|
||||
data = self._socket.recv(count)
|
||||
if data == b"":
|
||||
raise RuntimeError("Unexpected connection close")
|
||||
buf.append(data)
|
||||
count -= len(data)
|
||||
return b"".join(buf)
|
||||
|
||||
def sendall(self, data):
|
||||
if self._socket is None:
|
||||
raise OperationalError("MySQLx Connection not available")
|
||||
self._socket.sendall(data)
|
||||
|
||||
def close(self):
|
||||
if not self._socket:
|
||||
return
|
||||
|
||||
self._socket.close()
|
||||
self._socket = None
|
||||
|
||||
def set_ssl(self, ssl_opts={}):
|
||||
if not SSL_AVAILABLE:
|
||||
self.close()
|
||||
raise RuntimeError("Python installation has no SSL support.")
|
||||
|
||||
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
|
||||
context.load_default_certs()
|
||||
if "ssl-ca" in ssl_opts:
|
||||
try:
|
||||
context.load_verify_locations(ssl_opts["ssl-ca"])
|
||||
context.verify_mode = ssl.CERT_REQUIRED
|
||||
except (IOError, ssl.SSLError):
|
||||
self.close()
|
||||
raise InterfaceError("Invalid CA certificate.")
|
||||
if "ssl-crl" in ssl_opts:
|
||||
try:
|
||||
context.load_verify_locations(ssl_opts["ssl-crl"])
|
||||
context.verify_flags = ssl.VERIFY_CRL_CHECK_CHAIN
|
||||
except (IOError, ssl.SSLError):
|
||||
self.close()
|
||||
raise InterfaceError("Invalid CRL.")
|
||||
if "ssl-cert" in ssl_opts:
|
||||
try:
|
||||
context.load_cert_chain(ssl_opts["ssl-cert"],
|
||||
ssl_opts.get("ssl-key", None))
|
||||
except (IOError, ssl.SSLError):
|
||||
self.close()
|
||||
raise InterfaceError("Invalid Client Certificate/Key.")
|
||||
elif "ssl-key" in ssl_opts:
|
||||
self.close()
|
||||
raise InterfaceError("Client Certificate not provided.")
|
||||
|
||||
self._socket = context.wrap_socket(self._socket)
|
||||
self._is_ssl = True
|
||||
|
||||
|
||||
def catch_network_exception(func):
|
||||
@wraps(func)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
try:
|
||||
return func(self, *args, **kwargs)
|
||||
except (socket.error, RuntimeError):
|
||||
self.disconnect()
|
||||
raise InterfaceError("Cannot connect to host.")
|
||||
return wrapper
|
||||
|
||||
|
||||
class Connection(object):
|
||||
def __init__(self, settings):
|
||||
self._user = settings.get("user")
|
||||
self._password = settings.get("password")
|
||||
self._schema = settings.get("schema")
|
||||
self._active_result = None
|
||||
self.settings = settings
|
||||
self.stream = SocketStream()
|
||||
self.reader_writer = None
|
||||
self.protocol = None
|
||||
|
||||
def fetch_active_result(self):
|
||||
if self._active_result is not None:
|
||||
self._active_result.fetch_all()
|
||||
self._active_result = None
|
||||
|
||||
def _connection_params(self):
|
||||
if "host" in self.settings:
|
||||
return self.settings["host"], self.settings.get("port", 33060)
|
||||
if "socket" in self.settings:
|
||||
return self.settings["socket"]
|
||||
return ("localhost", 33060,)
|
||||
|
||||
def connect(self):
|
||||
self.stream.connect(self._connection_params())
|
||||
self.reader_writer = MessageReaderWriter(self.stream)
|
||||
self.protocol = Protocol(self.reader_writer)
|
||||
self._handle_capabilities()
|
||||
self._authenticate()
|
||||
|
||||
def _handle_capabilities(self):
|
||||
data = self.protocol.get_capabilites().capabilities
|
||||
if not (data[0].name.lower() == "tls" if data else False):
|
||||
if self.settings.get("ssl-enable", False):
|
||||
self.close()
|
||||
raise OperationalError("SSL not enabled at server.")
|
||||
return
|
||||
|
||||
if sys.version_info < (2, 7, 9):
|
||||
if self.settings.get("ssl-enable", False):
|
||||
self.close()
|
||||
raise RuntimeError("The support for SSL is not available for "
|
||||
"this Python version.")
|
||||
return
|
||||
|
||||
self.protocol.set_capabilities(tls=True)
|
||||
self.stream.set_ssl(self.settings)
|
||||
|
||||
def _authenticate(self):
|
||||
plugin = MySQL41AuthPlugin(self._user, self._password)
|
||||
self.protocol.send_auth_start(plugin.auth_name())
|
||||
extra_data = self.protocol.read_auth_continue()
|
||||
self.protocol.send_auth_continue(
|
||||
plugin.build_authentication_response(extra_data))
|
||||
self.protocol.read_auth_ok()
|
||||
|
||||
@catch_network_exception
|
||||
def send_sql(self, sql, *args):
|
||||
self.protocol.send_execute_statement("sql", sql, args)
|
||||
|
||||
@catch_network_exception
|
||||
def send_insert(self, statement):
|
||||
self.protocol.send_insert(statement)
|
||||
ids = None
|
||||
if isinstance(statement, AddStatement):
|
||||
ids = statement._ids
|
||||
return Result(self, ids)
|
||||
|
||||
@catch_network_exception
|
||||
def find(self, statement):
|
||||
self.protocol.send_find(statement)
|
||||
return DocResult(self) if statement._doc_based else RowResult(self)
|
||||
|
||||
@catch_network_exception
|
||||
def delete(self, statement):
|
||||
self.protocol.send_delete(statement)
|
||||
return Result(self)
|
||||
|
||||
@catch_network_exception
|
||||
def update(self, statement):
|
||||
self.protocol.send_update(statement)
|
||||
return Result(self)
|
||||
|
||||
@catch_network_exception
|
||||
def execute_nonquery(self, namespace, cmd, raise_on_fail=True, *args):
|
||||
self.protocol.send_execute_statement(namespace, cmd, args)
|
||||
return Result(self)
|
||||
|
||||
@catch_network_exception
|
||||
def execute_sql_scalar(self, sql, *args):
|
||||
self.protocol.send_execute_statement("sql", sql, args)
|
||||
result = RowResult(self)
|
||||
result.fetch_all()
|
||||
if result.count == 0:
|
||||
raise InterfaceError("No data found")
|
||||
return result[0][0]
|
||||
|
||||
@catch_network_exception
|
||||
def get_row_result(self, cmd, *args):
|
||||
self.protocol.send_execute_statement("xplugin", cmd, args)
|
||||
return RowResult(self)
|
||||
|
||||
@catch_network_exception
|
||||
def read_row(self, result):
|
||||
return self.protocol.read_row(result)
|
||||
|
||||
@catch_network_exception
|
||||
def close_result(self, result):
|
||||
self.protocol.close_result(result)
|
||||
|
||||
@catch_network_exception
|
||||
def get_column_metadata(self, result):
|
||||
return self.protocol.get_column_metadata(result)
|
||||
|
||||
def is_open(self):
|
||||
return self.stream._socket is not None
|
||||
|
||||
def disconnect(self):
|
||||
if not self.is_open():
|
||||
return
|
||||
self.stream.close()
|
||||
|
||||
def close(self):
|
||||
if not self.is_open():
|
||||
return
|
||||
if self._active_result is not None:
|
||||
self._active_result.fetch_all()
|
||||
self.protocol.send_close()
|
||||
self.protocol.read_ok()
|
||||
self.stream.close()
|
||||
|
||||
|
||||
class XConnection(Connection):
|
||||
def __init__(self, settings):
|
||||
super(XConnection, self).__init__(settings)
|
||||
self.dependent_connections = []
|
||||
self._routers = settings.pop("routers", [])
|
||||
|
||||
if 'host' in settings and settings['host']:
|
||||
self._routers.append({
|
||||
'host': settings.pop('host'),
|
||||
'port': settings.pop('port', None)
|
||||
})
|
||||
|
||||
self._cur_router = -1
|
||||
self._can_failover = True
|
||||
self._ensure_priorities()
|
||||
self._routers.sort(key=lambda x: x['priority'], reverse=True)
|
||||
|
||||
def _ensure_priorities(self):
|
||||
priority_count = 0
|
||||
priority = 100
|
||||
|
||||
for router in self._routers:
|
||||
pri = router.get('priority', None)
|
||||
if pri is None:
|
||||
priority_count += 1
|
||||
router["priority"] = priority
|
||||
elif pri > 100:
|
||||
raise ProgrammingError("The priorities must be between 0 and "
|
||||
"100", 4007)
|
||||
priority -= 1
|
||||
|
||||
if 0 < priority_count < len(self._routers):
|
||||
raise ProgrammingError("You must either assign no priority to any "
|
||||
"of the routers or give a priority for every router", 4000)
|
||||
|
||||
def _connection_params(self):
|
||||
if not self._routers:
|
||||
self._can_failover = False
|
||||
return super(XConnection, self)._connection_params()
|
||||
|
||||
# Reset routers status once all are tried
|
||||
if not self._can_failover or self._cur_router is -1:
|
||||
self._cur_router = -1
|
||||
self._can_failover = True
|
||||
for router in self._routers:
|
||||
router['available'] = True
|
||||
|
||||
self._cur_router += 1
|
||||
host = self._routers[self._cur_router]["host"]
|
||||
port = self._routers[self._cur_router]["port"]
|
||||
|
||||
if self._cur_router > 0:
|
||||
self._routers[self._cur_router-1]["available"] = False
|
||||
if self._cur_router >= len(self._routers) - 1:
|
||||
self._can_failover = False
|
||||
|
||||
return (host, port,)
|
||||
|
||||
def connect(self):
|
||||
# Loop and check
|
||||
error = None
|
||||
while self._can_failover:
|
||||
try:
|
||||
return super(XConnection, self).connect()
|
||||
except socket.error as err:
|
||||
error = err
|
||||
|
||||
if len(self._routers) <= 1:
|
||||
raise InterfaceError("Cannot connect to host: {0}".format(error))
|
||||
raise InterfaceError("Failed to connect to any of the routers.", 4001)
|
||||
|
||||
def bind_connection(self, connection):
|
||||
self.dependent_connections.append(connection)
|
||||
|
||||
def close(self):
|
||||
while self.dependent_connections:
|
||||
self.dependent_connections.pop().close()
|
||||
super(XConnection, self).close()
|
||||
|
||||
def disconnect(self):
|
||||
while self.dependent_connections:
|
||||
self.dependent_connections.pop().disconnect()
|
||||
super(XConnection, self).disconnect()
|
||||
|
||||
|
||||
class NodeConnection(Connection):
|
||||
def __init__(self, settings):
|
||||
super(NodeConnection, self).__init__(settings)
|
||||
|
||||
def connect(self):
|
||||
try:
|
||||
super(NodeConnection, self).connect()
|
||||
except socket.error as err:
|
||||
raise InterfaceError("Cannot connect to host: {0}".format(err))
|
||||
|
||||
|
||||
class BaseSession(object):
|
||||
"""Base functionality for Session classes through the X Protocol.
|
||||
|
||||
This class encloses the core functionality to be made available on both
|
||||
the XSession and NodeSession classes, such functionality includes:
|
||||
|
||||
- Accessing available schemas.
|
||||
- Schema management operations.
|
||||
- Enabling/disabling warning generation.
|
||||
- Retrieval of connection information.
|
||||
|
||||
Args:
|
||||
settings (dict): Connection data used to connect to the database.
|
||||
"""
|
||||
def __init__(self, settings):
|
||||
self._settings = settings
|
||||
|
||||
def is_open(self):
|
||||
return self._connection.stream._socket is not None
|
||||
|
||||
def get_schema(self, name):
|
||||
"""Retrieves a Schema object from the current session by it's name.
|
||||
|
||||
Args:
|
||||
name (string): The name of the Schema object to be retrieved.
|
||||
|
||||
Returns:
|
||||
mysqlx.Schema: The Schema object with the given name.
|
||||
"""
|
||||
return Schema(self, name)
|
||||
|
||||
def get_default_schema(self):
|
||||
"""Retrieves a Schema object from the current session by the schema
|
||||
name configured in the connection settings.
|
||||
|
||||
Returns:
|
||||
mysqlx.Schema: The Schema object with the given name at connect
|
||||
time.
|
||||
|
||||
Raises:
|
||||
ProgrammingError: If default schema not provided.
|
||||
"""
|
||||
if self._connection.settings.get("schema"):
|
||||
return Schema(self, self._connection.settings["schema"])
|
||||
raise ProgrammingError("Default schema not provided")
|
||||
|
||||
def drop_schema(self, name):
|
||||
"""Drops the schema with the specified name.
|
||||
|
||||
Args:
|
||||
name (string): The name of the Schema object to be retrieved.
|
||||
"""
|
||||
self._connection.execute_nonquery(
|
||||
"sql", _DROP_DATABASE_QUERY.format(name), True)
|
||||
|
||||
def create_schema(self, name):
|
||||
"""Creates a schema on the database and returns the corresponding
|
||||
object.
|
||||
|
||||
Args:
|
||||
name (string): A string value indicating the schema name.
|
||||
"""
|
||||
self._connection.execute_nonquery(
|
||||
"sql", _CREATE_DATABASE_QUERY.format(name), True)
|
||||
return Schema(self, name)
|
||||
|
||||
def start_transaction(self):
|
||||
"""Starts a transaction context on the server.
|
||||
"""
|
||||
self._connection.execute_nonquery("sql", "START TRANSACTION", True)
|
||||
|
||||
def commit(self):
|
||||
"""Commits all the operations executed after a call to
|
||||
startTransaction().
|
||||
"""
|
||||
self._connection.execute_nonquery("sql", "COMMIT", True)
|
||||
|
||||
def rollback(self):
|
||||
"""Discards all the operations executed after a call to
|
||||
startTransaction().
|
||||
"""
|
||||
self._connection.execute_nonquery("sql", "ROLLBACK", True)
|
||||
|
||||
def close(self):
|
||||
self._connection.close()
|
||||
|
||||
|
||||
class XSession(BaseSession):
|
||||
"""Enables interaction with a X Protocol enabled MySQL Product.
|
||||
|
||||
The functionality includes:
|
||||
|
||||
- Accessing available schemas.
|
||||
- Schema management operations.
|
||||
- Enabling/disabling warning generation.
|
||||
- Retrieval of connection information.
|
||||
|
||||
Args:
|
||||
settings (dict): Connection data used to connect to the database.
|
||||
"""
|
||||
def __init__(self, settings):
|
||||
super(XSession, self).__init__(settings)
|
||||
self._connection = XConnection(self._settings)
|
||||
self._connection.connect()
|
||||
|
||||
def bind_to_default_shard(self):
|
||||
if not self.is_open():
|
||||
raise OperationalError("XSession is not connected to a farm.")
|
||||
|
||||
nsess = NodeSession(self._settings)
|
||||
self._connection.bind_connection(nsess._connection)
|
||||
return nsess
|
||||
|
||||
|
||||
class NodeSession(BaseSession):
|
||||
"""Enables interaction with a X Protocol enabled MySQL Server.
|
||||
|
||||
The functionality includes:
|
||||
|
||||
- Accessing available schemas.
|
||||
- Schema management operations.
|
||||
- Enabling/disabling warning generation.
|
||||
- Retrieval of connection information.
|
||||
- Includes SQL Execution.
|
||||
|
||||
Args:
|
||||
settings (dict): Connection data used to connect to the database.
|
||||
"""
|
||||
def __init__(self, settings):
|
||||
super(NodeSession, self).__init__(settings)
|
||||
self._connection = NodeConnection(self._settings)
|
||||
self._connection.connect()
|
||||
|
||||
def sql(self, sql):
|
||||
"""Creates a :class:`mysqlx.SqlStatement` object to allow running the
|
||||
SQL statement on the target MySQL Server.
|
||||
"""
|
||||
return SqlStatement(self._connection, sql)
|
51
elitebot/lib/python3.11/site-packages/mysqlx/constants.py
Normal file
51
elitebot/lib/python3.11/site-packages/mysqlx/constants.py
Normal file
|
@ -0,0 +1,51 @@
|
|||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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
|
||||
|
||||
|
||||
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, verbose=False)
|
||||
if values is None:
|
||||
return Enum(*fields)
|
||||
return Enum(*values)
|
||||
|
||||
|
||||
Algorithms = create_enum("Algorithms", ("MERGE", "TMPTABLE", "UNDEFINED"))
|
||||
Securities = create_enum("Securities", ("DEFINER", "INVOKER"))
|
||||
CheckOptions = create_enum("CheckOptions", ("CASCADED", "LOCAL"))
|
||||
|
||||
|
||||
__all__ = ["Algorithms", "Securities", "CheckOptions"]
|
538
elitebot/lib/python3.11/site-packages/mysqlx/crud.py
Normal file
538
elitebot/lib/python3.11/site-packages/mysqlx/crud.py
Normal file
|
@ -0,0 +1,538 @@
|
|||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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."""
|
||||
|
||||
from .errors import ProgrammingError
|
||||
from .statement import (FindStatement, AddStatement, RemoveStatement,
|
||||
ModifyStatement, SelectStatement, InsertStatement,
|
||||
DeleteStatement, UpdateStatement,
|
||||
CreateCollectionIndexStatement,
|
||||
DropCollectionIndexStatement, CreateViewStatement,
|
||||
AlterViewStatement, CreateTableStatement)
|
||||
|
||||
|
||||
_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 like '{0}'")
|
||||
_COUNT_QUERY = "SELECT COUNT(*) FROM `{0}`.`{1}`"
|
||||
_DROP_TABLE_QUERY = "DROP TABLE IF EXISTS `{0}`.`{1}`"
|
||||
_DROP_VIEW_QUERY = "DROP VIEW 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
|
||||
self._connection = self._schema.get_session()._connection
|
||||
|
||||
@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_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
|
||||
|
||||
def am_i_real(self):
|
||||
return self.exists_in_database()
|
||||
|
||||
def who_am_i(self):
|
||||
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(self._name)
|
||||
return self._connection.execute_sql_scalar(sql) == 1
|
||||
|
||||
def get_session(self):
|
||||
"""Returns the session of this Schema object.
|
||||
|
||||
Returns:
|
||||
mysqlx.Session: The Session object.
|
||||
"""
|
||||
return self._session
|
||||
|
||||
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", self._name)
|
||||
rows.fetch_all()
|
||||
collections = []
|
||||
for row in rows:
|
||||
if row.get_string("type") != "COLLECTION":
|
||||
continue
|
||||
try:
|
||||
collection = Collection(self, row.get_string("TABLE_NAME"))
|
||||
except ValueError:
|
||||
collection = Collection(self, row.get_string("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", self._name)
|
||||
rows.fetch_all()
|
||||
tables = []
|
||||
object_types = ("TABLE", "VIEW",)
|
||||
for row in rows:
|
||||
if row.get_string("type") in object_types:
|
||||
try:
|
||||
table = Table(self, row.get_string("TABLE_NAME"))
|
||||
except ValueError:
|
||||
table = Table(self, row.get_string("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(self._name, name), False)
|
||||
|
||||
def drop_table(self, name):
|
||||
"""Drops a table.
|
||||
|
||||
Args:
|
||||
name (str): The name of the table to be dropped.
|
||||
"""
|
||||
table = Table(self, name)
|
||||
if table.is_view():
|
||||
self.drop_view(name)
|
||||
else:
|
||||
self._connection.execute_nonquery(
|
||||
"sql", _DROP_TABLE_QUERY.format(self._name, name), False)
|
||||
|
||||
def drop_view(self, name):
|
||||
"""Drops a view.
|
||||
|
||||
Args:
|
||||
name (str): The name of the view to be dropped.
|
||||
"""
|
||||
self._connection.execute_nonquery(
|
||||
"sql", _DROP_VIEW_QUERY.format(self._name, name), False)
|
||||
|
||||
def create_collection(self, name, reuse=False):
|
||||
"""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 (bool): `True` to reuse an existing collection.
|
||||
|
||||
Returns:
|
||||
mysqlx.Collection: Collection object.
|
||||
|
||||
Raises:
|
||||
ProgrammingError: If ``reuse`` is False and collection exists.
|
||||
"""
|
||||
if not name:
|
||||
raise ProgrammingError("Collection name is invalid")
|
||||
collection = Collection(self, name)
|
||||
if not collection.exists_in_database():
|
||||
self._connection.execute_nonquery("xplugin", "create_collection",
|
||||
True, self._name, name)
|
||||
elif not reuse:
|
||||
raise ProgrammingError("Collection already exists")
|
||||
return collection
|
||||
|
||||
def create_view(self, name, replace=False):
|
||||
"""Creates in the current schema a new view with the specified name
|
||||
and retrieves an object representing the new view created.
|
||||
|
||||
Args:
|
||||
name (string): The name of the view.
|
||||
replace (Optional[bool]): `True` to add replace.
|
||||
|
||||
Returns:
|
||||
mysqlx.View: View object.
|
||||
"""
|
||||
view = View(self, name)
|
||||
return view.get_create_statement(replace)
|
||||
|
||||
def alter_view(self, name):
|
||||
"""Alters a view in the current schema with the specified name and
|
||||
retrieves an object representing the view.
|
||||
|
||||
Args:
|
||||
name (string): The name of the view.
|
||||
|
||||
Returns:
|
||||
mysqlx.View: View object.
|
||||
"""
|
||||
view = View(self, name)
|
||||
return view.get_alter_statement()
|
||||
|
||||
def create_table(self, name, reuse=False):
|
||||
if not name:
|
||||
raise ProgrammingError("Table name is invalid")
|
||||
table = Table(self, name)
|
||||
if not table.exists_in_database():
|
||||
return CreateTableStatement(self, name)
|
||||
elif not reuse:
|
||||
raise ProgrammingError("Table already exists")
|
||||
return table
|
||||
|
||||
|
||||
class Collection(DatabaseObject):
|
||||
"""Represents a collection of documents on a schema.
|
||||
|
||||
Args:
|
||||
schema (mysqlx.Schema): The Schema object.
|
||||
name (str): The collection name.
|
||||
"""
|
||||
def __init__(self, schema, name):
|
||||
super(Collection, self).__init__(schema, 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(self._schema.get_name(), 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.
|
||||
"""
|
||||
return FindStatement(self, condition)
|
||||
|
||||
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_one(self, id):
|
||||
"""Removes document by ID.
|
||||
|
||||
Args:
|
||||
id (str): The document ID.
|
||||
|
||||
Returns:
|
||||
mysqlx.RemoveStatement: RemoveStatement object.
|
||||
"""
|
||||
return self.remove("_id = '{0}'".format(id))
|
||||
|
||||
def remove(self, condition=None):
|
||||
"""Removes documents based on the ``condition``.
|
||||
|
||||
Args:
|
||||
condition (Optional[str]): The string with the filter expression of
|
||||
the documents to be removed.
|
||||
|
||||
Returns:
|
||||
mysqlx.RemoveStatement: RemoveStatement object.
|
||||
"""
|
||||
rs = RemoveStatement(self)
|
||||
if condition:
|
||||
rs.where(condition)
|
||||
return rs
|
||||
|
||||
def modify(self, condition=None):
|
||||
"""Modifies documents based on the ``condition``.
|
||||
|
||||
Args:
|
||||
condition (Optional[str]): The string with the filter expression of
|
||||
the documents to be modified.
|
||||
|
||||
Returns:
|
||||
mysqlx.ModifyStatement: ModifyStatement object.
|
||||
"""
|
||||
return ModifyStatement(self, condition)
|
||||
|
||||
def count(self):
|
||||
"""Counts the documents in the collection.
|
||||
|
||||
Returns:
|
||||
int: The total of documents in the collection.
|
||||
"""
|
||||
sql = _COUNT_QUERY.format(self._schema.name, self._name)
|
||||
return self._connection.execute_sql_scalar(sql)
|
||||
|
||||
def create_index(self, index_name, is_unique):
|
||||
"""Creates a collection index.
|
||||
|
||||
Args:
|
||||
index_name (str): Index name.
|
||||
is_unique (bool): `True` if the index is unique.
|
||||
"""
|
||||
return CreateCollectionIndexStatement(self, index_name, is_unique)
|
||||
|
||||
def drop_index(self, index_name):
|
||||
"""Drops a collection index.
|
||||
|
||||
Args:
|
||||
index_name (str): Index name.
|
||||
"""
|
||||
return DropCollectionIndexStatement(self, index_name)
|
||||
|
||||
|
||||
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 __init__(self, schema, name):
|
||||
super(Table, self).__init__(schema, 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(self._schema.name, 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
|
||||
"""
|
||||
return SelectStatement(self, *fields)
|
||||
|
||||
def insert(self, *fields):
|
||||
"""Creates a new :class:`mysqlx.InsertStatement` object.
|
||||
|
||||
Args:
|
||||
*fields: The fields to be inserted.
|
||||
|
||||
Returns:
|
||||
mysqlx.InsertStatement: InsertStatement object
|
||||
"""
|
||||
return InsertStatement(self, *fields)
|
||||
|
||||
def update(self):
|
||||
"""Creates a new :class:`mysqlx.UpdateStatement` object.
|
||||
|
||||
Args:
|
||||
*fields: The fields to update.
|
||||
|
||||
Returns:
|
||||
mysqlx.UpdateStatement: UpdateStatement object
|
||||
"""
|
||||
return UpdateStatement(self)
|
||||
|
||||
def delete(self, condition=None):
|
||||
"""Creates a new :class:`mysqlx.DeleteStatement` object.
|
||||
|
||||
Args:
|
||||
condition (Optional[str]): The string with the filter expression of
|
||||
the rows to be deleted.
|
||||
|
||||
Returns:
|
||||
mysqlx.DeleteStatement: DeleteStatement object
|
||||
"""
|
||||
return DeleteStatement(self, condition)
|
||||
|
||||
def count(self):
|
||||
"""Counts the rows in the table.
|
||||
|
||||
Returns:
|
||||
int: The total of rows in the table.
|
||||
"""
|
||||
sql = _COUNT_QUERY.format(self._schema.name, self._name)
|
||||
return self._connection.execute_sql_scalar(sql)
|
||||
|
||||
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(self._schema.get_name(), 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 __init__(self, schema, name):
|
||||
super(View, self).__init__(schema, 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(self._schema.name, self._name)
|
||||
return self._connection.execute_sql_scalar(sql) == 1
|
||||
|
||||
def get_create_statement(self, replace=False):
|
||||
"""Creates a new :class:`mysqlx.CreateViewStatement` object.
|
||||
|
||||
Args:
|
||||
replace (Optional[bool]): `True` to add replace.
|
||||
|
||||
Returns:
|
||||
mysqlx.CreateViewStatement: CreateViewStatement object.
|
||||
"""
|
||||
return CreateViewStatement(self, replace)
|
||||
|
||||
def get_alter_statement(self):
|
||||
"""Creates a new :class:`mysqlx.AlterViewStatement` object.
|
||||
|
||||
Returns:
|
||||
mysqlx.AlterViewStatement: AlterViewStatement object.
|
||||
"""
|
||||
return AlterViewStatement(self)
|
62
elitebot/lib/python3.11/site-packages/mysqlx/dbdoc.py
Normal file
62
elitebot/lib/python3.11/site-packages/mysqlx/dbdoc.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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
|
||||
import uuid
|
||||
|
||||
from .compat import STRING_TYPES
|
||||
|
||||
|
||||
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):
|
||||
# TODO: Handle exceptions. What happens if it doesn't load properly?
|
||||
if isinstance(value, dict):
|
||||
self.__dict__ = value
|
||||
elif isinstance(value, STRING_TYPES):
|
||||
self.__dict__ = json.loads(value)
|
||||
else:
|
||||
raise ValueError("Unable to handle type: {0}".format(type(value)))
|
||||
|
||||
def __getitem__(self, index):
|
||||
return self.__dict__[index]
|
||||
|
||||
def keys(self):
|
||||
return self.__dict__.keys()
|
||||
|
||||
def ensure_id(self):
|
||||
if "_id" not in self.__dict__:
|
||||
self.__dict__["_id"] = uuid.uuid4().hex
|
||||
return self.__dict__["_id"]
|
||||
|
||||
def __str__(self):
|
||||
return json.dumps(self.__dict__)
|
1170
elitebot/lib/python3.11/site-packages/mysqlx/errorcode.py
Normal file
1170
elitebot/lib/python3.11/site-packages/mysqlx/errorcode.py
Normal file
File diff suppressed because it is too large
Load diff
278
elitebot/lib/python3.11/site-packages/mysqlx/errors.py
Normal file
278
elitebot/lib/python3.11/site-packages/mysqlx/errors.py
Normal file
|
@ -0,0 +1,278 @@
|
|||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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."""
|
||||
|
||||
import sys
|
||||
import struct
|
||||
|
||||
from .locales import get_client_error
|
||||
|
||||
PY2 = sys.version_info[0] == 2
|
||||
|
||||
if PY2:
|
||||
def struct_unpack(fmt, buf):
|
||||
"""Wrapper around struct.unpack handling buffer as bytes and strings.
|
||||
"""
|
||||
if isinstance(buf, (bytearray, bytes)):
|
||||
return struct.unpack_from(fmt, buffer(buf))
|
||||
return struct.unpack_from(fmt, buf)
|
||||
else:
|
||||
from struct import unpack as struct_unpack
|
||||
|
||||
|
||||
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.encode("utf8") if PY2 else 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 Warning(Exception): # pylint: disable=W0622
|
||||
"""Exception for important warnings."""
|
||||
pass
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
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]
|
||||
else:
|
||||
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,
|
||||
}
|
848
elitebot/lib/python3.11/site-packages/mysqlx/expr.py
Normal file
848
elitebot/lib/python3.11/site-packages/mysqlx/expr.py
Normal file
|
@ -0,0 +1,848 @@
|
|||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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
|
||||
|
||||
from .compat import STRING_TYPES, PY3
|
||||
from .protobuf.mysqlx_datatypes_pb2 import Scalar
|
||||
from .protobuf.mysqlx_expr_pb2 import ColumnIdentifier, DocumentPathItem, Expr
|
||||
from .protobuf.mysqlx_crud_pb2 import Column, Order, Projection
|
||||
|
||||
|
||||
if PY3:
|
||||
xrange = range
|
||||
|
||||
|
||||
class TokenType:
|
||||
NOT = 1
|
||||
AND = 2
|
||||
OR = 3
|
||||
XOR = 4
|
||||
IS = 5
|
||||
LPAREN = 6
|
||||
RPAREN = 7
|
||||
LSQBRACKET = 8
|
||||
RSQBRACKET = 9
|
||||
BETWEEN = 10
|
||||
TRUE = 11
|
||||
NULL = 12
|
||||
FALSE = 13
|
||||
IN = 14
|
||||
LIKE = 15
|
||||
INTERVAL = 16
|
||||
REGEXP = 17
|
||||
ESCAPE = 18
|
||||
IDENT = 19
|
||||
LSTRING = 20
|
||||
LNUM = 21
|
||||
DOT = 22
|
||||
DOLLAR = 23
|
||||
COMMA = 24
|
||||
EQ = 25
|
||||
NE = 26
|
||||
GT = 27
|
||||
GE = 28
|
||||
LT = 29
|
||||
LE = 30
|
||||
BITAND = 31
|
||||
BITOR = 32
|
||||
BITXOR = 33
|
||||
LSHIFT = 34
|
||||
RSHIFT = 35
|
||||
PLUS = 36
|
||||
MINUS = 37
|
||||
MUL = 38
|
||||
DIV = 39
|
||||
HEX = 40
|
||||
BIN = 41
|
||||
NEG = 42
|
||||
BANG = 43
|
||||
MICROSECOND = 44
|
||||
SECOND = 45
|
||||
MINUTE = 46
|
||||
HOUR = 47
|
||||
DAY = 48
|
||||
WEEK = 49
|
||||
MONTH = 50
|
||||
QUARTER = 51
|
||||
YEAR = 52
|
||||
EROTEME = 53
|
||||
DOUBLESTAR = 54
|
||||
MOD = 55
|
||||
COLON = 56
|
||||
OROR = 57
|
||||
ANDAND = 58
|
||||
LCURLY = 59
|
||||
RCURLY = 60
|
||||
CAST = 61
|
||||
DOTSTAR = 62
|
||||
ORDERBY_ASC = 63
|
||||
ORDERBY_DESC = 64
|
||||
AS = 65
|
||||
|
||||
interval_units = set([
|
||||
TokenType.MICROSECOND,
|
||||
TokenType.SECOND,
|
||||
TokenType.MINUTE,
|
||||
TokenType.HOUR,
|
||||
TokenType.DAY,
|
||||
TokenType.WEEK,
|
||||
TokenType.MONTH,
|
||||
TokenType.QUARTER,
|
||||
TokenType.YEAR])
|
||||
|
||||
# map of reserved word to token type
|
||||
reservedWords = {
|
||||
"and": TokenType.AND,
|
||||
"or": TokenType.OR,
|
||||
"xor": TokenType.XOR,
|
||||
"is": TokenType.IS,
|
||||
"not": TokenType.NOT,
|
||||
"like": TokenType.LIKE,
|
||||
"in": TokenType.IN,
|
||||
"regexp": TokenType.REGEXP,
|
||||
"between": TokenType.BETWEEN,
|
||||
"interval": TokenType.INTERVAL,
|
||||
"escape": TokenType.ESCAPE,
|
||||
"cast": TokenType.CAST,
|
||||
"div": TokenType.DIV,
|
||||
"hex": TokenType.HEX,
|
||||
"bin": TokenType.BIN,
|
||||
"true": TokenType.TRUE,
|
||||
"false": TokenType.FALSE,
|
||||
"null": TokenType.NULL,
|
||||
"second": TokenType.SECOND,
|
||||
"minute": TokenType.MINUTE,
|
||||
"hour": TokenType.HOUR,
|
||||
"day": TokenType.DAY,
|
||||
"week": TokenType.WEEK,
|
||||
"month": TokenType.MONTH,
|
||||
"quarter": TokenType.QUARTER,
|
||||
"year": TokenType.YEAR,
|
||||
"microsecond": TokenType.MICROSECOND,
|
||||
"asc": TokenType.ORDERBY_ASC,
|
||||
"desc": TokenType.ORDERBY_DESC,
|
||||
"as": TokenType.AS
|
||||
}
|
||||
|
||||
|
||||
class Token:
|
||||
def __init__(self, type, val, len=1):
|
||||
self.type = type
|
||||
self.val = val
|
||||
self.len = len
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
def __str__(self):
|
||||
if self.type == TokenType.IDENT or self.type == TokenType.LNUM or \
|
||||
self.type == TokenType.LSTRING:
|
||||
return str(self.type) + "(" + self.val + ")"
|
||||
else:
|
||||
return str(self.type)
|
||||
|
||||
|
||||
# static protobuf helper functions
|
||||
|
||||
def build_null_scalar():
|
||||
return Scalar(type=Scalar.V_NULL)
|
||||
|
||||
|
||||
def build_double_scalar(d):
|
||||
return Scalar(type=Scalar.V_DOUBLE, v_double=d)
|
||||
|
||||
|
||||
def build_int_scalar(i):
|
||||
return Scalar(type=Scalar.V_SINT, v_signed_int=i)
|
||||
|
||||
|
||||
def build_string_scalar(s):
|
||||
if isinstance(s, STRING_TYPES):
|
||||
s = bytes(bytearray(s, "utf-8"))
|
||||
return Scalar(type=Scalar.V_STRING, v_string=Scalar.String(value=s))
|
||||
|
||||
|
||||
def build_bool_scalar(b):
|
||||
s = Scalar()
|
||||
s.type = Scalar.V_BOOL
|
||||
s.v_bool = b
|
||||
return s
|
||||
|
||||
|
||||
def build_literal_expr(anyval):
|
||||
e = Expr()
|
||||
e.type = Expr.LITERAL
|
||||
e.literal.CopyFrom(anyval)
|
||||
return e
|
||||
|
||||
|
||||
def build_unary_op(name, param):
|
||||
e = Expr()
|
||||
e.type = Expr.OPERATOR
|
||||
e.operator.name = name
|
||||
e.operator.param.add().CopyFrom(param)
|
||||
return e
|
||||
|
||||
|
||||
def escape_literal(string):
|
||||
return string.replace('"', '""')
|
||||
|
||||
|
||||
class ExprParser:
|
||||
def __init__(self, string, allowRelational):
|
||||
self.string = string
|
||||
self.tokens = []
|
||||
self.pos = 0
|
||||
self._allowRelationalColumns = allowRelational
|
||||
self.placeholder_name_to_position = {}
|
||||
self.positional_placeholder_count = 0
|
||||
self.lex()
|
||||
|
||||
# convencience checker for lexer
|
||||
def next_char_is(self, i, c):
|
||||
return i + 1 < len(self.string) and self.string[i + 1] == c
|
||||
|
||||
def lex_number(self, pos):
|
||||
# numeric literal
|
||||
start = pos
|
||||
found_dot = False
|
||||
while pos < len(self.string) and (self.string[pos].isdigit() or
|
||||
self.string[pos] == "."):
|
||||
if self.string[pos] == ".":
|
||||
if found_dot is True:
|
||||
raise ValueError("Invalid number. Found multiple '.'")
|
||||
found_dot = True
|
||||
# technically we allow more than one "." and let float()'s parsing
|
||||
# complain later
|
||||
pos = pos + 1
|
||||
val = self.string[start:pos]
|
||||
t = Token(TokenType.LNUM, val, len(val))
|
||||
return t
|
||||
|
||||
def lex_alpha(self, i):
|
||||
start = i
|
||||
while i < len(self.string) and (self.string[i].isalnum() or
|
||||
self.string[i] == "_"):
|
||||
i = i + 1
|
||||
val = self.string[start:i]
|
||||
try:
|
||||
token = Token(reservedWords[val.lower()], val.upper(), len(val))
|
||||
except KeyError:
|
||||
token = Token(TokenType.IDENT, val, len(val))
|
||||
return token
|
||||
|
||||
def lex_quoted_token(self, i):
|
||||
quote_char = self.string[i]
|
||||
val = ""
|
||||
i += 1
|
||||
start = i
|
||||
while i < len(self.string):
|
||||
c = self.string[i]
|
||||
if c == quote_char and i + 1 < len(self.string) and \
|
||||
self.string[i + 1] != quote_char:
|
||||
# break if we have a quote char that's not double
|
||||
break
|
||||
elif c == quote_char or c == "\\":
|
||||
# this quote char has to be doubled
|
||||
if i + 1 >= len(self.string):
|
||||
break
|
||||
i = i + 1
|
||||
val = val + self.string[i]
|
||||
else:
|
||||
val = val + c
|
||||
i = i + 1
|
||||
if i >= len(self.string) or self.string[i] != quote_char:
|
||||
raise ValueError("Unterminated quoted string starting at {0}"
|
||||
"".format(start))
|
||||
if quote_char == "`":
|
||||
return Token(TokenType.IDENT, val, len(val)+2)
|
||||
else:
|
||||
return Token(TokenType.LSTRING, val, len(val)+2)
|
||||
|
||||
def lex(self):
|
||||
i = 0
|
||||
while i < len(self.string):
|
||||
c = self.string[i]
|
||||
if c.isspace():
|
||||
i += 1
|
||||
continue
|
||||
elif c.isdigit():
|
||||
token = self.lex_number(i)
|
||||
elif c.isalpha() or c == "_":
|
||||
token = self.lex_alpha(i)
|
||||
elif c == "?":
|
||||
token = Token(TokenType.EROTEME, c)
|
||||
elif c == ":":
|
||||
token = Token(TokenType.COLON, c)
|
||||
elif c == "{":
|
||||
token = Token(TokenType.LCURLY, c)
|
||||
elif c == "}":
|
||||
token = Token(TokenType.RCURLY, c)
|
||||
elif c == "+":
|
||||
token = Token(TokenType.PLUS, c)
|
||||
elif c == "-":
|
||||
Token(TokenType.MINUS, c)
|
||||
elif c == "*":
|
||||
if self.next_char_is(i, "*"):
|
||||
token = Token(TokenType.DOUBLESTAR, "**")
|
||||
else:
|
||||
token = Token(TokenType.MUL, c)
|
||||
elif c == "/":
|
||||
token = Token(TokenType.DIV, c)
|
||||
elif c == "$":
|
||||
token = Token(TokenType.DOLLAR, c)
|
||||
elif c == "%":
|
||||
token = Token(TokenType.MOD, c)
|
||||
elif c == "=":
|
||||
if self.next_char_is(i, "="):
|
||||
token = Token(TokenType.EQ, "==", 2)
|
||||
else:
|
||||
token = Token(TokenType.EQ, "==", 1)
|
||||
elif c == "&":
|
||||
if self.next_char_is(i, "&"):
|
||||
token = Token(TokenType.ANDAND, c)
|
||||
else:
|
||||
token = Token(TokenType.BITAND, c)
|
||||
elif c == "|":
|
||||
if self.next_char_is(i, "|"):
|
||||
token = Token(TokenType.OROR, "||")
|
||||
else:
|
||||
token = Token(TokenType.BITOR, c)
|
||||
elif c == "(":
|
||||
token = Token(TokenType.LPAREN, c)
|
||||
elif c == ")":
|
||||
token = Token(TokenType.RPAREN, c)
|
||||
elif c == "[":
|
||||
token = Token(TokenType.LSQBRACKET, c)
|
||||
elif c == "]":
|
||||
token = Token(TokenType.RSQBRACKET, c)
|
||||
elif c == "~":
|
||||
token = Token(TokenType.NEG, c)
|
||||
elif c == ",":
|
||||
token = Token(TokenType.COMMA, c)
|
||||
elif c == "!":
|
||||
if self.next_char_is(i, "="):
|
||||
token = Token(TokenType.NE, "!=")
|
||||
else:
|
||||
token = Token(TokenType.BANG, c)
|
||||
elif c == "<":
|
||||
if self.next_char_is(i, "<"):
|
||||
token = Token(TokenType.LSHIFT, "<<")
|
||||
elif self.next_char_is(i, "="):
|
||||
token = Token(TokenType.LE, "<=")
|
||||
else:
|
||||
token = Token(TokenType.LT, c)
|
||||
elif c == ">":
|
||||
if self.next_char_is(i, ">"):
|
||||
token = Token(TokenType.RSHIFT, ">>")
|
||||
elif self.next_char_is(i, "="):
|
||||
token = Token(TokenType.GE, ">=")
|
||||
else:
|
||||
token = Token(TokenType.GT, c)
|
||||
elif c == ".":
|
||||
if self.next_char_is(i, "*"):
|
||||
token = Token(TokenType.DOTSTAR, ".*")
|
||||
elif i + 1 < len(self.string) and self.string[i + 1].isdigit():
|
||||
token = self.lex_number(i)
|
||||
else:
|
||||
token = Token(TokenType.DOT, c)
|
||||
elif c == '"' or c == "'" or c == "`":
|
||||
token = self.lex_quoted_token(i)
|
||||
else:
|
||||
raise ValueError("Unknown character at {0}".format(i))
|
||||
self.tokens.append(token)
|
||||
i += token.len
|
||||
|
||||
def assert_cur_token(self, type):
|
||||
if self.pos >= len(self.tokens):
|
||||
raise ValueError("Expected token type {0} at pos {1} but no "
|
||||
"tokens left".format(type, self.pos))
|
||||
if self.tokens[self.pos].type != type:
|
||||
raise ValueError("Expected token type {0} at pos {1} but found "
|
||||
"type {2}".format(type, self.pos,
|
||||
self.tokens[self.pos]))
|
||||
|
||||
def cur_token_type_is(self, type):
|
||||
return self.pos_token_type_is(self.pos, type)
|
||||
|
||||
def next_token_type_is(self, type):
|
||||
return self.pos_token_type_is(self.pos + 1, type)
|
||||
|
||||
def pos_token_type_is(self, pos, type):
|
||||
return pos < len(self.tokens) and self.tokens[pos].type == type
|
||||
|
||||
def consume_token(self, type):
|
||||
self.assert_cur_token(type)
|
||||
v = self.tokens[self.pos].val
|
||||
self.pos = self.pos + 1
|
||||
return v
|
||||
|
||||
def paren_expr_list(self):
|
||||
"""Parse a paren-bounded expression list for function arguments or IN
|
||||
list and return a list of Expr objects.
|
||||
"""
|
||||
exprs = []
|
||||
self.consume_token(TokenType.LPAREN)
|
||||
if not self.cur_token_type_is(TokenType.RPAREN):
|
||||
exprs.append(self.expr())
|
||||
while self.cur_token_type_is(TokenType.COMMA):
|
||||
self.pos = self.pos + 1
|
||||
exprs.append(self.expr())
|
||||
self.consume_token(TokenType.RPAREN)
|
||||
return exprs
|
||||
|
||||
def identifier(self):
|
||||
self.assert_cur_token(TokenType.IDENT)
|
||||
id = Identifier()
|
||||
if self.next_token_type_is(TokenType.DOT):
|
||||
id.schema_name = self.consume_token(TokenType.IDENT)
|
||||
self.consume_token(TokenType.DOT)
|
||||
id.name = self.tokens[self.pos].val
|
||||
self.pos = self.pos + 1
|
||||
return id
|
||||
|
||||
def function_call(self):
|
||||
e = Expr()
|
||||
e.type = Expr.FUNC_CALL
|
||||
e.function_call.name.CopyFrom(self.identifier())
|
||||
e.function_call.param.extend(self.paren_expr_list())
|
||||
return e
|
||||
|
||||
def docpath_member(self):
|
||||
self.consume_token(TokenType.DOT)
|
||||
token = self.tokens[self.pos]
|
||||
|
||||
if token.type == TokenType.IDENT:
|
||||
if token.val.startswith('`') and token.val.endswith('`'):
|
||||
raise ValueError("{0} is not a valid JSON/ECMAScript "
|
||||
"identifier".format(token.value))
|
||||
self.consume_token(TokenType.IDENT)
|
||||
memberName = token.val
|
||||
elif self.token.type == TokenType.LSTRING:
|
||||
self.consume_token(TokenType.LSTRING)
|
||||
memberName = token.val
|
||||
else:
|
||||
raise ValueError("Expected token type IDENT or LSTRING in JSON "
|
||||
"path at token pos {0}".format(self.pos))
|
||||
item = DocumentPathItem(type=DocumentPathItem.MEMBER, value=memberName)
|
||||
return item
|
||||
|
||||
def docpath_array_loc(self):
|
||||
self.consume_token(TokenType.LSQBRACKET)
|
||||
if self.cur_token_type_is(TokenType.MUL):
|
||||
self.consume_token(TokenType.RSQBRACKET)
|
||||
return DocumentPathItem(type=DocumentPathItem.ARRAY_INDEX_ASTERISK)
|
||||
elif self.cur_token_type_is(TokenType.LNUM):
|
||||
v = int(self.consume_token(TokenType.LNUM))
|
||||
if v < 0:
|
||||
raise IndexError("Array index cannot be negative at {0}"
|
||||
"".format(self.pos))
|
||||
self.consume_token(TokenType.RSQBRACKET)
|
||||
return DocumentPathItem(type=DocumentPathItem.ARRAY_INDEX, index=v)
|
||||
else:
|
||||
raise ValueError("Exception token type MUL or LNUM in JSON "
|
||||
"path array index at token pos {0}"
|
||||
"".format(self.pos))
|
||||
|
||||
def document_field(self):
|
||||
col = ColumnIdentifier()
|
||||
if self.cur_token_type_is(TokenType.IDENT):
|
||||
col.document_path.extend([
|
||||
DocumentPathItem(type=DocumentPathItem.MEMBER,
|
||||
value=self.consume_token(TokenType.IDENT))])
|
||||
col.document_path.extend(self.document_path())
|
||||
return Expr(type=Expr.IDENT, identifier=col)
|
||||
|
||||
def document_path(self):
|
||||
"""Parse a JSON-style document path, like WL#7909, but prefix by @.
|
||||
instead of $. We parse this as a string because the protocol doesn't
|
||||
support it. (yet)
|
||||
"""
|
||||
docpath = []
|
||||
while True:
|
||||
if self.cur_token_type_is(TokenType.DOT):
|
||||
docpath.append(self.docpath_member())
|
||||
elif self.cur_token_type_is(TokenType.DOTSTAR):
|
||||
self.consume_token(TokenType.DOTSTAR)
|
||||
docpath.append(DocumentPathItem(
|
||||
type=DocumentPathItem.MEMBER_ASTERISK))
|
||||
elif self.cur_token_type_is(TokenType.LSQBRACKET):
|
||||
docpath.append(self.docpath_array_loc())
|
||||
elif self.cur_token_type_is(TokenType.DOUBLESTAR):
|
||||
self.consume_token(TokenType.DOUBLESTAR)
|
||||
docpath.append(DocumentPathItem(
|
||||
type=DocumentPathItem.DOUBLE_ASTERISK))
|
||||
else:
|
||||
break
|
||||
items = len(docpath)
|
||||
if items > 0 and docpath[items-1].type == \
|
||||
DocumentPathItem.DOUBLE_ASTERISK:
|
||||
raise ValueError("JSON path may not end in '**' at {0}"
|
||||
"".format(self.pos))
|
||||
return docpath
|
||||
|
||||
def column_identifier(self):
|
||||
parts = []
|
||||
parts.append(self.consume_token(TokenType.IDENT))
|
||||
while self.cur_token_type_is(TokenType.DOT):
|
||||
self.consume_token(TokenType.DOT)
|
||||
parts.append(self.consume_token(TokenType.IDENT))
|
||||
if len(parts) > 3:
|
||||
raise ValueError("Too many parts to identifier at {0}"
|
||||
"".format(self.pos))
|
||||
parts.reverse()
|
||||
colid = ColumnIdentifier()
|
||||
# clever way to apply them to the struct
|
||||
for i in xrange(0, len(parts)):
|
||||
if i == 0:
|
||||
colid.name = parts[0]
|
||||
elif i == 1:
|
||||
colid.table_name = parts[1]
|
||||
elif i == 2:
|
||||
colid.schema_name = parts[2]
|
||||
if self.cur_token_type_is(TokenType.DOLLAR):
|
||||
self.consume_token(TokenType.DOLLAR)
|
||||
colid.document_path = self.document_path()
|
||||
e = Expr()
|
||||
e.type = Expr.IDENT
|
||||
e.identifier.CopyFrom(colid)
|
||||
return e
|
||||
|
||||
def next_token(self):
|
||||
if (self.pos >= len(self.tokens)):
|
||||
raise ValueError("Unexpected end of token stream")
|
||||
t = self.tokens[self.pos]
|
||||
self.pos += 1
|
||||
return t
|
||||
|
||||
def expect_token(self, token_type):
|
||||
t = self.next_token()
|
||||
if t.type != token_type:
|
||||
raise ValueError("Expected token type {0}".format(token_type))
|
||||
|
||||
def parse_json_doc(self):
|
||||
o = Object()
|
||||
|
||||
def parse_place_holder(self, token):
|
||||
place_holder_name = ""
|
||||
if self.cur_token_type_is(TokenType.LNUM):
|
||||
place_holder_name = self.consume_token(TokenType.LNUM_INT)
|
||||
elif self.cur_token_type_is(TokenType.IDENT):
|
||||
place_holder_name = self.consume_token(TokenType.IDENT)
|
||||
elif token.type == TokenType.EROTEME:
|
||||
place_holder_name = str(self.positional_placeholder_count)
|
||||
else:
|
||||
raise ValueError("Invalid placeholder name at token pos {0}"
|
||||
"".format(self.pos))
|
||||
|
||||
place_holder_name = place_holder_name.lower()
|
||||
expr = Expr(type=Expr.PLACEHOLDER)
|
||||
if place_holder_name in self.placeholder_name_to_position:
|
||||
expr.position = \
|
||||
self.placeholder_name_to_position[place_holder_name]
|
||||
else:
|
||||
expr.position = self.positional_placeholder_count
|
||||
self.placeholder_name_to_position[place_holder_name] = \
|
||||
self.positional_placeholder_count
|
||||
self.positional_placeholder_count += 1
|
||||
return expr
|
||||
|
||||
def atomic_expr(self):
|
||||
"""Parse an atomic expression and return a protobuf Expr object"""
|
||||
token = self.next_token()
|
||||
|
||||
if token.type in [TokenType.EROTEME, TokenType.COLON]:
|
||||
return self.parse_place_holder(token)
|
||||
elif token.type == TokenType.LCURLY:
|
||||
return self.parse_json_doc()
|
||||
elif token.type == TokenType.CAST:
|
||||
# TODO implement pass
|
||||
pass
|
||||
elif token.type == TokenType.LPAREN:
|
||||
e = self.expr()
|
||||
self.expect_token(TokenType.RPAREN)
|
||||
return e
|
||||
elif token.type in [TokenType.PLUS, TokenType.MINUS]:
|
||||
pass
|
||||
elif token.type in [TokenType.PLUS, TokenType.MINUS]:
|
||||
peek = self.peek_token()
|
||||
if peek.type == TokenType.LNUM:
|
||||
self.tokens[self.pos].val = token.val + peek.val
|
||||
return self.atomic_expr()
|
||||
return build_unary_op(token.val, self.atomic_expr())
|
||||
elif token.type in [TokenType.NOT, TokenType.NEG, TokenType.BANG]:
|
||||
return build_unary_op(token.val, self.atomic_expr())
|
||||
elif token.type == TokenType.LSTRING:
|
||||
return build_literal_expr(build_string_scalar(token.val))
|
||||
elif token.type == TokenType.NULL:
|
||||
return build_literal_expr(build_null_scalar())
|
||||
elif token.type == TokenType.LNUM:
|
||||
if "." in token.val:
|
||||
return build_literal_expr(
|
||||
build_double_scalar(float(token.val)))
|
||||
else:
|
||||
return build_literal_expr(build_int_scalar(int(token.val)))
|
||||
elif token.type in [TokenType.TRUE, TokenType.FALSE]:
|
||||
return build_literal_expr(
|
||||
build_bool_scalar(token.type == TokenType.TRUE))
|
||||
elif token.type == TokenType.DOLLAR:
|
||||
return self.document_field()
|
||||
elif token.type == TokenType.MUL:
|
||||
return self.starOperator()
|
||||
elif token.type == TokenType.IDENT:
|
||||
self.pos = self.pos - 1 # stay on the identifier
|
||||
if self.next_token_type_is(TokenType.LPAREN) or \
|
||||
(self.next_token_type_is(TokenType.DOT) and
|
||||
self.pos_token_type_is(self.pos + 2, TokenType.IDENT) and
|
||||
self.pos_token_type_is(self.pos + 3, TokenType.LPAREN)):
|
||||
# Function call
|
||||
return self.function_call()
|
||||
else:
|
||||
return (self.document_field()
|
||||
if not self._allowRelationalColumns
|
||||
else self.column_identifier())
|
||||
|
||||
# if t.type == TokenType.EROTEME:
|
||||
# return build_literal_expr(build_string_scalar("?"))
|
||||
# elif t.type == TokenType.INTERVAL:
|
||||
# e = Expr()
|
||||
# e.type = Expr.OPERATOR
|
||||
# e.operator.name = "INTERVAL"
|
||||
# e.operator.param.add().CopyFrom(self.expr())
|
||||
# # validate the interval units
|
||||
# if self.pos < len(self.tokens) and self.tokens[self.pos].type in interval_units:
|
||||
# pass
|
||||
# else:
|
||||
# raise StandardError("Expected interval units at " + str(self.pos))
|
||||
# e.operator.param.add().CopyFrom(build_literal_expr(build_string_scalar(self.tokens[self.pos].val)))
|
||||
# self.pos = self.pos + 1
|
||||
# return e
|
||||
raise ValueError("Unknown token type = {0} when expecting atomic "
|
||||
"expression at {1}".format(token.type, self.pos))
|
||||
|
||||
def parse_left_assoc_binary_op_expr(self, types, inner_parser):
|
||||
"""Given a `set' of types and an Expr-returning inner parser function,
|
||||
parse a left associate binary operator expression"""
|
||||
lhs = inner_parser()
|
||||
while (self.pos < len(self.tokens) and
|
||||
self.tokens[self.pos].type in types):
|
||||
e = Expr()
|
||||
e.type = Expr.OPERATOR
|
||||
e.operator.name = self.tokens[self.pos].val
|
||||
e.operator.param.add().CopyFrom(lhs)
|
||||
self.pos = self.pos + 1
|
||||
e.operator.param.add().CopyFrom(inner_parser())
|
||||
lhs = e
|
||||
return lhs
|
||||
|
||||
# operator precedence is implemented here
|
||||
def mul_div_expr(self):
|
||||
return self.parse_left_assoc_binary_op_expr(
|
||||
set([TokenType.MUL, TokenType.DIV, TokenType.MOD]),
|
||||
self.atomic_expr)
|
||||
|
||||
def add_sub_expr(self):
|
||||
return self.parse_left_assoc_binary_op_expr(
|
||||
set([TokenType.PLUS, TokenType.MINUS]), self.mul_div_expr)
|
||||
|
||||
def shift_expr(self):
|
||||
return self.parse_left_assoc_binary_op_expr(
|
||||
set([TokenType.LSHIFT, TokenType.RSHIFT]), self.add_sub_expr)
|
||||
|
||||
def bit_expr(self):
|
||||
return self.parse_left_assoc_binary_op_expr(
|
||||
set([TokenType.BITAND, TokenType.BITOR, TokenType.BITXOR]),
|
||||
self.shift_expr)
|
||||
|
||||
def comp_expr(self):
|
||||
return self.parse_left_assoc_binary_op_expr(
|
||||
set([TokenType.GE, TokenType.GT, TokenType.LE, TokenType.LT,
|
||||
TokenType.EQ, TokenType.NE]), self.bit_expr)
|
||||
|
||||
def ilri_expr(self):
|
||||
lhs = self.comp_expr()
|
||||
is_not = False
|
||||
if self.cur_token_type_is(TokenType.NOT):
|
||||
is_not = True
|
||||
self.consume_token(TokenType.NOT)
|
||||
if self.pos < len(self.tokens):
|
||||
params = [lhs]
|
||||
op_name = self.tokens[self.pos].val
|
||||
if self.cur_token_type_is(TokenType.IS):
|
||||
self.consume_token(TokenType.IS)
|
||||
# for IS, NOT comes AFTER
|
||||
if self.cur_token_type_is(TokenType.NOT):
|
||||
is_not = True
|
||||
self.consume_token(TokenType.NOT)
|
||||
params.append(self.comp_expr())
|
||||
elif self.cur_token_type_is(TokenType.IN):
|
||||
self.consume_token(TokenType.IN)
|
||||
params.extend(self.paren_expr_list())
|
||||
elif self.cur_token_type_is(TokenType.LIKE):
|
||||
self.consume_token(TokenType.LIKE)
|
||||
params.append(self.comp_expr())
|
||||
if self.cur_token_type_is(TokenType.ESCAPE):
|
||||
self.consume_token(TokenType.ESCAPE)
|
||||
params.append(self.comp_expr())
|
||||
elif self.cur_token_type_is(TokenType.BETWEEN):
|
||||
self.consume_token(TokenType.BETWEEN)
|
||||
params.append(self.comp_expr())
|
||||
self.consume_token(TokenType.AND)
|
||||
params.append(self.comp_expr())
|
||||
elif self.cur_token_type_is(TokenType.REGEXP):
|
||||
self.consume_token(TokenType.REGEXP)
|
||||
params.append(self.comp_expr())
|
||||
else:
|
||||
if is_not:
|
||||
raise ValueError("Unknown token after NOT as pos {0}"
|
||||
"".format(self.pos))
|
||||
op_name = None # not an operator we're interested in
|
||||
if op_name:
|
||||
e = Expr()
|
||||
e.type = Expr.OPERATOR
|
||||
e.operator.name = op_name
|
||||
e.operator.param.extend(params)
|
||||
if is_not:
|
||||
# wrap if `NOT'-prefixed
|
||||
e = build_unary_op("NOT", e)
|
||||
lhs = e
|
||||
return lhs
|
||||
|
||||
def and_expr(self):
|
||||
return self.parse_left_assoc_binary_op_expr(
|
||||
set([TokenType.AND, TokenType.ANDAND]), self.ilri_expr)
|
||||
|
||||
def or_expr(self):
|
||||
return self.parse_left_assoc_binary_op_expr(
|
||||
set([TokenType.OR, TokenType.OROR]), self.and_expr)
|
||||
|
||||
def expr(self):
|
||||
return self.or_expr()
|
||||
|
||||
def parse_table_insert_field(self):
|
||||
return Column(name=self.consume_token(TokenType.IDENT))
|
||||
|
||||
def parse_table_update_field(self):
|
||||
return self.column_identifier().identifier
|
||||
|
||||
def parse_table_select_projection(self):
|
||||
project_expr = []
|
||||
first = True
|
||||
while self.pos < len(self.tokens):
|
||||
if not first:
|
||||
self.consume_token(TokenType.COMMA)
|
||||
first = False
|
||||
projection = Projection(source=self.expr())
|
||||
if self.cur_token_type_is(TokenType.AS):
|
||||
self.consume_token(TokenType.AS)
|
||||
projection.alias = self.consume_token(TokenType.IDENT)
|
||||
else:
|
||||
self.pos -= 1
|
||||
projection.alias = self.consume_token(TokenType.IDENT)
|
||||
project_expr.append(projection)
|
||||
return project_expr
|
||||
|
||||
def parse_order_spec(self):
|
||||
order_specs = []
|
||||
first = True
|
||||
while self.pos < len(self.tokens):
|
||||
if not first:
|
||||
self.consume_token(TokenType.COMMA)
|
||||
first = False
|
||||
order = Order(expr=self.expr())
|
||||
if self.cur_token_type_is(TokenType.ORDERBY_ASC):
|
||||
order.direction = Order.ASC
|
||||
self.consume_token(TokenType.ORDERBY_ASC)
|
||||
elif self.cur_token_type_is(TokenType.ORDERBY_DESC):
|
||||
order.direction = Order.DESC
|
||||
self.consume_token(TokenType.ORDERBY_DESC)
|
||||
order_specs.append(order)
|
||||
return order_specs
|
||||
|
||||
def parse_expr_list(self):
|
||||
expr_list = []
|
||||
first = True
|
||||
while self.pos < len(self.tokens):
|
||||
if not first:
|
||||
self.consume_token(TokenType.COMMA)
|
||||
first = False
|
||||
expr_list.append(self.expr())
|
||||
return expr_list
|
||||
|
||||
|
||||
def parseAndPrintExpr(expr_string, allowRelational=True):
|
||||
print(">>>>>>> parsing: {0}".format(expr_string))
|
||||
p = ExprParser(expr_string, allowRelational)
|
||||
print(p.tokens)
|
||||
e = p.expr()
|
||||
print(e)
|
||||
|
||||
|
||||
def x_test():
|
||||
parseAndPrintExpr("name like :name")
|
||||
return
|
||||
parseAndPrintExpr("10+1")
|
||||
parseAndPrintExpr("(abc == 1)")
|
||||
parseAndPrintExpr("(func(abc)=1)")
|
||||
parseAndPrintExpr("(abc = \"jess\")")
|
||||
parseAndPrintExpr("(abc = \"with \\\"\")")
|
||||
parseAndPrintExpr("(abc != .10)")
|
||||
parseAndPrintExpr("(abc != \"xyz\")")
|
||||
parseAndPrintExpr("a + b * c + d")
|
||||
parseAndPrintExpr("(a + b) * c + d")
|
||||
parseAndPrintExpr("(field not in ('a',func('b', 2.0),'c'))")
|
||||
parseAndPrintExpr("jess.age between 30 and death")
|
||||
parseAndPrintExpr("a + b * c + d")
|
||||
parseAndPrintExpr("x > 10 and Y >= -20")
|
||||
parseAndPrintExpr("a is true and b is null and C + 1 > 40 and "
|
||||
"(time = now() or hungry())")
|
||||
parseAndPrintExpr("a + b + -c > 2")
|
||||
parseAndPrintExpr("now () + b + c > 2")
|
||||
parseAndPrintExpr("now () + @b + c > 2")
|
||||
parseAndPrintExpr("now () - interval +2 day > some_other_time() or "
|
||||
"something_else IS NOT NULL")
|
||||
parseAndPrintExpr("\"two quotes to one\"\"\"")
|
||||
parseAndPrintExpr("'two quotes to one'''")
|
||||
parseAndPrintExpr("'different quote \"'")
|
||||
parseAndPrintExpr("\"different quote '\"")
|
||||
parseAndPrintExpr("`ident`")
|
||||
parseAndPrintExpr("`ident```")
|
||||
parseAndPrintExpr("`ident\"'`")
|
||||
parseAndPrintExpr("now () - interval -2 day")
|
||||
parseAndPrintExpr("? > x and func(?, ?, ?)")
|
||||
parseAndPrintExpr("a > now() + interval (2 + x) MiNuTe")
|
||||
parseAndPrintExpr("a between 1 and 2")
|
||||
parseAndPrintExpr("a not between 1 and 2")
|
||||
parseAndPrintExpr("a in (1,2,a.b(3),4,5,x)")
|
||||
parseAndPrintExpr("a not in (1,2,3,4,5,@x)")
|
||||
parseAndPrintExpr("a like b escape c")
|
||||
parseAndPrintExpr("a not like b escape c")
|
||||
parseAndPrintExpr("(1 + 3) in (3, 4, 5)")
|
||||
parseAndPrintExpr("`a crazy \"function\"``'name'`(1 + 3) in (3, 4, 5)")
|
||||
parseAndPrintExpr("`a crazy \"function\"``'name'`(1 + 3) in (3, 4, 5)")
|
||||
parseAndPrintExpr("a@.b", False)
|
||||
parseAndPrintExpr("a@.b[0][0].c**.d.\"a weird\\\"key name\"", False)
|
||||
parseAndPrintExpr("a@.*", False)
|
||||
parseAndPrintExpr("a@[0].*", False)
|
||||
parseAndPrintExpr("a@**[0].*", False)
|
||||
|
||||
# x_test()
|
125
elitebot/lib/python3.11/site-packages/mysqlx/expr_unparser.py
Normal file
125
elitebot/lib/python3.11/site-packages/mysqlx/expr_unparser.py
Normal file
|
@ -0,0 +1,125 @@
|
|||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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
|
||||
|
||||
from .protobuf.mysqlx_datatypes_pb2 import *
|
||||
from .protobuf.mysqlx_expr_pb2 import *
|
||||
|
||||
|
||||
def escape_literal(string):
|
||||
return string.replace('"', '""')
|
||||
|
||||
|
||||
def scalar_to_string(s):
|
||||
if s.type == Scalar.V_SINT:
|
||||
return str(s.v_signed_int)
|
||||
elif s.type == Scalar.V_DOUBLE:
|
||||
return str(s.v_double)
|
||||
elif s.type == Scalar.V_BOOL:
|
||||
if s.v_bool:
|
||||
return "TRUE"
|
||||
else:
|
||||
return "FALSE"
|
||||
elif s.type == Scalar.V_STRING:
|
||||
return '"{0}"'.format(escape_literal(s.v_string.value))
|
||||
elif s.type == Scalar.V_NULL:
|
||||
return "NULL"
|
||||
else:
|
||||
raise ValueError("Unknown type tag: {0}".format(s.type))
|
||||
|
||||
|
||||
def column_identifier_to_string(id):
|
||||
s = quote_identifier(id.name)
|
||||
if id.HasField("table_name"):
|
||||
s = "{0}.{1}".format(quote_identifier(id.table_name), s)
|
||||
if id.HasField("schema_name"):
|
||||
s = "{0}.{1}".format(quote_identifier(id.schema_name), s)
|
||||
# if id.HasField("document_path"):
|
||||
# s = "{0}@{1}".format(s, id.document_path)
|
||||
return s
|
||||
|
||||
|
||||
def function_call_to_string(fc):
|
||||
s = quote_identifier(fc.name.name) + "("
|
||||
if fc.name.HasField("schema_name"):
|
||||
s = quote_identifier(fc.name.schema_name) + "." + s
|
||||
for i in xrange(0, len(fc.param)):
|
||||
s = s + expr_to_string(fc.param[i])
|
||||
if i + 1 < len(fc.param):
|
||||
s = s + ", "
|
||||
return s + ")"
|
||||
|
||||
|
||||
def operator_to_string(op):
|
||||
ps = op.param
|
||||
if op.name == "IN":
|
||||
s = expr_to_string(ps[0]) + " IN ("
|
||||
for i in xrange(1, len(ps)):
|
||||
s = s + expr_to_string(ps[i])
|
||||
if i + 1 < len(ps):
|
||||
s = s + ", "
|
||||
return s + ")"
|
||||
elif op.name == "INTERVAL":
|
||||
return ("INTERVAL {0} {1}"
|
||||
"".format(expr_to_string(ps[0]),
|
||||
expr_to_string(ps[1]).replace('"', '')))
|
||||
elif op.name == "BETWEEN":
|
||||
return "{0} BETWEEN {1} AND {2}".format(expr_to_string(ps[0]),
|
||||
expr_to_string(ps[1]),
|
||||
expr_to_string(ps[2]))
|
||||
elif op.name == "LIKE" and len(ps) == 3:
|
||||
return "{0} LIKE {1} ESCAPE {2}".format(expr_to_string(ps[0]),
|
||||
expr_to_string(ps[1]),
|
||||
expr_to_string(ps[2]))
|
||||
elif len(ps) == 2:
|
||||
return "{0} {1} {2}".format(expr_to_string(ps[0]), op.name,
|
||||
expr_to_string(ps[1]))
|
||||
elif len(ps) == 1:
|
||||
if len(op.name) == 1:
|
||||
return "{0}{1}".format(op.name, expr_to_string(ps[0]))
|
||||
else:
|
||||
# something like NOT
|
||||
return "{0} ({1})".format(op.name, expr_to_string(ps[0]))
|
||||
else:
|
||||
raise ValueError("Unknown operator structure: {0}".format(op))
|
||||
|
||||
|
||||
def quote_identifier(id):
|
||||
if "`" in id or '"' in id or "'" in id or "@" in id or "." in id:
|
||||
return "`{0}`".format(id.replace("`", "``"))
|
||||
else:
|
||||
return id
|
||||
|
||||
|
||||
def expr_to_string(e):
|
||||
if e.type == Expr.LITERAL:
|
||||
return scalar_to_string(e.literal)
|
||||
elif e.type == Expr.IDENT:
|
||||
return column_identifier_to_string(e.identifier)
|
||||
elif e.type == Expr.FUNC_CALL:
|
||||
return function_call_to_string(e.function_call)
|
||||
elif e.type == Expr.OPERATOR:
|
||||
return operator_to_string(e.operator)
|
||||
elif e.type == Expr.VARIABLE:
|
||||
return "@{0}".format(quote_identifier(e.variable))
|
||||
else:
|
||||
raise ValueError("Unknown expression type: {0}".format(e.type))
|
|
@ -0,0 +1,68 @@
|
|||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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")
|
|
@ -0,0 +1,95 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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 = '2016-05-31'
|
||||
_MYSQL_VERSION = (5, 7, 12)
|
||||
|
||||
# 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' (%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'"
|
||||
# End MySQL Error messages
|
||||
|
|
@ -0,0 +1,225 @@
|
|||
# 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
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='mysqlx_connection.proto',
|
||||
package='Mysqlx.Connection',
|
||||
syntax='proto3',
|
||||
serialized_pb=_b('\n\x17mysqlx_connection.proto\x12\x11Mysqlx.Connection\x1a\x16mysqlx_datatypes.proto\"@\n\nCapability\x12\x0c\n\x04name\x18\x01 \x01(\t\x12$\n\x05value\x18\x02 \x01(\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 \x01(\x0b\x32\x1f.Mysqlx.Connection.Capabilities\"\x07\n\x05\x43loseB\x1e\n\x1c\x63om.mysql.cj.mysqlx.protobufb\x06proto3')
|
||||
,
|
||||
dependencies=[mysqlx__datatypes__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=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='value', full_name='Mysqlx.Connection.Capability.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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=70,
|
||||
serialized_end=134,
|
||||
)
|
||||
|
||||
|
||||
_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=136,
|
||||
serialized_end=203,
|
||||
)
|
||||
|
||||
|
||||
_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=205,
|
||||
serialized_end=222,
|
||||
)
|
||||
|
||||
|
||||
_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=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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=224,
|
||||
serialized_end=296,
|
||||
)
|
||||
|
||||
|
||||
_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=298,
|
||||
serialized_end=305,
|
||||
)
|
||||
|
||||
_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
|
||||
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
|
||||
|
||||
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)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\034com.mysql.cj.mysqlx.protobuf'))
|
||||
# @@protoc_insertion_point(module_scope)
|
|
@ -0,0 +1,824 @@
|
|||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: mysqlx_crud.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()
|
||||
|
||||
|
||||
from mysqlx.protobuf import mysqlx_expr_pb2 as mysqlx__expr__pb2
|
||||
from mysqlx.protobuf import mysqlx_datatypes_pb2 as mysqlx__datatypes__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='mysqlx_crud.proto',
|
||||
package='Mysqlx.Crud',
|
||||
syntax='proto3',
|
||||
serialized_pb=_b('\n\x11mysqlx_crud.proto\x12\x0bMysqlx.Crud\x1a\x11mysqlx_expr.proto\x1a\x16mysqlx_datatypes.proto\"[\n\x06\x43olumn\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05\x61lias\x18\x02 \x01(\t\x12\x34\n\rdocument_path\x18\x03 \x03(\x0b\x32\x1d.Mysqlx.Expr.DocumentPathItem\">\n\nProjection\x12!\n\x06source\x18\x01 \x01(\x0b\x32\x11.Mysqlx.Expr.Expr\x12\r\n\x05\x61lias\x18\x02 \x01(\t\"*\n\nCollection\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06schema\x18\x02 \x01(\t\"*\n\x05Limit\x12\x11\n\trow_count\x18\x01 \x01(\x04\x12\x0e\n\x06offset\x18\x02 \x01(\x04\"\x83\x01\n\x05Order\x12\x1f\n\x04\x65xpr\x18\x01 \x01(\x0b\x32\x11.Mysqlx.Expr.Expr\x12/\n\tdirection\x18\x02 \x01(\x0e\x32\x1c.Mysqlx.Crud.Order.Direction\"(\n\tDirection\x12\x08\n\x04NONE\x10\x00\x12\x07\n\x03\x41SC\x10\x01\x12\x08\n\x04\x44\x45SC\x10\x02\"\xa5\x02\n\x0fUpdateOperation\x12-\n\x06source\x18\x01 \x01(\x0b\x32\x1d.Mysqlx.Expr.ColumnIdentifier\x12:\n\toperation\x18\x02 \x01(\x0e\x32\'.Mysqlx.Crud.UpdateOperation.UpdateType\x12 \n\x05value\x18\x03 \x01(\x0b\x32\x11.Mysqlx.Expr.Expr\"\x84\x01\n\nUpdateType\x12\x08\n\x04NONE\x10\x00\x12\x07\n\x03SET\x10\x01\x12\x0f\n\x0bITEM_REMOVE\x10\x02\x12\x0c\n\x08ITEM_SET\x10\x03\x12\x10\n\x0cITEM_REPLACE\x10\x04\x12\x0e\n\nITEM_MERGE\x10\x05\x12\x10\n\x0c\x41RRAY_INSERT\x10\x06\x12\x10\n\x0c\x41RRAY_APPEND\x10\x07\"\xf2\x02\n\x04\x46ind\x12+\n\ncollection\x18\x02 \x01(\x0b\x32\x17.Mysqlx.Crud.Collection\x12*\n\ndata_model\x18\x03 \x01(\x0e\x32\x16.Mysqlx.Crud.DataModel\x12+\n\nprojection\x18\x04 \x03(\x0b\x32\x17.Mysqlx.Crud.Projection\x12#\n\x08\x63riteria\x18\x05 \x01(\x0b\x32\x11.Mysqlx.Expr.Expr\x12&\n\x04\x61rgs\x18\x0b \x03(\x0b\x32\x18.Mysqlx.Datatypes.Scalar\x12!\n\x05limit\x18\x06 \x01(\x0b\x32\x12.Mysqlx.Crud.Limit\x12!\n\x05order\x18\x07 \x03(\x0b\x32\x12.Mysqlx.Crud.Order\x12#\n\x08grouping\x18\x08 \x03(\x0b\x32\x11.Mysqlx.Expr.Expr\x12,\n\x11grouping_criteria\x18\t \x01(\x0b\x32\x11.Mysqlx.Expr.Expr\"\x8b\x02\n\x06Insert\x12+\n\ncollection\x18\x01 \x01(\x0b\x32\x17.Mysqlx.Crud.Collection\x12*\n\ndata_model\x18\x02 \x01(\x0e\x32\x16.Mysqlx.Crud.DataModel\x12\'\n\nprojection\x18\x03 \x03(\x0b\x32\x13.Mysqlx.Crud.Column\x12)\n\x03row\x18\x04 \x03(\x0b\x32\x1c.Mysqlx.Crud.Insert.TypedRow\x12&\n\x04\x61rgs\x18\x05 \x03(\x0b\x32\x18.Mysqlx.Datatypes.Scalar\x1a,\n\x08TypedRow\x12 \n\x05\x66ield\x18\x01 \x03(\x0b\x32\x11.Mysqlx.Expr.Expr\"\xa5\x02\n\x06Update\x12+\n\ncollection\x18\x02 \x01(\x0b\x32\x17.Mysqlx.Crud.Collection\x12*\n\ndata_model\x18\x03 \x01(\x0e\x32\x16.Mysqlx.Crud.DataModel\x12#\n\x08\x63riteria\x18\x04 \x01(\x0b\x32\x11.Mysqlx.Expr.Expr\x12&\n\x04\x61rgs\x18\x08 \x03(\x0b\x32\x18.Mysqlx.Datatypes.Scalar\x12!\n\x05limit\x18\x05 \x01(\x0b\x32\x12.Mysqlx.Crud.Limit\x12!\n\x05order\x18\x06 \x03(\x0b\x32\x12.Mysqlx.Crud.Order\x12/\n\toperation\x18\x07 \x03(\x0b\x32\x1c.Mysqlx.Crud.UpdateOperation\"\xf4\x01\n\x06\x44\x65lete\x12+\n\ncollection\x18\x01 \x01(\x0b\x32\x17.Mysqlx.Crud.Collection\x12*\n\ndata_model\x18\x02 \x01(\x0e\x32\x16.Mysqlx.Crud.DataModel\x12#\n\x08\x63riteria\x18\x03 \x01(\x0b\x32\x11.Mysqlx.Expr.Expr\x12&\n\x04\x61rgs\x18\x06 \x03(\x0b\x32\x18.Mysqlx.Datatypes.Scalar\x12!\n\x05limit\x18\x04 \x01(\x0b\x32\x12.Mysqlx.Crud.Limit\x12!\n\x05order\x18\x05 \x03(\x0b\x32\x12.Mysqlx.Crud.Order*.\n\tDataModel\x12\x08\n\x04NONE\x10\x00\x12\x0c\n\x08\x44OCUMENT\x10\x01\x12\t\n\x05TABLE\x10\x02\x42\x1e\n\x1c\x63om.mysql.cj.mysqlx.protobufb\x06proto3')
|
||||
,
|
||||
dependencies=[mysqlx__expr__pb2.DESCRIPTOR,mysqlx__datatypes__pb2.DESCRIPTOR,])
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
_DATAMODEL = _descriptor.EnumDescriptor(
|
||||
name='DataModel',
|
||||
full_name='Mysqlx.Crud.DataModel',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='NONE', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='DOCUMENT', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='TABLE', index=2, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=1938,
|
||||
serialized_end=1984,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_DATAMODEL)
|
||||
|
||||
DataModel = enum_type_wrapper.EnumTypeWrapper(_DATAMODEL)
|
||||
NONE = 0
|
||||
DOCUMENT = 1
|
||||
TABLE = 2
|
||||
|
||||
|
||||
_ORDER_DIRECTION = _descriptor.EnumDescriptor(
|
||||
name='Direction',
|
||||
full_name='Mysqlx.Crud.Order.Direction',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='NONE', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ASC', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='DESC', index=2, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=414,
|
||||
serialized_end=454,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_ORDER_DIRECTION)
|
||||
|
||||
_UPDATEOPERATION_UPDATETYPE = _descriptor.EnumDescriptor(
|
||||
name='UpdateType',
|
||||
full_name='Mysqlx.Crud.UpdateOperation.UpdateType',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='NONE', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SET', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ITEM_REMOVE', index=2, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ITEM_SET', index=3, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ITEM_REPLACE', index=4, number=4,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ITEM_MERGE', index=5, number=5,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ARRAY_INSERT', index=6, number=6,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ARRAY_APPEND', index=7, number=7,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=618,
|
||||
serialized_end=750,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_UPDATEOPERATION_UPDATETYPE)
|
||||
|
||||
|
||||
_COLUMN = _descriptor.Descriptor(
|
||||
name='Column',
|
||||
full_name='Mysqlx.Crud.Column',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='name', full_name='Mysqlx.Crud.Column.name', 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),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='alias', full_name='Mysqlx.Crud.Column.alias', 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='document_path', full_name='Mysqlx.Crud.Column.document_path', index=2,
|
||||
number=3, 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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=77,
|
||||
serialized_end=168,
|
||||
)
|
||||
|
||||
|
||||
_PROJECTION = _descriptor.Descriptor(
|
||||
name='Projection',
|
||||
full_name='Mysqlx.Crud.Projection',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='source', full_name='Mysqlx.Crud.Projection.source', index=0,
|
||||
number=1, 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='alias', full_name='Mysqlx.Crud.Projection.alias', 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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=170,
|
||||
serialized_end=232,
|
||||
)
|
||||
|
||||
|
||||
_COLLECTION = _descriptor.Descriptor(
|
||||
name='Collection',
|
||||
full_name='Mysqlx.Crud.Collection',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='name', full_name='Mysqlx.Crud.Collection.name', 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),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='schema', full_name='Mysqlx.Crud.Collection.schema', 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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=234,
|
||||
serialized_end=276,
|
||||
)
|
||||
|
||||
|
||||
_LIMIT = _descriptor.Descriptor(
|
||||
name='Limit',
|
||||
full_name='Mysqlx.Crud.Limit',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='row_count', full_name='Mysqlx.Crud.Limit.row_count', 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='offset', full_name='Mysqlx.Crud.Limit.offset', 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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=278,
|
||||
serialized_end=320,
|
||||
)
|
||||
|
||||
|
||||
_ORDER = _descriptor.Descriptor(
|
||||
name='Order',
|
||||
full_name='Mysqlx.Crud.Order',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='expr', full_name='Mysqlx.Crud.Order.expr', index=0,
|
||||
number=1, 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='direction', full_name='Mysqlx.Crud.Order.direction', 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),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_ORDER_DIRECTION,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=323,
|
||||
serialized_end=454,
|
||||
)
|
||||
|
||||
|
||||
_UPDATEOPERATION = _descriptor.Descriptor(
|
||||
name='UpdateOperation',
|
||||
full_name='Mysqlx.Crud.UpdateOperation',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='source', full_name='Mysqlx.Crud.UpdateOperation.source', index=0,
|
||||
number=1, 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='operation', full_name='Mysqlx.Crud.UpdateOperation.operation', 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='value', full_name='Mysqlx.Crud.UpdateOperation.value', 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),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_UPDATEOPERATION_UPDATETYPE,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=457,
|
||||
serialized_end=750,
|
||||
)
|
||||
|
||||
|
||||
_FIND = _descriptor.Descriptor(
|
||||
name='Find',
|
||||
full_name='Mysqlx.Crud.Find',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='collection', full_name='Mysqlx.Crud.Find.collection', index=0,
|
||||
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='data_model', full_name='Mysqlx.Crud.Find.data_model', index=1,
|
||||
number=3, 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='projection', full_name='Mysqlx.Crud.Find.projection', index=2,
|
||||
number=4, 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='criteria', full_name='Mysqlx.Crud.Find.criteria', 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='args', full_name='Mysqlx.Crud.Find.args', index=4,
|
||||
number=11, 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='limit', full_name='Mysqlx.Crud.Find.limit', 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='order', full_name='Mysqlx.Crud.Find.order', index=6,
|
||||
number=7, 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='grouping', full_name='Mysqlx.Crud.Find.grouping', index=7,
|
||||
number=8, 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='grouping_criteria', full_name='Mysqlx.Crud.Find.grouping_criteria', 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=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=753,
|
||||
serialized_end=1123,
|
||||
)
|
||||
|
||||
|
||||
_INSERT_TYPEDROW = _descriptor.Descriptor(
|
||||
name='TypedRow',
|
||||
full_name='Mysqlx.Crud.Insert.TypedRow',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='field', full_name='Mysqlx.Crud.Insert.TypedRow.field', 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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=1349,
|
||||
serialized_end=1393,
|
||||
)
|
||||
|
||||
_INSERT = _descriptor.Descriptor(
|
||||
name='Insert',
|
||||
full_name='Mysqlx.Crud.Insert',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='collection', full_name='Mysqlx.Crud.Insert.collection', index=0,
|
||||
number=1, 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='data_model', full_name='Mysqlx.Crud.Insert.data_model', 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='projection', full_name='Mysqlx.Crud.Insert.projection', index=2,
|
||||
number=3, 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='row', full_name='Mysqlx.Crud.Insert.row', index=3,
|
||||
number=4, 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='args', full_name='Mysqlx.Crud.Insert.args', index=4,
|
||||
number=5, 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=[_INSERT_TYPEDROW, ],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=1126,
|
||||
serialized_end=1393,
|
||||
)
|
||||
|
||||
|
||||
_UPDATE = _descriptor.Descriptor(
|
||||
name='Update',
|
||||
full_name='Mysqlx.Crud.Update',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='collection', full_name='Mysqlx.Crud.Update.collection', index=0,
|
||||
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='data_model', full_name='Mysqlx.Crud.Update.data_model', index=1,
|
||||
number=3, 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='criteria', full_name='Mysqlx.Crud.Update.criteria', index=2,
|
||||
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='args', full_name='Mysqlx.Crud.Update.args', index=3,
|
||||
number=8, 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='limit', full_name='Mysqlx.Crud.Update.limit', 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='order', full_name='Mysqlx.Crud.Update.order', index=5,
|
||||
number=6, 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='operation', full_name='Mysqlx.Crud.Update.operation', index=6,
|
||||
number=7, 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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=1396,
|
||||
serialized_end=1689,
|
||||
)
|
||||
|
||||
|
||||
_DELETE = _descriptor.Descriptor(
|
||||
name='Delete',
|
||||
full_name='Mysqlx.Crud.Delete',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
containing_type=None,
|
||||
fields=[
|
||||
_descriptor.FieldDescriptor(
|
||||
name='collection', full_name='Mysqlx.Crud.Delete.collection', index=0,
|
||||
number=1, 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='data_model', full_name='Mysqlx.Crud.Delete.data_model', 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='criteria', full_name='Mysqlx.Crud.Delete.criteria', 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='args', full_name='Mysqlx.Crud.Delete.args', index=3,
|
||||
number=6, 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='limit', full_name='Mysqlx.Crud.Delete.limit', index=4,
|
||||
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='order', full_name='Mysqlx.Crud.Delete.order', index=5,
|
||||
number=5, 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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=1692,
|
||||
serialized_end=1936,
|
||||
)
|
||||
|
||||
_COLUMN.fields_by_name['document_path'].message_type = mysqlx__expr__pb2._DOCUMENTPATHITEM
|
||||
_PROJECTION.fields_by_name['source'].message_type = mysqlx__expr__pb2._EXPR
|
||||
_ORDER.fields_by_name['expr'].message_type = mysqlx__expr__pb2._EXPR
|
||||
_ORDER.fields_by_name['direction'].enum_type = _ORDER_DIRECTION
|
||||
_ORDER_DIRECTION.containing_type = _ORDER
|
||||
_UPDATEOPERATION.fields_by_name['source'].message_type = mysqlx__expr__pb2._COLUMNIDENTIFIER
|
||||
_UPDATEOPERATION.fields_by_name['operation'].enum_type = _UPDATEOPERATION_UPDATETYPE
|
||||
_UPDATEOPERATION.fields_by_name['value'].message_type = mysqlx__expr__pb2._EXPR
|
||||
_UPDATEOPERATION_UPDATETYPE.containing_type = _UPDATEOPERATION
|
||||
_FIND.fields_by_name['collection'].message_type = _COLLECTION
|
||||
_FIND.fields_by_name['data_model'].enum_type = _DATAMODEL
|
||||
_FIND.fields_by_name['projection'].message_type = _PROJECTION
|
||||
_FIND.fields_by_name['criteria'].message_type = mysqlx__expr__pb2._EXPR
|
||||
_FIND.fields_by_name['args'].message_type = mysqlx__datatypes__pb2._SCALAR
|
||||
_FIND.fields_by_name['limit'].message_type = _LIMIT
|
||||
_FIND.fields_by_name['order'].message_type = _ORDER
|
||||
_FIND.fields_by_name['grouping'].message_type = mysqlx__expr__pb2._EXPR
|
||||
_FIND.fields_by_name['grouping_criteria'].message_type = mysqlx__expr__pb2._EXPR
|
||||
_INSERT_TYPEDROW.fields_by_name['field'].message_type = mysqlx__expr__pb2._EXPR
|
||||
_INSERT_TYPEDROW.containing_type = _INSERT
|
||||
_INSERT.fields_by_name['collection'].message_type = _COLLECTION
|
||||
_INSERT.fields_by_name['data_model'].enum_type = _DATAMODEL
|
||||
_INSERT.fields_by_name['projection'].message_type = _COLUMN
|
||||
_INSERT.fields_by_name['row'].message_type = _INSERT_TYPEDROW
|
||||
_INSERT.fields_by_name['args'].message_type = mysqlx__datatypes__pb2._SCALAR
|
||||
_UPDATE.fields_by_name['collection'].message_type = _COLLECTION
|
||||
_UPDATE.fields_by_name['data_model'].enum_type = _DATAMODEL
|
||||
_UPDATE.fields_by_name['criteria'].message_type = mysqlx__expr__pb2._EXPR
|
||||
_UPDATE.fields_by_name['args'].message_type = mysqlx__datatypes__pb2._SCALAR
|
||||
_UPDATE.fields_by_name['limit'].message_type = _LIMIT
|
||||
_UPDATE.fields_by_name['order'].message_type = _ORDER
|
||||
_UPDATE.fields_by_name['operation'].message_type = _UPDATEOPERATION
|
||||
_DELETE.fields_by_name['collection'].message_type = _COLLECTION
|
||||
_DELETE.fields_by_name['data_model'].enum_type = _DATAMODEL
|
||||
_DELETE.fields_by_name['criteria'].message_type = mysqlx__expr__pb2._EXPR
|
||||
_DELETE.fields_by_name['args'].message_type = mysqlx__datatypes__pb2._SCALAR
|
||||
_DELETE.fields_by_name['limit'].message_type = _LIMIT
|
||||
_DELETE.fields_by_name['order'].message_type = _ORDER
|
||||
DESCRIPTOR.message_types_by_name['Column'] = _COLUMN
|
||||
DESCRIPTOR.message_types_by_name['Projection'] = _PROJECTION
|
||||
DESCRIPTOR.message_types_by_name['Collection'] = _COLLECTION
|
||||
DESCRIPTOR.message_types_by_name['Limit'] = _LIMIT
|
||||
DESCRIPTOR.message_types_by_name['Order'] = _ORDER
|
||||
DESCRIPTOR.message_types_by_name['UpdateOperation'] = _UPDATEOPERATION
|
||||
DESCRIPTOR.message_types_by_name['Find'] = _FIND
|
||||
DESCRIPTOR.message_types_by_name['Insert'] = _INSERT
|
||||
DESCRIPTOR.message_types_by_name['Update'] = _UPDATE
|
||||
DESCRIPTOR.message_types_by_name['Delete'] = _DELETE
|
||||
DESCRIPTOR.enum_types_by_name['DataModel'] = _DATAMODEL
|
||||
|
||||
Column = _reflection.GeneratedProtocolMessageType('Column', (_message.Message,), dict(
|
||||
DESCRIPTOR = _COLUMN,
|
||||
__module__ = 'mysqlx_crud_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Crud.Column)
|
||||
))
|
||||
_sym_db.RegisterMessage(Column)
|
||||
|
||||
Projection = _reflection.GeneratedProtocolMessageType('Projection', (_message.Message,), dict(
|
||||
DESCRIPTOR = _PROJECTION,
|
||||
__module__ = 'mysqlx_crud_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Crud.Projection)
|
||||
))
|
||||
_sym_db.RegisterMessage(Projection)
|
||||
|
||||
Collection = _reflection.GeneratedProtocolMessageType('Collection', (_message.Message,), dict(
|
||||
DESCRIPTOR = _COLLECTION,
|
||||
__module__ = 'mysqlx_crud_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Crud.Collection)
|
||||
))
|
||||
_sym_db.RegisterMessage(Collection)
|
||||
|
||||
Limit = _reflection.GeneratedProtocolMessageType('Limit', (_message.Message,), dict(
|
||||
DESCRIPTOR = _LIMIT,
|
||||
__module__ = 'mysqlx_crud_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Crud.Limit)
|
||||
))
|
||||
_sym_db.RegisterMessage(Limit)
|
||||
|
||||
Order = _reflection.GeneratedProtocolMessageType('Order', (_message.Message,), dict(
|
||||
DESCRIPTOR = _ORDER,
|
||||
__module__ = 'mysqlx_crud_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Crud.Order)
|
||||
))
|
||||
_sym_db.RegisterMessage(Order)
|
||||
|
||||
UpdateOperation = _reflection.GeneratedProtocolMessageType('UpdateOperation', (_message.Message,), dict(
|
||||
DESCRIPTOR = _UPDATEOPERATION,
|
||||
__module__ = 'mysqlx_crud_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Crud.UpdateOperation)
|
||||
))
|
||||
_sym_db.RegisterMessage(UpdateOperation)
|
||||
|
||||
Find = _reflection.GeneratedProtocolMessageType('Find', (_message.Message,), dict(
|
||||
DESCRIPTOR = _FIND,
|
||||
__module__ = 'mysqlx_crud_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Crud.Find)
|
||||
))
|
||||
_sym_db.RegisterMessage(Find)
|
||||
|
||||
Insert = _reflection.GeneratedProtocolMessageType('Insert', (_message.Message,), dict(
|
||||
|
||||
TypedRow = _reflection.GeneratedProtocolMessageType('TypedRow', (_message.Message,), dict(
|
||||
DESCRIPTOR = _INSERT_TYPEDROW,
|
||||
__module__ = 'mysqlx_crud_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Crud.Insert.TypedRow)
|
||||
))
|
||||
,
|
||||
DESCRIPTOR = _INSERT,
|
||||
__module__ = 'mysqlx_crud_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Crud.Insert)
|
||||
))
|
||||
_sym_db.RegisterMessage(Insert)
|
||||
_sym_db.RegisterMessage(Insert.TypedRow)
|
||||
|
||||
Update = _reflection.GeneratedProtocolMessageType('Update', (_message.Message,), dict(
|
||||
DESCRIPTOR = _UPDATE,
|
||||
__module__ = 'mysqlx_crud_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Crud.Update)
|
||||
))
|
||||
_sym_db.RegisterMessage(Update)
|
||||
|
||||
Delete = _reflection.GeneratedProtocolMessageType('Delete', (_message.Message,), dict(
|
||||
DESCRIPTOR = _DELETE,
|
||||
__module__ = 'mysqlx_crud_pb2'
|
||||
# @@protoc_insertion_point(class_scope:Mysqlx.Crud.Delete)
|
||||
))
|
||||
_sym_db.RegisterMessage(Delete)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\034com.mysql.cj.mysqlx.protobuf'))
|
||||
# @@protoc_insertion_point(module_scope)
|
|
@ -0,0 +1,490 @@
|
|||
# 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='proto3',
|
||||
serialized_pb=_b('\n\x16mysqlx_datatypes.proto\x12\x10Mysqlx.Datatypes\"\xd0\x03\n\x06Scalar\x12+\n\x04type\x18\x01 \x01(\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 \x01(\x0c\x12\x11\n\tcollation\x18\x02 \x01(\x04\x1a-\n\x06Octets\x12\r\n\x05value\x18\x01 \x01(\x0c\x12\x14\n\x0c\x63ontent_type\x18\x02 \x01(\r\"w\n\x04Type\x12\x08\n\x04NONE\x10\x00\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 \x01(\t\x12$\n\x05value\x18\x02 \x01(\x0b\x32\x15.Mysqlx.Datatypes.Any\"-\n\x05\x41rray\x12$\n\x05value\x18\x01 \x03(\x0b\x32\x15.Mysqlx.Datatypes.Any\"\xdd\x01\n\x03\x41ny\x12(\n\x04type\x18\x01 \x01(\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\"3\n\x04Type\x12\x08\n\x04NONE\x10\x00\x12\n\n\x06SCALAR\x10\x01\x12\n\n\x06OBJECT\x10\x02\x12\t\n\x05\x41RRAY\x10\x03\x42\x1e\n\x1c\x63om.mysql.cj.mysqlx.protobufb\x06proto3')
|
||||
)
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
_SCALAR_TYPE = _descriptor.EnumDescriptor(
|
||||
name='Type',
|
||||
full_name='Mysqlx.Datatypes.Scalar.Type',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='NONE', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_SINT', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_UINT', index=2, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_NULL', index=3, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_OCTETS', index=4, number=4,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_DOUBLE', index=5, number=5,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_FLOAT', index=6, number=6,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_BOOL', index=7, number=7,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='V_STRING', index=8, number=8,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=390,
|
||||
serialized_end=509,
|
||||
)
|
||||
_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='NONE', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SCALAR', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='OBJECT', index=2, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ARRAY', index=3, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=856,
|
||||
serialized_end=907,
|
||||
)
|
||||
_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=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.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='proto3',
|
||||
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=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='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='proto3',
|
||||
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=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_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=45,
|
||||
serialized_end=509,
|
||||
)
|
||||
|
||||
|
||||
_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=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='value', full_name='Mysqlx.Datatypes.Object.ObjectField.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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=572,
|
||||
serialized_end=636,
|
||||
)
|
||||
|
||||
_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=511,
|
||||
serialized_end=636,
|
||||
)
|
||||
|
||||
|
||||
_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=638,
|
||||
serialized_end=683,
|
||||
)
|
||||
|
||||
|
||||
_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=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='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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=686,
|
||||
serialized_end=907,
|
||||
)
|
||||
|
||||
_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\034com.mysql.cj.mysqlx.protobuf'))
|
||||
# @@protoc_insertion_point(module_scope)
|
|
@ -0,0 +1,214 @@
|
|||
# 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='proto3',
|
||||
serialized_pb=_b('\n\x13mysqlx_expect.proto\x12\rMysqlx.Expect\"\xdb\x02\n\x04Open\x12,\n\x02op\x18\x01 \x01(\x0e\x32 .Mysqlx.Expect.Open.CtxOperation\x12+\n\x04\x63ond\x18\x02 \x03(\x0b\x32\x1d.Mysqlx.Expect.Open.Condition\x1a\xb7\x01\n\tCondition\x12\x15\n\rcondition_key\x18\x01 \x01(\r\x12\x17\n\x0f\x63ondition_value\x18\x02 \x01(\x0c\x12<\n\x02op\x18\x03 \x01(\x0e\x32\x30.Mysqlx.Expect.Open.Condition.ConditionOperation\"<\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\x1e\n\x1c\x63om.mysql.cj.mysqlx.protobufb\x06proto3')
|
||||
)
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
_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=262,
|
||||
serialized_end=322,
|
||||
)
|
||||
_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=324,
|
||||
serialized_end=386,
|
||||
)
|
||||
_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=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='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=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=[
|
||||
_OPEN_CONDITION_CONDITIONOPERATION,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=139,
|
||||
serialized_end=322,
|
||||
)
|
||||
|
||||
_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=False, 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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=39,
|
||||
serialized_end=386,
|
||||
)
|
||||
|
||||
|
||||
_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=388,
|
||||
serialized_end=395,
|
||||
)
|
||||
|
||||
_OPEN_CONDITION.fields_by_name['op'].enum_type = _OPEN_CONDITION_CONDITIONOPERATION
|
||||
_OPEN_CONDITION.containing_type = _OPEN
|
||||
_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\034com.mysql.cj.mysqlx.protobuf'))
|
||||
# @@protoc_insertion_point(module_scope)
|
|
@ -0,0 +1,612 @@
|
|||
# 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='proto3',
|
||||
serialized_pb=_b('\n\x11mysqlx_expr.proto\x12\x0bMysqlx.Expr\x1a\x16mysqlx_datatypes.proto\"\xce\x03\n\x04\x45xpr\x12$\n\x04type\x18\x01 \x01(\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\"{\n\x04Type\x12\x08\n\x04NONE\x10\x00\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 \x01(\t\x12\x13\n\x0bschema_name\x18\x02 \x01(\t\"\xd5\x01\n\x10\x44ocumentPathItem\x12\x30\n\x04type\x18\x01 \x01(\x0e\x32\".Mysqlx.Expr.DocumentPathItem.Type\x12\r\n\x05value\x18\x02 \x01(\t\x12\r\n\x05index\x18\x03 \x01(\r\"q\n\x04Type\x12\x08\n\x04NONE\x10\x00\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 \x01(\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 \x01(\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 \x01(\t\x12 \n\x05value\x18\x02 \x01(\x0b\x32\x11.Mysqlx.Expr.Expr\")\n\x05\x41rray\x12 \n\x05value\x18\x01 \x03(\x0b\x32\x11.Mysqlx.Expr.ExprB\x1e\n\x1c\x63om.mysql.cj.mysqlx.protobufb\x06proto3')
|
||||
,
|
||||
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='NONE', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='IDENT', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='LITERAL', index=2, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='VARIABLE', index=3, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='FUNC_CALL', index=4, number=4,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='OPERATOR', index=5, number=5,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='PLACEHOLDER', index=6, number=6,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='OBJECT', index=7, number=7,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ARRAY', index=8, number=8,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=398,
|
||||
serialized_end=521,
|
||||
)
|
||||
_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='NONE', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='MEMBER', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='MEMBER_ASTERISK', index=2, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ARRAY_INDEX', index=3, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ARRAY_INDEX_ASTERISK', index=4, number=4,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='DOUBLE_ASTERISK', index=5, number=5,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=673,
|
||||
serialized_end=786,
|
||||
)
|
||||
_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=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='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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=59,
|
||||
serialized_end=521,
|
||||
)
|
||||
|
||||
|
||||
_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=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.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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=523,
|
||||
serialized_end=570,
|
||||
)
|
||||
|
||||
|
||||
_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=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='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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=573,
|
||||
serialized_end=786,
|
||||
)
|
||||
|
||||
|
||||
_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=788,
|
||||
serialized_end=915,
|
||||
)
|
||||
|
||||
|
||||
_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=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='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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=917,
|
||||
serialized_end=1004,
|
||||
)
|
||||
|
||||
|
||||
_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=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='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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=1006,
|
||||
serialized_end=1064,
|
||||
)
|
||||
|
||||
|
||||
_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=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='value', full_name='Mysqlx.Expr.Object.ObjectField.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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=1122,
|
||||
serialized_end=1182,
|
||||
)
|
||||
|
||||
_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=1066,
|
||||
serialized_end=1182,
|
||||
)
|
||||
|
||||
|
||||
_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=1184,
|
||||
serialized_end=1225,
|
||||
)
|
||||
|
||||
_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\034com.mysql.cj.mysqlx.protobuf'))
|
||||
# @@protoc_insertion_point(module_scope)
|
|
@ -0,0 +1,357 @@
|
|||
# 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='proto3',
|
||||
serialized_pb=_b('\n\x13mysqlx_notice.proto\x12\rMysqlx.Notice\x1a\x16mysqlx_datatypes.proto\"{\n\x05\x46rame\x12\x0c\n\x04type\x18\x01 \x01(\r\x12)\n\x05scope\x18\x02 \x01(\x0e\x32\x1a.Mysqlx.Notice.Frame.Scope\x12\x0f\n\x07payload\x18\x03 \x01(\x0c\"(\n\x05Scope\x12\x08\n\x04NONE\x10\x00\x12\n\n\x06GLOBAL\x10\x01\x12\t\n\x05LOCAL\x10\x02\"\x86\x01\n\x07Warning\x12+\n\x05level\x18\x01 \x01(\x0e\x32\x1c.Mysqlx.Notice.Warning.Level\x12\x0c\n\x04\x63ode\x18\x02 \x01(\r\x12\x0b\n\x03msg\x18\x03 \x01(\t\"3\n\x05Level\x12\x08\n\x04NONE\x10\x00\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 \x01(\t\x12\'\n\x05value\x18\x02 \x01(\x0b\x32\x18.Mysqlx.Datatypes.Scalar\"\xdf\x02\n\x13SessionStateChanged\x12;\n\x05param\x18\x01 \x01(\x0e\x32,.Mysqlx.Notice.SessionStateChanged.Parameter\x12\'\n\x05value\x18\x02 \x01(\x0b\x32\x18.Mysqlx.Datatypes.Scalar\"\xe1\x01\n\tParameter\x12\x08\n\x04NONE\x10\x00\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\x42\x1e\n\x1c\x63om.mysql.cj.mysqlx.protobufb\x06proto3')
|
||||
,
|
||||
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='NONE', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='GLOBAL', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='LOCAL', index=2, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=145,
|
||||
serialized_end=185,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_FRAME_SCOPE)
|
||||
|
||||
_WARNING_LEVEL = _descriptor.EnumDescriptor(
|
||||
name='Level',
|
||||
full_name='Mysqlx.Notice.Warning.Level',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='NONE', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='NOTE', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='WARNING', index=2, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ERROR', index=3, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=271,
|
||||
serialized_end=322,
|
||||
)
|
||||
_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='NONE', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CURRENT_SCHEMA', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ACCOUNT_EXPIRED', index=2, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='GENERATED_INSERT_ID', index=3, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ROWS_AFFECTED', index=4, number=4,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ROWS_FOUND', index=5, number=5,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ROWS_MATCHED', index=6, number=6,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='TRX_COMMITTED', index=7, number=7,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='TRX_ROLLEDBACK', index=8, number=9,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='PRODUCED_MESSAGE', index=9, number=10,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CLIENT_ID_ASSIGNED', index=10, number=11,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=533,
|
||||
serialized_end=758,
|
||||
)
|
||||
_sym_db.RegisterEnumDescriptor(_SESSIONSTATECHANGED_PARAMETER)
|
||||
|
||||
|
||||
_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=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='scope', full_name='Mysqlx.Notice.Frame.scope', 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='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,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=62,
|
||||
serialized_end=185,
|
||||
)
|
||||
|
||||
|
||||
_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=False, 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.Notice.Warning.code', 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),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='msg', full_name='Mysqlx.Notice.Warning.msg', 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),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_WARNING_LEVEL,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=188,
|
||||
serialized_end=322,
|
||||
)
|
||||
|
||||
|
||||
_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=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='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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=324,
|
||||
serialized_end=404,
|
||||
)
|
||||
|
||||
|
||||
_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=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='value', full_name='Mysqlx.Notice.SessionStateChanged.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=[
|
||||
_SESSIONSTATECHANGED_PARAMETER,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=407,
|
||||
serialized_end=758,
|
||||
)
|
||||
|
||||
_FRAME.fields_by_name['scope'].enum_type = _FRAME_SCOPE
|
||||
_FRAME_SCOPE.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
|
||||
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
|
||||
|
||||
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)
|
||||
|
||||
|
||||
DESCRIPTOR.has_options = True
|
||||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\034com.mysql.cj.mysqlx.protobuf'))
|
||||
# @@protoc_insertion_point(module_scope)
|
|
@ -0,0 +1,372 @@
|
|||
# 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()
|
||||
|
||||
|
||||
from mysqlx.protobuf import mysqlx_sql_pb2 as mysqlx__sql__pb2
|
||||
from mysqlx.protobuf import mysqlx_resultset_pb2 as mysqlx__resultset__pb2
|
||||
from mysqlx.protobuf import mysqlx_crud_pb2 as mysqlx__crud__pb2
|
||||
from mysqlx.protobuf import mysqlx_session_pb2 as mysqlx__session__pb2
|
||||
from mysqlx.protobuf import mysqlx_connection_pb2 as mysqlx__connection__pb2
|
||||
from mysqlx.protobuf import mysqlx_expect_pb2 as mysqlx__expect__pb2
|
||||
from mysqlx.protobuf import mysqlx_notice_pb2 as mysqlx__notice__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
name='mysqlx.proto',
|
||||
package='Mysqlx',
|
||||
syntax='proto3',
|
||||
serialized_pb=_b('\n\x0cmysqlx.proto\x12\x06Mysqlx\x1a\x10mysqlx_sql.proto\x1a\x16mysqlx_resultset.proto\x1a\x11mysqlx_crud.proto\x1a\x14mysqlx_session.proto\x1a\x17mysqlx_connection.proto\x1a\x13mysqlx_expect.proto\x1a\x13mysqlx_notice.proto\"\xbe\x02\n\x0e\x43lientMessages\"\xab\x02\n\x04Type\x12\x08\n\x04NONE\x10\x00\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\"\xe2\x02\n\x0eServerMessages\"\xcf\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\"\x11\n\x02Ok\x12\x0b\n\x03msg\x18\x01 \x01(\t\"\x81\x01\n\x05\x45rror\x12(\n\x08severity\x18\x01 \x01(\x0e\x32\x16.Mysqlx.Error.Severity\x12\x0c\n\x04\x63ode\x18\x02 \x01(\r\x12\x11\n\tsql_state\x18\x04 \x01(\t\x12\x0b\n\x03msg\x18\x03 \x01(\t\" \n\x08Severity\x12\t\n\x05\x45RROR\x10\x00\x12\t\n\x05\x46\x41TAL\x10\x01\x42\x1e\n\x1c\x63om.mysql.cj.mysqlx.protobufb\x06proto3')
|
||||
,
|
||||
dependencies=[mysqlx__sql__pb2.DESCRIPTOR,mysqlx__resultset__pb2.DESCRIPTOR,mysqlx__crud__pb2.DESCRIPTOR,mysqlx__session__pb2.DESCRIPTOR,mysqlx__connection__pb2.DESCRIPTOR,mysqlx__expect__pb2.DESCRIPTOR,mysqlx__notice__pb2.DESCRIPTOR,])
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
_CLIENTMESSAGES_TYPE = _descriptor.EnumDescriptor(
|
||||
name='Type',
|
||||
full_name='Mysqlx.ClientMessages.Type',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='NONE', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CON_CAPABILITIES_GET', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CON_CAPABILITIES_SET', index=2, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CON_CLOSE', index=3, number=3,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SESS_AUTHENTICATE_START', index=4, number=4,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SESS_AUTHENTICATE_CONTINUE', index=5, number=5,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SESS_RESET', index=6, number=6,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SESS_CLOSE', index=7, number=7,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SQL_STMT_EXECUTE', index=8, number=12,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CRUD_FIND', index=9, number=17,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CRUD_INSERT', index=10, number=18,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CRUD_UPDATE', index=11, number=19,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='CRUD_DELETE', index=12, number=20,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='EXPECT_OPEN', index=13, number=24,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='EXPECT_CLOSE', index=14, number=25,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=194,
|
||||
serialized_end=493,
|
||||
)
|
||||
_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),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=515,
|
||||
serialized_end=850,
|
||||
)
|
||||
_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=969,
|
||||
serialized_end=1001,
|
||||
)
|
||||
_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=175,
|
||||
serialized_end=493,
|
||||
)
|
||||
|
||||
|
||||
_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=496,
|
||||
serialized_end=850,
|
||||
)
|
||||
|
||||
|
||||
_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=852,
|
||||
serialized_end=869,
|
||||
)
|
||||
|
||||
|
||||
_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=False, 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=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='sql_state', full_name='Mysqlx.Error.sql_state', index=2,
|
||||
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),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='msg', full_name='Mysqlx.Error.msg', index=3,
|
||||
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),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
_ERROR_SEVERITY,
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=872,
|
||||
serialized_end=1001,
|
||||
)
|
||||
|
||||
_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\034com.mysql.cj.mysqlx.protobuf'))
|
||||
# @@protoc_insertion_point(module_scope)
|
|
@ -0,0 +1,348 @@
|
|||
# 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 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='proto3',
|
||||
serialized_pb=_b('\n\x16mysqlx_resultset.proto\x12\x10Mysqlx.Resultset\"\x18\n\x16\x46\x65tchDoneMoreOutParams\"\x19\n\x17\x46\x65tchDoneMoreResultsets\"\x0b\n\tFetchDone\"\xa9\x03\n\x0e\x43olumnMetaData\x12\x38\n\x04type\x18\x01 \x01(\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\"\x8c\x01\n\tFieldType\x12\x08\n\x04NONE\x10\x00\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\x42\x1e\n\x1c\x63om.mysql.cj.mysqlx.protobufb\x06proto3')
|
||||
)
|
||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||
|
||||
|
||||
|
||||
_COLUMNMETADATA_FIELDTYPE = _descriptor.EnumDescriptor(
|
||||
name='FieldType',
|
||||
full_name='Mysqlx.Resultset.ColumnMetaData.FieldType',
|
||||
filename=None,
|
||||
file=DESCRIPTOR,
|
||||
values=[
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='NONE', index=0, number=0,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SINT', index=1, number=1,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='UINT', index=2, number=2,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='DOUBLE', index=3, number=5,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='FLOAT', index=4, number=6,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='BYTES', index=5, number=7,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='TIME', index=6, number=10,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='DATETIME', index=7, number=12,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='SET', index=8, number=15,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='ENUM', index=9, number=16,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='BIT', index=10, number=17,
|
||||
options=None,
|
||||
type=None),
|
||||
_descriptor.EnumValueDescriptor(
|
||||
name='DECIMAL', index=11, number=18,
|
||||
options=None,
|
||||
type=None),
|
||||
],
|
||||
containing_type=None,
|
||||
options=None,
|
||||
serialized_start=396,
|
||||
serialized_end=536,
|
||||
)
|
||||
_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='proto3',
|
||||
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='proto3',
|
||||
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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=97,
|
||||
serialized_end=108,
|
||||
)
|
||||
|
||||
|
||||
_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=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='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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=111,
|
||||
serialized_end=536,
|
||||
)
|
||||
|
||||
|
||||
_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=538,
|
||||
serialized_end=558,
|
||||
)
|
||||
|
||||
_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['ColumnMetaData'] = _COLUMNMETADATA
|
||||
DESCRIPTOR.message_types_by_name['Row'] = _ROW
|
||||
|
||||
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)
|
||||
|
||||
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\034com.mysql.cj.mysqlx.protobuf'))
|
||||
# @@protoc_insertion_point(module_scope)
|
|
@ -0,0 +1,227 @@
|
|||
# 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='proto3',
|
||||
serialized_pb=_b('\n\x14mysqlx_session.proto\x12\x0eMysqlx.Session\"S\n\x11\x41uthenticateStart\x12\x11\n\tmech_name\x18\x01 \x01(\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 \x01(\x0c\"#\n\x0e\x41uthenticateOk\x12\x11\n\tauth_data\x18\x01 \x01(\x0c\"\x07\n\x05Reset\"\x07\n\x05\x43loseB\x1e\n\x1c\x63om.mysql.cj.mysqlx.protobufb\x06proto3')
|
||||
)
|
||||
_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=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='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='proto3',
|
||||
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=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='proto3',
|
||||
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='proto3',
|
||||
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=[
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
nested_types=[],
|
||||
enum_types=[
|
||||
],
|
||||
options=None,
|
||||
is_extendable=False,
|
||||
syntax='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=205,
|
||||
serialized_end=212,
|
||||
)
|
||||
|
||||
|
||||
_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=214,
|
||||
serialized_end=221,
|
||||
)
|
||||
|
||||
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\034com.mysql.cj.mysqlx.protobuf'))
|
||||
# @@protoc_insertion_point(module_scope)
|
|
@ -0,0 +1,127 @@
|
|||
# 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='proto3',
|
||||
serialized_pb=_b('\n\x10mysqlx_sql.proto\x12\nMysqlx.Sql\x1a\x16mysqlx_datatypes.proto\"m\n\x0bStmtExecute\x12\x11\n\tnamespace\x18\x03 \x01(\t\x12\x0c\n\x04stmt\x18\x01 \x01(\x0c\x12#\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\x15.Mysqlx.Datatypes.Any\x12\x18\n\x10\x63ompact_metadata\x18\x04 \x01(\x08\"\x0f\n\rStmtExecuteOkB\x1e\n\x1c\x63om.mysql.cj.mysqlx.protobufb\x06proto3')
|
||||
,
|
||||
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=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='stmt', full_name='Mysqlx.Sql.StmtExecute.stmt', index=1,
|
||||
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),
|
||||
_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=False, 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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=56,
|
||||
serialized_end=165,
|
||||
)
|
||||
|
||||
|
||||
_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='proto3',
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=167,
|
||||
serialized_end=182,
|
||||
)
|
||||
|
||||
_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\034com.mysql.cj.mysqlx.protobuf'))
|
||||
# @@protoc_insertion_point(module_scope)
|
30
elitebot/lib/python3.11/site-packages/mysqlx/protobuf/t.py
Normal file
30
elitebot/lib/python3.11/site-packages/mysqlx/protobuf/t.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/python
|
||||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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
|
||||
|
||||
import mysqlx_resultset_pb2
|
||||
|
||||
row = mysqlx_resultset_pb2.Row()
|
||||
for x in range(0, 100000):
|
||||
row.ParseFromString("\x0a\x0e\x7b\x22\x66\x6f\x6f\x22\x3a\x22\x62\x61\x72"
|
||||
"\x22\x7d\x00\x0a\x01\x02")
|
375
elitebot/lib/python3.11/site-packages/mysqlx/protocol.py
Normal file
375
elitebot/lib/python3.11/site-packages/mysqlx/protocol.py
Normal file
|
@ -0,0 +1,375 @@
|
|||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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 X protocol for MySQL servers."""
|
||||
|
||||
import struct
|
||||
|
||||
from .protobuf import mysqlx_pb2 as MySQLx
|
||||
from .protobuf import mysqlx_session_pb2 as MySQLxSession
|
||||
from .protobuf import mysqlx_sql_pb2 as MySQLxSQL
|
||||
from .protobuf import mysqlx_notice_pb2 as MySQLxNotice
|
||||
from .protobuf import mysqlx_datatypes_pb2 as MySQLxDatatypes
|
||||
from .protobuf import mysqlx_resultset_pb2 as MySQLxResultset
|
||||
from .protobuf import mysqlx_crud_pb2 as MySQLxCrud
|
||||
from .protobuf import mysqlx_expr_pb2 as MySQLxExpr
|
||||
from .protobuf import mysqlx_connection_pb2 as MySQLxConnection
|
||||
from .result import ColumnMetaData
|
||||
from .compat import STRING_TYPES, INT_TYPES
|
||||
from .dbdoc import DbDoc
|
||||
from .errors import InterfaceError, OperationalError, ProgrammingError
|
||||
from .expr import (ExprParser, build_null_scalar, build_string_scalar,
|
||||
build_bool_scalar, build_double_scalar, build_int_scalar)
|
||||
|
||||
|
||||
_SERVER_MESSAGES = [
|
||||
(MySQLx.ServerMessages.SESS_AUTHENTICATE_CONTINUE,
|
||||
MySQLxSession.AuthenticateContinue),
|
||||
(MySQLx.ServerMessages.SESS_AUTHENTICATE_OK,
|
||||
MySQLxSession.AuthenticateOk),
|
||||
(MySQLx.ServerMessages.SQL_STMT_EXECUTE_OK, MySQLxSQL.StmtExecuteOk),
|
||||
(MySQLx.ServerMessages.ERROR, MySQLx.Error),
|
||||
(MySQLx.ServerMessages.NOTICE, MySQLxNotice.Frame),
|
||||
(MySQLx.ServerMessages.RESULTSET_COLUMN_META_DATA,
|
||||
MySQLxResultset.ColumnMetaData),
|
||||
(MySQLx.ServerMessages.RESULTSET_ROW, MySQLxResultset.Row),
|
||||
(MySQLx.ServerMessages.RESULTSET_FETCH_DONE, MySQLxResultset.FetchDone),
|
||||
(MySQLx.ServerMessages.RESULTSET_FETCH_DONE_MORE_RESULTSETS,
|
||||
MySQLxResultset.FetchDoneMoreResultsets),
|
||||
(MySQLx.ServerMessages.OK, MySQLx.Ok),
|
||||
(MySQLx.ServerMessages.CONN_CAPABILITIES, MySQLxConnection.Capabilities),
|
||||
]
|
||||
|
||||
|
||||
def encode_to_bytes(value, encoding="utf-8"):
|
||||
return value if isinstance(value, bytes) else value.encode(encoding)
|
||||
|
||||
|
||||
class MessageReaderWriter(object):
|
||||
def __init__(self, socket_stream):
|
||||
self._stream = socket_stream
|
||||
self._msg = None
|
||||
|
||||
def push_message(self, msg):
|
||||
if self._msg is not None:
|
||||
raise OperationalError("Message push slot is full")
|
||||
self._msg = msg
|
||||
|
||||
def read_message(self):
|
||||
if self._msg is not None:
|
||||
m = self._msg
|
||||
self._msg = None
|
||||
return m
|
||||
return self._read_message()
|
||||
|
||||
def _read_message(self):
|
||||
hdr = self._stream.read(5)
|
||||
msg_len, msg_type = struct.unpack("<LB", hdr)
|
||||
payload = self._stream.read(msg_len - 1)
|
||||
|
||||
for msg_tuple in _SERVER_MESSAGES:
|
||||
if msg_tuple[0] == msg_type:
|
||||
msg = msg_tuple[1]()
|
||||
msg.ParseFromString(payload)
|
||||
return msg
|
||||
|
||||
raise ValueError("Unknown msg_type: {0}".format(msg_type))
|
||||
|
||||
def write_message(self, msg_id, msg):
|
||||
msg_str = msg.SerializeToString()
|
||||
header = struct.pack("<LB", len(msg_str) + 1, msg_id)
|
||||
self._stream.sendall(b"".join([header, msg_str]))
|
||||
|
||||
|
||||
class Protocol(object):
|
||||
def __init__(self, reader_writer):
|
||||
self._reader = reader_writer
|
||||
self._writer = reader_writer
|
||||
self._message = None
|
||||
|
||||
def get_capabilites(self):
|
||||
msg = MySQLxConnection.CapabilitiesGet()
|
||||
self._writer.write_message(
|
||||
MySQLx.ClientMessages.CON_CAPABILITIES_GET, msg)
|
||||
return self._reader.read_message()
|
||||
|
||||
def set_capabilities(self, **kwargs):
|
||||
msg = MySQLxConnection.CapabilitiesSet()
|
||||
for key, value in kwargs.items():
|
||||
value = self._create_any(value)
|
||||
capability = MySQLxConnection.Capability(name=key, value=value)
|
||||
msg.capabilities.capabilities.extend([capability])
|
||||
|
||||
self._writer.write_message(
|
||||
MySQLx.ClientMessages.CON_CAPABILITIES_SET, msg)
|
||||
|
||||
return self.read_ok()
|
||||
|
||||
def send_auth_start(self, method):
|
||||
msg = MySQLxSession.AuthenticateStart(mech_name=method)
|
||||
self._writer.write_message(
|
||||
MySQLx.ClientMessages.SESS_AUTHENTICATE_START, msg)
|
||||
|
||||
def read_auth_continue(self):
|
||||
msg = self._reader.read_message()
|
||||
if not isinstance(msg, MySQLxSession.AuthenticateContinue):
|
||||
raise InterfaceError("Unexpected message encountered during "
|
||||
"authentication handshake")
|
||||
return msg.auth_data
|
||||
|
||||
def send_auth_continue(self, data):
|
||||
msg = MySQLxSession.AuthenticateContinue(
|
||||
auth_data=encode_to_bytes(data))
|
||||
self._writer.write_message(
|
||||
MySQLx.ClientMessages.SESS_AUTHENTICATE_CONTINUE, msg)
|
||||
|
||||
def read_auth_ok(self):
|
||||
while True:
|
||||
msg = self._reader.read_message()
|
||||
if isinstance(msg, MySQLxSession.AuthenticateOk):
|
||||
break
|
||||
if isinstance(msg, MySQLx.Error):
|
||||
raise InterfaceError(msg.msg)
|
||||
|
||||
def get_binding_scalars(self, statement):
|
||||
count = len(statement._binding_map)
|
||||
scalars = count * [None]
|
||||
|
||||
for binding in statement._bindings:
|
||||
name = binding["name"]
|
||||
if name not in statement._binding_map:
|
||||
raise ProgrammingError("Unable to find placeholder for "
|
||||
"parameter: {0}".format(name))
|
||||
pos = statement._binding_map[name]
|
||||
scalars[pos] = self.arg_object_to_scalar(binding["value"],
|
||||
not statement._doc_based)
|
||||
return scalars
|
||||
|
||||
def _apply_filter(self, message, statement):
|
||||
if statement._has_where:
|
||||
message.criteria.CopyFrom(statement._where_expr)
|
||||
if statement._has_bindings:
|
||||
message.args.extend(self.get_binding_scalars(statement))
|
||||
if statement._has_limit:
|
||||
message.limit.row_count = statement._limit_row_count
|
||||
message.limit.offset = statement._limit_offset
|
||||
if statement._has_sort:
|
||||
message.order.extend(statement._sort_expr)
|
||||
if statement._has_group_by:
|
||||
message.grouping.extend(statement._grouping)
|
||||
if statement._has_having:
|
||||
message.grouping_criteria.CopyFrom(statement._having)
|
||||
|
||||
def send_find(self, stmt):
|
||||
find = MySQLxCrud.Find(
|
||||
data_model=(MySQLxCrud.DOCUMENT
|
||||
if stmt._doc_based else MySQLxCrud.TABLE),
|
||||
collection=MySQLxCrud.Collection(name=stmt.target.name,
|
||||
schema=stmt.schema.name))
|
||||
if stmt._has_projection:
|
||||
find.projection.extend(stmt._projection_expr)
|
||||
self._apply_filter(find, stmt)
|
||||
self._writer.write_message(MySQLx.ClientMessages.CRUD_FIND, find)
|
||||
|
||||
def send_update(self, statement):
|
||||
update = MySQLxCrud.Update(
|
||||
data_model=(MySQLxCrud.DOCUMENT
|
||||
if statement._doc_based else MySQLxCrud.TABLE),
|
||||
collection=MySQLxCrud.Collection(name=statement.target.name,
|
||||
schema=statement.schema.name))
|
||||
self._apply_filter(update, statement)
|
||||
for update_op in statement._update_ops:
|
||||
opexpr = MySQLxCrud.UpdateOperation(
|
||||
operation=update_op.update_type, source=update_op.source)
|
||||
if update_op.value is not None:
|
||||
opexpr.value.CopyFrom(
|
||||
self.arg_object_to_expr(
|
||||
update_op.value, not statement._doc_based))
|
||||
update.operation.extend([opexpr])
|
||||
self._writer.write_message(MySQLx.ClientMessages.CRUD_UPDATE, update)
|
||||
|
||||
def send_delete(self, stmt):
|
||||
delete = MySQLxCrud.Delete(
|
||||
data_model=(MySQLxCrud.DOCUMENT
|
||||
if stmt._doc_based else MySQLxCrud.TABLE),
|
||||
collection=MySQLxCrud.Collection(name=stmt.target.name,
|
||||
schema=stmt.schema.name))
|
||||
self._apply_filter(delete, stmt)
|
||||
self._writer.write_message(MySQLx.ClientMessages.CRUD_DELETE, delete)
|
||||
|
||||
def send_execute_statement(self, namespace, stmt, args):
|
||||
stmt = MySQLxSQL.StmtExecute(namespace=namespace,
|
||||
stmt=encode_to_bytes(stmt),
|
||||
compact_metadata=False)
|
||||
for arg in args:
|
||||
value = self._create_any(arg)
|
||||
stmt.args.extend([value])
|
||||
self._writer.write_message(MySQLx.ClientMessages.SQL_STMT_EXECUTE,
|
||||
stmt)
|
||||
|
||||
def send_insert(self, statement):
|
||||
insert = MySQLxCrud.Insert(
|
||||
data_model=(MySQLxCrud.DOCUMENT
|
||||
if statement._doc_based else MySQLxCrud.TABLE),
|
||||
collection=MySQLxCrud.Collection(name=statement.target.name,
|
||||
schema=statement.schema.name))
|
||||
if hasattr(statement, "_fields"):
|
||||
for field in statement._fields:
|
||||
insert.projection.extend([
|
||||
ExprParser(field, not statement._doc_based)
|
||||
.parse_table_insert_field()])
|
||||
for value in statement._values:
|
||||
row = MySQLxCrud.Insert.TypedRow()
|
||||
if isinstance(value, list):
|
||||
for val in value:
|
||||
obj = self.arg_object_to_expr(
|
||||
val, not statement._doc_based)
|
||||
row.field.extend([obj])
|
||||
else:
|
||||
obj = self.arg_object_to_expr(value, not statement._doc_based)
|
||||
row.field.extend([obj])
|
||||
insert.row.extend([row])
|
||||
self._writer.write_message(MySQLx.ClientMessages.CRUD_INSERT, insert)
|
||||
|
||||
def _create_any(self, arg):
|
||||
if isinstance(arg, STRING_TYPES):
|
||||
val = MySQLxDatatypes.Scalar.String(value=encode_to_bytes(arg))
|
||||
scalar = MySQLxDatatypes.Scalar(type=8, v_string=val)
|
||||
return MySQLxDatatypes.Any(type=1, scalar=scalar)
|
||||
elif isinstance(arg, bool):
|
||||
return MySQLxDatatypes.Any(type=1, scalar=build_bool_scalar(arg))
|
||||
elif isinstance(arg, INT_TYPES):
|
||||
return MySQLxDatatypes.Any(type=1, scalar=build_int_scalar(arg))
|
||||
return None
|
||||
|
||||
def close_result(self, rs):
|
||||
msg = self._read_message(rs)
|
||||
if msg is not None:
|
||||
raise OperationalError("Expected to close the result")
|
||||
|
||||
def read_row(self, rs):
|
||||
msg = self._read_message(rs)
|
||||
if msg is None:
|
||||
return None
|
||||
if isinstance(msg, MySQLxResultset.Row):
|
||||
return msg
|
||||
self._reader.push_message(msg)
|
||||
return None
|
||||
|
||||
def _process_frame(self, msg, rs):
|
||||
if msg.type == 1:
|
||||
warningMsg = MySQLxNotice.Warning()
|
||||
warningMsg.ParseFromString(msg.payload)
|
||||
rs._warnings.append(Warning(warningMsg.level, warningMsg.code,
|
||||
warningMsg.msg))
|
||||
elif msg.type == 2:
|
||||
sessVarMsg = MySQLxNotice.SessionVariableChanged()
|
||||
sessVarMsg.ParseFromString(msg.payload)
|
||||
elif msg.type == 3:
|
||||
sessStateMsg = MySQLxNotice.SessionStateChanged()
|
||||
sessStateMsg.ParseFromString(msg.payload)
|
||||
if sessStateMsg.param == \
|
||||
MySQLxNotice.SessionStateChanged.ROWS_AFFECTED:
|
||||
rs._rows_affected = sessStateMsg.value.v_unsigned_int
|
||||
elif sessStateMsg.param == \
|
||||
MySQLxNotice.SessionStateChanged.GENERATED_INSERT_ID:
|
||||
rs._generated_id = sessStateMsg.value.v_unsigned_int
|
||||
|
||||
def _read_message(self, rs):
|
||||
while True:
|
||||
msg = self._reader.read_message()
|
||||
if isinstance(msg, MySQLx.Error):
|
||||
raise OperationalError(msg.msg)
|
||||
elif isinstance(msg, MySQLxNotice.Frame):
|
||||
self._process_frame(msg, rs)
|
||||
elif isinstance(msg, MySQLxSQL.StmtExecuteOk):
|
||||
return None
|
||||
elif isinstance(msg, MySQLxResultset.FetchDone):
|
||||
rs._closed = True
|
||||
elif isinstance(msg, MySQLxResultset.FetchDoneMoreResultsets):
|
||||
rs._has_more_results = True
|
||||
else:
|
||||
break
|
||||
return msg
|
||||
|
||||
def get_column_metadata(self, rs):
|
||||
columns = []
|
||||
while True:
|
||||
msg = self._read_message(rs)
|
||||
if msg is None:
|
||||
break
|
||||
if isinstance(msg, MySQLxResultset.Row):
|
||||
self._reader.push_message(msg)
|
||||
break
|
||||
if not isinstance(msg, MySQLxResultset.ColumnMetaData):
|
||||
raise InterfaceError("Unexpected msg type")
|
||||
col = ColumnMetaData(msg.type, msg.catalog, msg.schema, msg.table,
|
||||
msg.original_table, msg.name,
|
||||
msg.original_name, msg.length, msg.collation,
|
||||
msg.fractional_digits, msg.flags,
|
||||
msg.content_type)
|
||||
columns.append(col)
|
||||
return columns
|
||||
|
||||
def arg_object_to_expr(self, value, allow_relational):
|
||||
if value is None:
|
||||
return MySQLxExpr.Expr(type=MySQLxExpr.Expr.LITERAL,
|
||||
literal=build_null_scalar())
|
||||
if isinstance(value, bool):
|
||||
return MySQLxExpr.Expr(type=MySQLxExpr.Expr.LITERAL,
|
||||
literal=build_bool_scalar(value))
|
||||
elif isinstance(value, INT_TYPES):
|
||||
return MySQLxExpr.Expr(type=MySQLxExpr.Expr.LITERAL,
|
||||
literal=build_int_scalar(value))
|
||||
elif isinstance(value, (float)):
|
||||
return MySQLxExpr.Expr(type=MySQLxExpr.Expr.LITERAL,
|
||||
literal=build_double_scalar(value))
|
||||
elif isinstance(value, STRING_TYPES):
|
||||
try:
|
||||
expression = ExprParser(value, allow_relational).expr()
|
||||
if expression.has_identifier():
|
||||
return MySQLxExpr.Expr(type=MySQLxExpr.Expr.LITERAL,
|
||||
literal=build_string_scalar(value))
|
||||
return expression
|
||||
except:
|
||||
return MySQLxExpr.Expr(type=MySQLxExpr.Expr.LITERAL,
|
||||
literal=build_string_scalar(value))
|
||||
elif isinstance(value, DbDoc):
|
||||
return MySQLxExpr.Expr(type=MySQLxExpr.Expr.LITERAL,
|
||||
literal=build_string_scalar(str(value)))
|
||||
raise InterfaceError("Unsupported type: {0}".format(type(value)))
|
||||
|
||||
def arg_object_to_scalar(self, value, allow_relational):
|
||||
return self.arg_object_to_expr(value, allow_relational).literal
|
||||
|
||||
def read_ok(self):
|
||||
msg = self._reader.read_message()
|
||||
if isinstance(msg, MySQLx.Error):
|
||||
raise InterfaceError(msg.msg)
|
||||
|
||||
if not isinstance(msg, MySQLx.Ok):
|
||||
raise InterfaceError("Unexpected message encountered")
|
||||
|
||||
def send_close(self):
|
||||
msg = MySQLxSession.Close()
|
||||
self._writer.write_message(MySQLx.ClientMessages.SESS_CLOSE, msg)
|
840
elitebot/lib/python3.11/site-packages/mysqlx/result.py
Normal file
840
elitebot/lib/python3.11/site-packages/mysqlx/result.py
Normal file
|
@ -0,0 +1,840 @@
|
|||
# MySQL Connector/Python - MySQL driver written in Python.
|
||||
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
# MySQL Connector/Python is licensed under the terms of the GPLv2
|
||||
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
||||
# MySQL Connectors. There are special exceptions to the terms and
|
||||
# conditions of the GPLv2 as it is applied to this software, see the
|
||||
# FOSS License Exception
|
||||
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
# 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 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 Result Set classes."""
|
||||
|
||||
import decimal
|
||||
import struct
|
||||
import sys
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from .dbdoc import DbDoc
|
||||
from .charsets import MYSQL_CHARACTER_SETS
|
||||
from .compat import STRING_TYPES
|
||||
|
||||
|
||||
def decode_from_bytes(value, encoding="utf-8"):
|
||||
return value.decode(encoding) if isinstance(value, bytes) else value
|
||||
|
||||
|
||||
def from_protobuf(col_type, payload):
|
||||
if len(payload) == 0:
|
||||
return None
|
||||
|
||||
try:
|
||||
return {
|
||||
ColumnProtoType.SINT: varsint_from_protobuf,
|
||||
ColumnProtoType.UINT: varint_from_protobuf,
|
||||
ColumnProtoType.BYTES: bytes_from_protobuf,
|
||||
ColumnProtoType.DATETIME: datetime_from_protobuf,
|
||||
ColumnProtoType.TIME: time_from_protobuf,
|
||||
ColumnProtoType.FLOAT: float_from_protobuf,
|
||||
ColumnProtoType.DOUBLE: double_from_protobuf,
|
||||
ColumnProtoType.BIT: varint_from_protobuf,
|
||||
ColumnProtoType.SET: set_from_protobuf,
|
||||
ColumnProtoType.ENUM: bytes_from_protobuf,
|
||||
ColumnProtoType.DECIMAL: decimal_from_protobuf,
|
||||
}[col_type](payload)
|
||||
except KeyError as e:
|
||||
sys.stderr.write("{0}".format(e))
|
||||
sys.stderr.write("{0}".format(payload.encode("hex")))
|
||||
return None
|
||||
|
||||
|
||||
def bytes_from_protobuf(payload):
|
||||
# Strip trailing char
|
||||
return payload[:-1]
|
||||
|
||||
|
||||
def float_from_protobuf(payload):
|
||||
assert len(payload) == 4
|
||||
return struct.unpack("<f", payload)
|
||||
|
||||
|
||||
def double_from_protobuf(payload):
|
||||
assert len(payload) == 8
|
||||
return struct.unpack("<d", payload)
|
||||
|
||||
|
||||
def varint_from_protobuf_stream(payload):
|
||||
if len(payload) == 0:
|
||||
raise ValueError("Payload is empty")
|
||||
|
||||
cur = 0
|
||||
i = 0
|
||||
shift = 0
|
||||
|
||||
for c in payload:
|
||||
ch = c if isinstance(c, int) else ord(c)
|
||||
eos = (ch & 0x80) == 0
|
||||
cur_bits = (ch & 0x7f)
|
||||
cur_bits <<= shift
|
||||
i |= cur_bits
|
||||
if eos:
|
||||
return i, payload[cur + 1:]
|
||||
cur += 1
|
||||
shift += 7
|
||||
|
||||
raise EOFError("Payload too short")
|
||||
|
||||
|
||||
def varint_from_protobuf(payload):
|
||||
i, payload = varint_from_protobuf_stream(payload)
|
||||
if len(payload) != 0:
|
||||
raise ValueError("Payload too long")
|
||||
|
||||
return i
|
||||
|
||||
|
||||
def varsint_from_protobuf(payload):
|
||||
i, payload = varint_from_protobuf_stream(payload)
|
||||
if len(payload) != 0:
|
||||
raise ValueError("Payload too long")
|
||||
|
||||
# Zigzag encoded, revert it
|
||||
if i & 0x1:
|
||||
i = ~i
|
||||
i = (i >> 1)
|
||||
i |= 1 << 63
|
||||
else:
|
||||
i = (i >> 1)
|
||||
|
||||
return i
|
||||
|
||||
|
||||
def set_from_protobuf(payload):
|
||||
s = []
|
||||
while True:
|
||||
try:
|
||||
field_len, payload = varint_from_protobuf_stream(payload)
|
||||
if len(payload) < field_len:
|
||||
if len(payload) == 0 and field_len == 1 and len(s) == 0:
|
||||
# Special case for empty set
|
||||
return []
|
||||
raise ValueError("Invalid Set encoding")
|
||||
|
||||
s.append(payload[:field_len])
|
||||
payload = payload[field_len:]
|
||||
if len(payload) == 0:
|
||||
# Done
|
||||
break
|
||||
except ValueError:
|
||||
break
|
||||
return s
|
||||
|
||||
|
||||
def decimal_from_protobuf(payload):
|
||||
digits = []
|
||||
sign = None
|
||||
scale = ord(payload[0])
|
||||
payload = payload[1:]
|
||||
|
||||
for c in payload:
|
||||
ch = ord(c)
|
||||
high_bcd = (ch & 0xf0) >> 4
|
||||
low_bcd = ch & 0x0f
|
||||
if high_bcd < 0x0a:
|
||||
digits.append(high_bcd)
|
||||
if low_bcd < 0x0a:
|
||||
digits.append(low_bcd)
|
||||
elif low_bcd == 0x0c:
|
||||
sign = 0
|
||||
break
|
||||
elif low_bcd == 0x0d:
|
||||
sign = 1
|
||||
break
|
||||
else:
|
||||
raise ValueError("Invalid BCD")
|
||||
elif high_bcd == 0x0c:
|
||||
sign = 0
|
||||
assert low_bcd == 0x00
|
||||
break
|
||||
elif high_bcd == 0x0d:
|
||||
sign = 1
|
||||
assert low_bcd == 0x00
|
||||
break
|
||||
else:
|
||||
raise ValueError("Invalid BCD: {0}".format(high_bcd))
|
||||
|
||||
return decimal.Decimal((sign, digits, -scale))
|
||||
|
||||
|
||||
def datetime_from_protobuf(payload):
|
||||
# A sequence of varints
|
||||
hour = 0
|
||||
minutes = 0
|
||||
seconds = 0
|
||||
useconds = 0
|
||||
year, payload = varint_from_protobuf_stream(payload)
|
||||
month, payload = varint_from_protobuf_stream(payload)
|
||||
day, payload = varint_from_protobuf_stream(payload)
|
||||
|
||||
try:
|
||||
hour, payload = varint_from_protobuf_stream(payload)
|
||||
minutes, payload = varint_from_protobuf_stream(payload)
|
||||
seconds, payload = varint_from_protobuf_stream(payload)
|
||||
useconds, payload = varint_from_protobuf_stream(payload)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
return datetime(year, month, day, hour, minutes, seconds, useconds)
|
||||
|
||||
|
||||
def time_from_protobuf(payload):
|
||||
# A sequence of varints
|
||||
hour = 0
|
||||
minutes = 0
|
||||
seconds = 0
|
||||
useconds = 0
|
||||
negate = payload[0] == 1
|
||||
payload = payload[1:]
|
||||
|
||||
try:
|
||||
hour, payload = varint_from_protobuf_stream(payload)
|
||||
minutes, payload = varint_from_protobuf_stream(payload)
|
||||
seconds, payload = varint_from_protobuf_stream(payload)
|
||||
useconds, payload = varint_from_protobuf_stream(payload)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
if negate:
|
||||
# Negate the first non-zero value
|
||||
if hour:
|
||||
hour *= -1
|
||||
elif minutes:
|
||||
minutes *= -1
|
||||
elif seconds:
|
||||
seconds *= -1
|
||||
elif useconds:
|
||||
useconds *= -1
|
||||
|
||||
return timedelta(hours=hour, minutes=minutes, seconds=seconds,
|
||||
microseconds=useconds)
|
||||
|
||||
|
||||
class Collations(object):
|
||||
UTF8_GENERAL_CI = 33
|
||||
|
||||
|
||||
class ColumnType(object):
|
||||
BIT = 1
|
||||
TINYINT = 2
|
||||
SMALLINT = 3
|
||||
MEDIUMINT = 4
|
||||
INT = 5
|
||||
BIGINT = 6
|
||||
REAL = 7
|
||||
FLOAT = 8
|
||||
DECIMAL = 9
|
||||
NUMERIC = 10
|
||||
DOUBLE = 11
|
||||
JSON = 12
|
||||
STRING = 13
|
||||
BYTES = 14
|
||||
TIME = 15
|
||||
DATE = 16
|
||||
DATETIME = 17
|
||||
TIMESTAMP = 18
|
||||
SET = 19
|
||||
ENUM = 20
|
||||
GEOMETRY = 21
|
||||
XML = 22
|
||||
YEAR = 23
|
||||
CHAR = 24
|
||||
VARCHAR = 25
|
||||
BINARY = 26
|
||||
VARBINARY = 27
|
||||
TINYBLOB = 28
|
||||
BLOB = 29
|
||||
MEDIUMBLOB = 30
|
||||
LONGBLOB = 31
|
||||
TINYTEXT = 32
|
||||
TEXT = 33
|
||||
MEDIUMTEXT = 34
|
||||
LONGTEXT = 35
|
||||
|
||||
@classmethod
|
||||
def to_string(cls, needle):
|
||||
for key, value in vars(cls).items():
|
||||
if value == needle:
|
||||
return key
|
||||
|
||||
@classmethod
|
||||
def from_string(cls, key):
|
||||
return getattr(cls, key.upper(), None)
|
||||
|
||||
@classmethod
|
||||
def is_char(cls, col_type):
|
||||
return col_type in (cls.CHAR, cls.VARCHAR,)
|
||||
|
||||
@classmethod
|
||||
def is_binary(cls, col_type):
|
||||
return col_type in (cls.BINARY, cls.VARBINARY,)
|
||||
|
||||
@classmethod
|
||||
def is_text(cls, col_type):
|
||||
return col_type in (cls.TEXT, cls.TINYTEXT, cls.MEDIUMTEXT,
|
||||
cls.LONGTEXT,)
|
||||
|
||||
@classmethod
|
||||
def is_decimals(cls, col_type):
|
||||
return col_type in (cls.REAL, cls.DOUBLE, cls.FLOAT, cls.DECIMAL,
|
||||
cls.NUMERIC,)
|
||||
|
||||
@classmethod
|
||||
def is_numeric(cls, col_type):
|
||||
return col_type in (cls.BIT, cls.TINYINT, cls.SMALLINT, cls.MEDIUMINT,
|
||||
cls.INT, cls.BIGINT,)
|
||||
|
||||
@classmethod
|
||||
def is_finite_set(cls, col_type):
|
||||
return col_type in (cls.SET, cls.ENUM,)
|
||||
|
||||
|
||||
class ColumnProtoType(object):
|
||||
SINT = 1
|
||||
UINT = 2
|
||||
DOUBLE = 5
|
||||
FLOAT = 6
|
||||
BYTES = 7
|
||||
TIME = 10
|
||||
DATETIME = 12
|
||||
SET = 15
|
||||
ENUM = 16
|
||||
BIT = 17
|
||||
DECIMAL = 18
|
||||
|
||||
|
||||
class Flags(object):
|
||||
def __init__(self, value):
|
||||
self._allowed_flags = {}
|
||||
self._flag_names = {}
|
||||
for k, v in self.__class__.__dict__.items():
|
||||
if k.startswith("__"):
|
||||
continue
|
||||
if type(v) in (int, ):
|
||||
self._allowed_flags[k] = v
|
||||
self._flag_names[v] = k
|
||||
self.value = value
|
||||
|
||||
def __str__(self):
|
||||
mask = 1
|
||||
flag_names = []
|
||||
value = self.value
|
||||
|
||||
for _ in range(0, 63):
|
||||
mask <<= 1
|
||||
flag = value & mask
|
||||
if flag:
|
||||
# We matched something, find the name for it
|
||||
try:
|
||||
flag_names.append(self._flag_names[flag])
|
||||
except KeyError:
|
||||
sys.stderr.write("{0}".format(self._flag_names))
|
||||
sys.stderr.write("{0}".format(self.__class__.__dict__))
|
||||
|
||||
return ",".join(flag_names)
|
||||
|
||||
@property
|
||||
def value(self):
|
||||
return self._value
|
||||
|
||||
@value.setter
|
||||
def value(self, v):
|
||||
self._value = v
|
||||
|
||||
|
||||
class ColumnFlags(Flags):
|
||||
NOT_NULL = 0x0010
|
||||
PRIMARY_KEY = 0x0020
|
||||
UNIQUE_KEY = 0x0040
|
||||
MULTIPLE_KEY = 0x0080
|
||||
AUTO_INCREMENT = 0x0100
|
||||
|
||||
|
||||
class DatetimeColumnFlags(ColumnFlags):
|
||||
TIMESTAMP = 0x0001
|
||||
|
||||
|
||||
class UIntColumnFlags(ColumnFlags):
|
||||
ZEROFILL = 0x0001
|
||||
|
||||
|
||||
class DoubleColumnFlags(ColumnFlags):
|
||||
UNSIGNED = 0x0001
|
||||
|
||||
|
||||
class FloatColumnFlags(ColumnFlags):
|
||||
UNSIGNED = 0x0001
|
||||
|
||||
|
||||
class BytesColumnFlags(ColumnFlags):
|
||||
RIGHT_PAD = 0x0001
|
||||
|
||||
|
||||
class BytesContentType(ColumnFlags):
|
||||
GEOMETRY = 0x0001
|
||||
JSON = 0x0002
|
||||
XML = 0x0003
|
||||
|
||||
|
||||
class ColumnMetaData(object):
|
||||
def __init__(self, col_type, catalog=None, schema=None, table=None,
|
||||
original_table=None, name=None, original_name=None,
|
||||
length=None, collation=None, fractional_digits=None,
|
||||
flags=None, content_type=None):
|
||||
self._schema = decode_from_bytes(schema)
|
||||
self._name = decode_from_bytes(name)
|
||||
self._original_name = decode_from_bytes(original_name)
|
||||
self._table = decode_from_bytes(table)
|
||||
self._original_table = decode_from_bytes(original_table)
|
||||
self._proto_type = col_type
|
||||
self._col_type = None
|
||||
self._catalog = catalog
|
||||
self._length = length
|
||||
self._collation = collation
|
||||
self._fractional_digits = fractional_digits
|
||||
self._flags = flags
|
||||
self._content_type = content_type
|
||||
self._number_signed = False
|
||||
self._is_padded = False
|
||||
self._is_binary = False
|
||||
self._is_bytes = False
|
||||
self._collation_name = None
|
||||
self._character_set_name = None
|
||||
|
||||
if self._collation > 0:
|
||||
if self._collation >= len(MYSQL_CHARACTER_SETS):
|
||||
raise ValueError("No mapping found for collation {0}"
|
||||
"".format(self._collation))
|
||||
info = MYSQL_CHARACTER_SETS[self._collation]
|
||||
self._character_set_name = info[0]
|
||||
self._collation_name = info[1]
|
||||
self._is_binary = ("binary" in self._collation_name or
|
||||
"_bin" in self._collation_name)
|
||||
self._map_type()
|
||||
self._is_bytes = self._col_type in (
|
||||
ColumnType.GEOMETRY, ColumnType.JSON, ColumnType.XML,
|
||||
ColumnType.BYTES, ColumnType.STRING)
|
||||
|
||||
def __str__(self):
|
||||
return str({
|
||||
"col_type": self._col_type,
|
||||
"schema": self._schema,
|
||||
"table": self._table,
|
||||
"flags": str(self._flags),
|
||||
})
|
||||
|
||||
def get_schema_name(self):
|
||||
return self._schema
|
||||
|
||||
def get_table_name(self):
|
||||
return self._original_table or self._table
|
||||
|
||||
def get_table_label(self):
|
||||
return self._table or self._original_table
|
||||
|
||||
def get_column_name(self):
|
||||
return self._original_name or self._name
|
||||
|
||||
def get_column_label(self):
|
||||
return self._name or self._original_name
|
||||
|
||||
def get_type(self):
|
||||
return self._col_type
|
||||
|
||||
def get_length(self):
|
||||
return self._length
|
||||
|
||||
def get_fractional_digits(self):
|
||||
return self._fractional_digits
|
||||
|
||||
def get_collation_name(self):
|
||||
return self._collation_name
|
||||
|
||||
def get_character_set_name(self):
|
||||
return self._character_set_name
|
||||
|
||||
def is_number_signed(self):
|
||||
return self._number_signed
|
||||
|
||||
def is_padded(self):
|
||||
return self._is_padded
|
||||
|
||||
def is_bytes(self):
|
||||
return self._is_bytes
|
||||
|
||||
def _map_int_type(self):
|
||||
if self._length <= 4:
|
||||
self._col_type = ColumnType.TINYINT
|
||||
elif self._length <= 6:
|
||||
self._col_type = ColumnType.SMALLINT
|
||||
elif self._length <= 9:
|
||||
self._col_type = ColumnType.MEDIUMINT
|
||||
elif self._length <= 11:
|
||||
self._col_type = ColumnType.INT
|
||||
else:
|
||||
self._col_type = ColumnType.BIGINT
|
||||
self._number_signed = True
|
||||
|
||||
def _map_uint_type(self):
|
||||
if self._length <= 3:
|
||||
self._col_type = ColumnType.TINYINT
|
||||
elif self._length <= 5:
|
||||
self._col_type = ColumnType.SMALLINT
|
||||
elif self._length <= 8:
|
||||
self._col_type = ColumnType.MEDIUMINT
|
||||
elif self._length <= 10:
|
||||
self._col_type = ColumnType.INT
|
||||
else:
|
||||
self._col_type = ColumnType.BIGINT
|
||||
self._zero_fill = self._flags & 1
|
||||
|
||||
def _map_bytes(self):
|
||||
if self._content_type == BytesContentType.GEOMETRY:
|
||||
self._col_type = ColumnType.GEOMETRY
|
||||
elif self._content_type == BytesContentType.JSON:
|
||||
self._col_type = ColumnType.JSON
|
||||
elif self._content_type == BytesContentType.XML:
|
||||
self._col_type = ColumnType.XML
|
||||
elif self._is_binary:
|
||||
self._col_type = ColumnType.BYTES
|
||||
else:
|
||||
self._col_type = ColumnType.STRING
|
||||
self._is_padded = self._flags & 1
|
||||
|
||||
def _map_datetime(self):
|
||||
if self._length == 10:
|
||||
self._col_type = ColumnType.DATE
|
||||
elif self._length == 19:
|
||||
self._col_type = ColumnType.DATETIME
|
||||
elif self._flags & DatetimeColumnFlags.TIMESTAMP > 0:
|
||||
self._col_type = ColumnType.TIMESTAMP
|
||||
else:
|
||||
raise ValueError("Datetime mapping scenario unhandled")
|
||||
|
||||
def _map_type(self):
|
||||
if self._proto_type == ColumnProtoType.SINT:
|
||||
self._map_int_type()
|
||||
elif self._proto_type == ColumnProtoType.UINT:
|
||||
self._map_uint_type()
|
||||
elif self._proto_type == ColumnProtoType.FLOAT:
|
||||
self._col_type = ColumnType.FLOAT
|
||||
self._is_number_signed = \
|
||||
(self._flags & FloatColumnFlags.UNSIGNED) == 0
|
||||
elif self._proto_type == ColumnProtoType.DECIMAL:
|
||||
self._col_type = ColumnType.DECIMAL
|
||||
self._is_number_signed = \
|
||||
(self._flags & FloatColumnFlags.UNSIGNED) == 0
|
||||
elif self._proto_type == ColumnProtoType.DOUBLE:
|
||||
self._col_type = ColumnType.DOUBLE
|
||||
self._is_number_signed = \
|
||||
(self._flags & FloatColumnFlags.UNSIGNED) == 0
|
||||
elif self._proto_type == ColumnProtoType.BYTES:
|
||||
self._map_bytes()
|
||||
elif self._proto_type == ColumnProtoType.TIME:
|
||||
self._col_type = ColumnType.TIME
|
||||
elif self._proto_type == ColumnProtoType.DATETIME:
|
||||
self._map_datetime()
|
||||
elif self._proto_type == ColumnProtoType.SET:
|
||||
self._col_type = ColumnType.SET
|
||||
elif self._proto_type == ColumnProtoType.ENUM:
|
||||
self._col_type = ColumnType.ENUM
|
||||
elif self._proto_type == ColumnProtoType.BIT:
|
||||
self._col_type = ColumnType.BIT
|
||||
else:
|
||||
raise ValueError("Unknown column type {0}".format(self._proto_type))
|
||||
|
||||
|
||||
class Warning(object):
|
||||
def __init__(self, level, code, msg):
|
||||
self._level = level
|
||||
self._code = code
|
||||
self._message = msg
|
||||
|
||||
@property
|
||||
def Level(self):
|
||||
return self._level
|
||||
|
||||
@property
|
||||
def Code(self):
|
||||
return self._code
|
||||
|
||||
@property
|
||||
def Message(self):
|
||||
return self._message
|
||||
|
||||
|
||||
class Row(object):
|
||||
"""Represents a row element returned from a SELECT query.
|
||||
|
||||
Args:
|
||||
rs (mysqlx.Result): The Result set.
|
||||
fields (list): The list of fields.
|
||||
"""
|
||||
def __init__(self, rs, fields):
|
||||
self._fields = fields
|
||||
self._resultset = rs
|
||||
|
||||
def __getitem__(self, index):
|
||||
if isinstance(index, STRING_TYPES):
|
||||
index = self._resultset.index_of(index)
|
||||
elif index >= len(self._fields):
|
||||
raise IndexError("Index out of range")
|
||||
return self._fields[index]
|
||||
|
||||
def get_string(self, str_index):
|
||||
"""Returns the value if the index by string.
|
||||
|
||||
Args:
|
||||
str_index (str): The string index.
|
||||
"""
|
||||
int_index = self._resultset.index_of(str_index)
|
||||
if int_index >= len(self._fields):
|
||||
raise IndexError("Argument out of range")
|
||||
if int_index == -1:
|
||||
raise ValueError("Column name '{0}' not found".format(str_index))
|
||||
return str(self._fields[int_index])
|
||||
|
||||
|
||||
class BaseResult(object):
|
||||
"""Provides base functionality for result objects.
|
||||
|
||||
Args:
|
||||
connection (mysqlx.connection.Connection): The Connection object.
|
||||
"""
|
||||
def __init__(self, connection):
|
||||
self._connection = connection
|
||||
self._closed = False
|
||||
self._rows_affected = 0
|
||||
self._generated_id = -1
|
||||
self._warnings = []
|
||||
|
||||
if connection is None:
|
||||
self._protocol = None
|
||||
else:
|
||||
self._protocol = connection.protocol
|
||||
connection.fetch_active_result()
|
||||
|
||||
def get_warnings(self):
|
||||
"""Returns the warnings.
|
||||
|
||||
Returns:
|
||||
list: The list of warnings.
|
||||
"""
|
||||
return self._warnings
|
||||
|
||||
def get_warnings_count(self):
|
||||
"""Returns the number of warnings.
|
||||
|
||||
Returns:
|
||||
int: The number of warnings.
|
||||
"""
|
||||
return len(self._warnings)
|
||||
|
||||
|
||||
class Result(BaseResult):
|
||||
"""Allows retrieving information about non query operations performed on
|
||||
the database.
|
||||
|
||||
Args:
|
||||
connection (mysqlx.connection.Connection): The Connection object.
|
||||
ids (list): A list of IDs.
|
||||
"""
|
||||
def __init__(self, connection=None, ids=None):
|
||||
super(Result, self).__init__(connection)
|
||||
self._ids = ids
|
||||
|
||||
if connection is not None:
|
||||
self._connection.close_result(self)
|
||||
|
||||
def get_affected_items_count(self):
|
||||
"""Returns the number of affected items for the last operation.
|
||||
|
||||
Returns:
|
||||
int: The number of affected items.
|
||||
"""
|
||||
return self._rows_affected
|
||||
|
||||
def get_autoincrement_value(self):
|
||||
"""Returns the last insert id auto generated.
|
||||
|
||||
Returns:
|
||||
int: The last insert id.
|
||||
"""
|
||||
return self._generated_id
|
||||
|
||||
def get_document_id(self):
|
||||
"""Returns ID of the last document inserted into a collection.
|
||||
"""
|
||||
if self._ids is None:
|
||||
return None
|
||||
if len(self._ids) == 0:
|
||||
return None
|
||||
return self._ids[0]
|
||||
|
||||
def get_document_ids(self):
|
||||
"""Returns the list of generated documents IDs.
|
||||
"""
|
||||
return self._ids
|
||||
|
||||
|
||||
class BufferingResult(BaseResult):
|
||||
def __init__(self, connection):
|
||||
super(BufferingResult, self).__init__(connection)
|
||||
self._init_result()
|
||||
|
||||
def _init_result(self):
|
||||
self._columns = self._connection.get_column_metadata(self)
|
||||
self._has_more_data = True if len(self._columns) > 0 else False
|
||||
self._items = []
|
||||
self._page_size = 20
|
||||
self._position = -1
|
||||
self._connection._active_result = self if self._has_more_data else None
|
||||
|
||||
@property
|
||||
def count(self):
|
||||
"""int: The total of items.
|
||||
"""
|
||||
return len(self._items)
|
||||
|
||||
def __getitem__(self, index):
|
||||
return self._items[index]
|
||||
|
||||
def index_of(self, col_name):
|
||||
"""Returns the index of the column.
|
||||
|
||||
Returns:
|
||||
int: The index of the column.
|
||||
"""
|
||||
index = 0
|
||||
for col in self._columns:
|
||||
if col.get_column_name() == col_name:
|
||||
return index
|
||||
index = index + 1
|
||||
return -1
|
||||
|
||||
def _read_item(self, dumping):
|
||||
row = self._connection.read_row(self)
|
||||
if row is None:
|
||||
return None
|
||||
item = [None] * len(row.field)
|
||||
if not dumping:
|
||||
for x in range(len(row.field)):
|
||||
col = self._columns[x]
|
||||
value = (decode_from_bytes(row.field[x])
|
||||
if col.is_bytes() else row.field[x])
|
||||
item[x] = from_protobuf(col._proto_type, value)
|
||||
return Row(self, item)
|
||||
|
||||
def _page_in_items(self):
|
||||
if self._closed:
|
||||
return False
|
||||
|
||||
count = 0
|
||||
for i in range(self._page_size):
|
||||
item = self._read_item(False)
|
||||
if item is None:
|
||||
break
|
||||
self._items.append(item)
|
||||
count += 1
|
||||
return count
|
||||
|
||||
def fetch_one(self):
|
||||
""" Fetch one item.
|
||||
|
||||
Returns:
|
||||
Row/DbDoc: one result item.
|
||||
"""
|
||||
if self._closed:
|
||||
return None
|
||||
|
||||
return self._read_item(False)
|
||||
|
||||
def fetch_all(self):
|
||||
"""Fetch all items.
|
||||
|
||||
Returns:
|
||||
list: The list of items.
|
||||
"""
|
||||
while True:
|
||||
if not self._page_in_items():
|
||||
break
|
||||
return self._items
|
||||
|
||||
|
||||
class RowResult(BufferingResult):
|
||||
"""Allows traversing the Row objects returned by a Table.select operation.
|
||||
|
||||
Args:
|
||||
connection (mysqlx.connection.Connection): The Connection object.
|
||||
"""
|
||||
def __init__(self, connection):
|
||||
super(RowResult, self).__init__(connection)
|
||||
|
||||
@property
|
||||
def columns(self):
|
||||
"""list: The list of columns.
|
||||
"""
|
||||
return self._columns
|
||||
|
||||
|
||||
class SqlResult(RowResult):
|
||||
"""Represents a result from a SQL statement.
|
||||
|
||||
Args:
|
||||
connection (mysqlx.connection.Connection): The Connection object.
|
||||
"""
|
||||
def __init__(self, connection):
|
||||
super(SqlResult, self).__init__(connection)
|
||||
self._has_more_results = False
|
||||
|
||||
def get_autoincrement_value(self):
|
||||
"""Returns the identifier for the last record inserted.
|
||||
"""
|
||||
return self._generated_id
|
||||
|
||||
def next_result(self):
|
||||
if self._closed:
|
||||
return False
|
||||
self._has_more_results = False
|
||||
self._init_result()
|
||||
return True
|
||||
|
||||
|
||||
class DocResult(BufferingResult):
|
||||
"""Allows traversing the DbDoc objects returned by a Collection.find
|
||||
operation.
|
||||
|
||||
Args:
|
||||
connection (mysqlx.connection.Connection): The Connection object.
|
||||
"""
|
||||
def __init__(self, connection):
|
||||
super(DocResult, self).__init__(connection)
|
||||
|
||||
def _read_item(self, dumping):
|
||||
row = super(DocResult, self)._read_item(dumping)
|
||||
if row is None:
|
||||
return None
|
||||
return DbDoc(decode_from_bytes(row[0]))
|
1528
elitebot/lib/python3.11/site-packages/mysqlx/statement.py
Normal file
1528
elitebot/lib/python3.11/site-packages/mysqlx/statement.py
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue