gOdZddlZddlZddlmZddlmZddlmZddl m Z m Z ddl m Z dd lmZdd lmZmZmZGd d eZd Zd>dZd>dZd>dZd>dZGddeZGddeZGddeZGddeZGddeZ GddeZ!GddeZ"Gd d!eZ#Gd"d#eZ$Gd$d%eZ%Gd&d'eZ&Gd(d)eZ'Gd*d+eZ(Gd,d-eZ)Gd.d/eZ*Gd0d1eZ+Gd2d3e+Z,Gd4d5eZ-Gd6d7eZ.Gd8d9e.Z/Gd:d;e/Z0Gd<d=eZ1y)?zImplementation of Statements.N)ProgrammingError) ExprParser) STRING_TYPES) Algorithms Securities)DbDoc)mysqlx_crud_pb2) SqlResultResult ColumnTypeceZdZdZy)Exprc||_yN)expr)selfrs g/opt/hc_python/lib64/python3.12/site-packages/../../../lib/python3.12/site-packages/mysqlx/statement.py__init__z Expr.__init__&s  N)__name__ __module__ __qualname__rrrrr%srrc^t|dk(rt|dttfr|dS|S)Nrr)len isinstancelisttuple)valuess rflexible_paramsr!*s. 6{aJvay4.Aay Mrczd|vr&|ddk(xr|ddk(xs|ddk(xr|ddk(S|ddk(xr|ddk(S)zCheck if the given identifier is quoted. Args: identifier (string): Identifier to check. sql_mode (Optional[string]): SQL mode. Returns: `True` if the identifier has backtick quotes, and False otherwise. ANSI_QUOTESr`"r identifiersql_modes ris_quoted_identifierr*0sk A#%?*R.C*?AA#%?*R.C*? B!}#= 2#(==rct||r|Sd|vr!dj|jddSdj|jddS)aQuote the given identifier with backticks, converting backticks (`) in the identifier name with the correct escape sequence (``) unless the identifier is quoted (") as in sql_mode set to ANSI_QUOTES. Args: identifier (string): Identifier to quote. sql_mode (Optional[string]): SQL mode. Returns: A string with the identifier quoted with backticks. r#z"{0}"r&z""z`{0}`r$z``)r*formatreplacer's rquote_identifierr.AsTJ1 ~~j00d;<<~~j00d;<eZdZdZddZedZedZdZy) Statementa Provides base functionality for statement objects. Args: target (object): The target database object, it can be :class:`mysqlx.Collection` or :class:`mysqlx.Table`. doc_based (bool): `True` if it is document based. cV||_||_|r|j|_yd|_yr)_target _doc_based _connection)rtarget doc_baseds rrzStatement.__init__ss' #176--Trc|jS)z,object: The database object target. )r@rs rrCzStatement.targetxs||rc.|jjS)z3:class:`mysqlx.Schema`: The Schema object. )r@schemarFs rrHzStatement.schema~s||"""rctzqExecute the statement. Raises: NotImplementedError: This method must be implemented. NotImplementedErrorrFs rexecutezStatement.execute "!rN)T) rrr__doc__rpropertyrCrHrMrrrr>r>ks:B  ## "rr>c\eZdZdZd fd ZdZdZd dZdZdZ dZ d Z d Z d Z xZS)FilterableStatementaA statement to be used with filterable statements. Args: target (object): The target database object, it can be :class:`mysqlx.Collection` or :class:`mysqlx.Table`. doc_based (Optional[bool]): `True` if it is document based (default: `True`). condition (Optional[str]): Sets the search condition to filter documents or records. ctt| ||d|_d|_d|_d|_d|_d|_d|_ i|_ g|_ ||j|yy)NrCrDF) superrRr_has_projection _has_where _has_limit _has_sort _has_group_by _has_having _has_bindings _binding_map _bindingswhere)rrCrD condition __class__s rrzFilterableStatement.__init__sy !41!>!@  rc0d|_||_||_|S)aESets the maximum number of records or documents to be returned. Args: row_count (int): The maximum number of records or documents. offset (Optional[int]) The number of records or documents to skip. Returns: mysqlx.FilterableStatement: FilterableStatement object. T)rX _limit_offset_limit_row_count)r row_countoffsets rlimitzFilterableStatement.limits # ) rct|}d|_dj||_t |j|j j |_|S)zSets the sorting criteria. Args: *sort_clauses: The expression strings defining the sort criteria. Returns: mysqlx.FilterableStatement: FilterableStatement object. Trh)r!rYr1 _sort_strrrAparse_order_spec _sort_expr)r sort_clausess rsortzFilterableStatement.sortsR' 5 ,/$T^^)-%8::J:J:L  rct|}d|_dj||_t |j|j j |_yrg)r!rZr1 _grouping_strrrAparse_expr_list _groupingrls r _group_byzFilterableStatement._group_bysN &)! XXf-#D$6$6(,$799H9J rcfd|_t||j j|_yNT)r[rrAr_havingrr`s rrzFilterableStatement._havings(!)-@AFFH rcd|_t|}|dk(r|j|d|S|dkDr td|jj |d|dd|S)aBinds a value to a specific placeholder. Args: *args: The name of the placeholder and the value to bind. A :class:`mysqlx.DbDoc` object or a JSON string representation can be used. Returns: mysqlx.FilterableStatement: FilterableStatement object. Raises: ProgrammingError: If the number of arguments is invalid. Trrz#Invalid number of arguments to bind)namevalue)r\r _bind_singlerr^append)rargscounts rbindzFilterableStatement.bindsn"D  A:   d1g &  QY"#HI I NN ! !47T!W"E F rct|tr|jt|yt|tr@t j |}|jD]}|j|||yyr)rr rstrrjsonloadskeys)robjectdictkeys rrz FilterableStatement._bind_singles[ fe $ IIc&k "  -::f%Dyy{ #tCy)#.rctrJrKrFs rrMzFilterableStatement.execute rNr)TN)r)rrrrOrr_rnrtrzrrrrrM __classcell__ras@rrRrRs<  ""  KI0*"rrRc(eZdZdZfdZdZxZS) SqlStatementzA statement for SQL execution. Args: connection (mysqlx.connection.Connection): Connection object. sql (string): The sql statement to be executed. cLtt| dd||_||_yNFrT)rUrrrB_sql)r connectionsqlras rrzSqlStatement.__init__s& lD*$%*H% rcv|jj|jt|jS)zaExecute the statement. Returns: mysqlx.SqlResult: SqlResult object. )rBsend_sqlrr rFs rrMzSqlStatement.executes- !!$)),))**rrrrrOrrMrrs@rrrs  +rrc.eZdZdZfdZdZdZxZS) AddStatementzA statement for document addition on a collection. Args: collection (mysqlx.Collection): The Collection object. cJtt| |g|_g|_yN)rC)rUrr_values_idsr collectionras rrzAddStatement.__init__/s# lD***=  rct|D]R}t|tr|jj |/|jj t|T|S)zAdds a list of documents into a collection. Args: *values: The documents to be added into the collection. Returns: mysqlx.AddStatement: AddStatement object. )r!rr rr)rr vals raddzAddStatement.add4sL#F+C#u% ##C( ##E#J/ ,  rct|jdk(r tS|jD]+}|jj |j -|j j|S)[Execute the statement. Returns: mysqlx.Result: Result object. r)rrr rr ensure_idrB send_insert)rdocs rrMzAddStatement.executeDs[ t||  !8O<tt| ||g|_y)N)rCr`)rUrr _update_opsrrr`ras rrzModifyStatement.__init__ns% ot-Z8A . Crc|jjttjj |||S)a2Sets or updates attributes on documents in a collection. Args: doc_path (string): The document path of the item to be set. value (string): The value to be set on the specified attribute. Returns: mysqlx.ModifyStatement: ModifyStatement object. )rrrrrITEM_SETrdoc_pathrs rsetzModifyStatement.setss6  z11::He L N rc|jjttjj |||S)ajAdd an update to the statement setting the field, if it exists at the document path, to the given value. Args: doc_path (string): The document path of the item to be set. value (object): The value to be set on the specified attribute. Returns: mysqlx.ModifyStatement: ModifyStatement object. )rrrrr ITEM_REPLACErs rchangezModifyStatement.changes:  z11>>   rc |jjt|Dcgc]&}ttj j |(c}|Scc}w)aRemoves attributes from documents in a collection. Args: doc_path (string): The document path of the attribute to be removed. Returns: mysqlx.ModifyStatement: ModifyStatement object. )rextendr!rrr ITEM_REMOVE)r doc_pathsxs runsetzModifyStatement.unsetsW $i0!20 z11==q A0!2 3 !2s+Ac|jjttjj |||S)aInsert a value into the specified array in documents of a collection. Args: field (string): A document path that identifies the array attribute and position where the value will be inserted. value (object): The value to be inserted. Returns: mysqlx.ModifyStatement: ModifyStatement object. )rrrrr ARRAY_INSERTrfieldrs r array_insertzModifyStatement.array_inserts6  z11>>u M O rc|jjttjj |||S)aInserts a value into a specific position in an array attribute in documents of a collection. Args: doc_path (string): A document path that identifies the array attribute and position where the value will be inserted. value (object): The value to be inserted. Returns: mysqlx.ModifyStatement: ModifyStatement object. )rrrrr ARRAY_APPENDrs r array_appendzModifyStatement.array_appends:  z11>>   rc8|jj|SrrBupdaterFs rrMzModifyStatement.execute &&t,,rr) rrrrOrrrrrrrMrrs@rrrfs+   $-rrc<eZdZdZdfd ZdZdZdZdZxZ S) FindStatementaA statement document selection on a Collection. Args: collection (mysqlx.Collection): The Collection object. condition (Optional[str]): An optional expression to identify the documents to be retrieved. If not specified all the documents will be included on the result unless a limit is set. c0tt| |d|yr)rUrrrs rrzFindStatement.__init__s mT+JiHrc |j|S)zSets a document field filter. Args: *fields: The string expressions identifying the fields to be extracted. Returns: mysqlx.FindStatement: FindStatement object. )rnrls rrmzFindStatement.fieldss t((rc$|j||S)zSets a grouping criteria for the resultset. Args: *fields: The string expressions identifying the grouping criteria. Returns: mysqlx.FindStatement: FindStatement object. rrls rgroup_byzFindStatement.group_by  rc(|j||S)a=Sets a condition for records to be considered in agregate function operations. Args: condition (string): A condition on the agregate functions used on the grouping criteria. Returns: mysqlx.FindStatement: FindStatement object. rrs rhavingzFindStatement.having Y rc8|jj|S)zaExecute the statement. Returns: mysqlx.DocResult: DocResult object. rBfindrFs rrMzFindStatement.execute $$T**rr) rrrrOrrmrrrMrrs@rrrs"I )  +rrc:eZdZdZfdZdZdZdZdZxZ S)SelectStatementzA statement for record retrieval operations on a Table. Args: table (mysqlx.Table): The Table object. *fields: The fields to be retrieved. cLtt| |d|j|yNF)rUrrrnrtablermras rrzSelectStatement.__init__s$ ot-eU;&!rc$|j||S)zSets a grouping criteria for the resultset. Args: *fields: The fields identifying the grouping criteria. Returns: mysqlx.SelectStatement: SelectStatement object. rrls rrzSelectStatement.group_byrrc(|j||S)a;Sets a condition for records to be considered in agregate function operations. Args: condition (str): A condition on the agregate functions used on the grouping criteria. Returns: mysqlx.SelectStatement: SelectStatement object. rrs rrzSelectStatement.havingrrc8|jj|S)zaExecute the statement. Returns: mysqlx.RowResult: RowResult object. rrFs rrMzSelectStatement.execute,rrc N|jrdj|jnd}|jrdj|jnd}|j rdj|j nd}|jrdj|jnd}|jr&dj|j|jnd}djt|dd |jj|jj||||| }|S) Nz WHERE {0}z GROUP BY {0}z HAVING {0}z ORDER BY {0}z LIMIT {0} OFFSET {1}zISELECT {select} FROM {schema}.{table}{where}{group}{having}{order}{limit}ri*)selectrHrrtr_grouprorder)rWr,rcrZr|r[rrYrvrXrqrpgetattrrHrrC)rr_rrorder_byrtstmts rget_sqlzSelectStatement.get_sql4s48OO ##DKK0   #))$*<*<=$& 7;7G7G%%dll3R=A^^?))$..9 $(??(..t/D/D    8: !!'t%6<{{''t{{/?/?u8F("("L  r) rrrrOrrrrMrrrs@rrrs! "  +rrc.eZdZdZfdZdZdZxZS)InsertStatementzA statement for insert operations on Table. Args: table (mysqlx.Table): The Table object. *fields: The fields to be inserted. cXtt| |dt||_g|_yr)rUrrr!_fieldsrrs rrzInsertStatement.__init__Ms* ot-Ue-L&/  rcZ|jjtt||S)zSet the values to be inserted. Args: *values: The values of the columns to be inserted. Returns: mysqlx.InsertStatement: InsertStatement object. )rrrr!rr s rr zInsertStatement.valuesRs% D&!9:; rc8|jj|Sr)rBrrFs rrMzInsertStatement.execute^s ++D11r)rrrrOrr rMrrs@rrrFs  2rrc.eZdZdZfdZdZdZxZS)UpdateStatementzA statement for record update operations on a Table. Args: table (mysqlx.Table): The Table object. *fields: The fields to be updated. c>tt| |dg|_yr)rUr rrrs rrzUpdateStatement.__init__ns ot-Ue-Lrc|jjttjj |||S)aUpdates the column value on records in a table. Args: field (string): The column name to be updated. value (object): The value to be set on the specified column. Returns: mysqlx.UpdateStatement: UpdateStatement object. )rrrrrrrs rrzUpdateStatement.setrs6  z1155ue D F rc8|jj|S)zZExecute the statement. Returns: mysqlx.Result: Result object rrFs rrMzUpdateStatement.executerr)rrrrOrrrMrrs@rr r gs  -rr c(eZdZdZfdZdZxZS)RemoveStatementzA statement for document removal from a collection. Args: collection (mysqlx.Collection): The Collection object. c.tt| |yr)rUrrrs rrzRemoveStatement.__init__s ot-Z-@rc8|jj|SrrBdeleterFs rrMzRemoveStatement.executerrrrs@rrrs A-rrc*eZdZdZdfd ZdZxZS)DeleteStatementzA statement that drops a table. Args: table (mysqlx.Table): The Table object. condition (Optional[str]): The string with the filter expression of the rows to be deleted. c2tt| ||dy)NF)rCr`rD)rUrr)rrr`ras rrzDeleteStatement.__init__s ot-U8A8= . ?rc8|jj|SrrrFs rrMzDeleteStatement.executerrrrrs@rrrs? -rrc.eZdZdZfdZdZdZxZS)CreateCollectionIndexStatementzA statement that creates an index on a collection. Args: collection (mysqlx.Collection): Collection. index_name (string): Index name. is_unique (bool): `True` if the index is unique. cXtt| |||_||_g|_yr)rUrr _index_name _is_uniquer)rr index_name is_uniqueras rrz'CreateCollectionIndexStatement.__init__s, ,d??rN)rrrr7INDEXrrrrrr/r/sL E @rr/cNeZdZdZd fd ZdZdZdZdZdZ dZ d Z xZ S) CreateViewStatementzA statement for creating views. Args: view (mysqlx.View): The View object. replace (Optional[bool]): `True` to add replace. ctt| |d||_|j|_|j |_||_g|_ tj|_ tj|_d|_d|_d|_yr)rUr:r_viewrH_schemarr1_replacer3r UNDEFINED _algorithmrDEFINER _security_definer _defined_as _check_option)rviewr-ras rrzCreateViewStatement.__init__st !411O {{ YY   $..#++ !rcL|Dcgc] }t|c}|_|Scc}w)zSets the column names. Args: columns (list): The list of column names. Returns: mysqlx.CreateViewStatement: CreateViewStatement object. )r.r3)rr5cols rr5zCreateViewStatement.columnss,;BB'3)#.'B  Cs!c||_|S)zSets the algorithm. Args: mysqlx.constants.ALGORITHMS: The algorithm. Returns: mysqlx.CreateViewStatement: CreateViewStatement object. )r@)r algorithms rrJzCreateViewStatement.algorithm!$ rc||_|S)zSets the SQL security mode. Args: mysqlx.constants.SECURITIES: The SQL security mode. Returns: mysqlx.CreateViewStatement: CreateViewStatement object. )rB)rsecuritys rrMzCreateViewStatement.security-s" rc||_|S)zSets the definer. Args: definer (string): The definer. Returns: mysqlx.CreateViewStatement: CreateViewStatement object. )rC)rdefiners rrOzCreateViewStatement.definer9   rc||_|S)zSets the SelectStatement statement for describing the view. Args: mysqlx.SelectStatement: SelectStatement object. Returns: mysqlx.CreateViewStatement: CreateViewStatement object. )rD)r statements r defined_aszCreateViewStatement.defined_asEs% rc||_|S)zSets the check option. Args: mysqlx.constants.CHECK_OPTIONS: The check option. Returns: mysqlx.CreateViewStatement: CreateViewStatement object. )rE)r check_options rwith_check_optionz%CreateViewStatement.with_check_optionQs* rc J|jrdnd}|jrdj|jnd}|jr*djdj |jnd}t |j j|jf}|jrdj|jnd}dj||j||j|||j|}|jjd ||jS) zhExecute the statement to create a view. Returns: mysqlx.View: View object. z OR REPLACEr DEFINER = {0} ({0}),  WITH {0} CHECK OPTIONzCREATE{replace} ALGORITHM = {algorithm}{definer} SQL SECURITY {security} VIEW {view_name}{columns} AS {defined_as}{check_option})r-rJrOrM view_namer5rSrUr)r>rCr,r3r1r3r=rr1rEr@rBrDrBr&r<)rr-rOr5r\rUrs rrMzCreateViewStatement.execute]s $(==-b]]#))$--8(* ]]//$))DMM":;(* . 0A0A4::/NO ,,066t7I7IJ24 &DOO!(4>>#,g$($4$4&2 4  ))%5zzr)F) rrrrOrr5rJrMrOrSrVrMrrs@rr:r:s0 "      rr:c(eZdZdZfdZdZxZS)AlterViewStatementzYA statement for alter views. Args: view (mysqlx.View): The View object. c,tt| |yr)rUr^r)rrFras rrzAlterViewStatement.__init__~s  $06rc (|jrdj|jnd}|jr*djdj|jnd}t |j j |jf}|jrdj|jnd}dj|j||j|||j|}|jjd||jS) zgExecute the statement to alter a view. Returns: mysqlx.View: View object. rXrrYrZr[zvALTER ALGORITHM = {algorithm}{definer} SQL SECURITY {security} VIEW {view_name}{columns} AS {defined_as}{check_option})rJrOrMr\r5rSrUr)rCr,r3r1r3r=rr1rEr@rBrDrBr&r<)rrOr5r\rUrs rrMzAlterViewStatement.executes]]#))$--8(* ]]//$))DMM":;(* . 0A0A4::/NO ,,066t7I7IJ24 &4??G"&..I!(T5E5E&24  ))%5zzrrrs@rr^r^xs 7rr^ceZdZdZej dej ZfdZe dZ dZ dZ dZ dZd Zd Zd Zd Zd ZdZdZdZdZdZdZxZS)CreateTableStatementzA statement that creates a new table if it doesn't exist already. Args: collection (mysqlx.Schema): The Schema object. table_name (string): The name for the new table. z$(from\s+)([`\"].+[`\"]|[^\.]+)(\s|$)c>tt| |d|_d|_d|_d|_d|_d|_g|_ g|_ g|_ g|_ g|_ d|_||_dj!|j"j%|_y)NFrz \1{0}.\2\3)rUrbr_charset _collation_comment_as_like_tempr3_f_keys_indices_p_keys _u_indices _auto_incr1r,rHget_name _tbl_repl)rrHr8ras rrzCreateTableStatement.__init__s "D26:         &--dkk.B.B.DErchtt|jj|jS)z7string: The fully qualified name of the Table. )r3r<rHrr1rFs rr8zCreateTableStatement.table_names,**: KK  djj+*+ +rcrg}|jd|jr|jd|jr|jd|jr|jddj |}|j |j |j|j|jS)NzAUTO_INCREMENT = {inc}z!DEFAULT CHARACTER SET = {charset}zDEFAULT COLLATE = {collation}zCOMMENT = '{comment}'rh)inccharset collationcomment)rrdrerfr1r,rn)roptions table_optss r_get_table_optsz$CreateTableStatement._get_table_optss/0 == NN> ? ?? NN: ; == NN2 3XXg&   T^^T]]oot}}!> >rc2g}|jr9|jdjdj|j|jD]!}|j|j #|j D]!}|j|j #|jD]!}|j|j #|jD]!}|j|j #dj|S)NzPRIMARY KEY ({0})rh) rlrr,r1r3rrjrkrm)rdefsrHrindexs r_get_create_defz$CreateTableStatement._get_create_defs << KK+22388DLL3IJ K==C KK &!<           1rrbc4eZdZdZdZdZdZdZdZdZ y) ColumnDefBasezA Base class defining the basic parameters required to define a column. Args: name (string): Name of the column. type (MySQLx.ColumnType): Type of the column. size (int): Size of the column. ctd|_d|_d|_d|_||_||_d|_||_y)NFr)_default_schema _not_null_p_key_u_indexr1_sizerf_type)rrtypesizes rrzColumnDefBase.__init__s;#      rcd|_|S)zwDisable NULL values for this column. Returns: mysqlx.ColumnDefBase: ColumnDefBase object. T)rrFs rnot_nullzColumnDefBase.not_null  rcd|_|S)zwSet current column as a Unique Index. Returns: mysqlx.ColumnDefBase: ColumnDefBase object. T)rrFs r unique_indexzColumnDefBase.unique_indexs   rc||_|S)zAdd a comment to the column. Args: comment (string): Comment to be added to the column. Returns: mysqlx.ColumnDefBase: ColumnDefBase object. rrs rrvzColumnDefBase.commentrPrcd|_|S)ztSets the Column as a Primary Key. Returns: mysqlx.ColumnDefBase: ColumnDefBase object. T)rrFs rprimaryzColumnDefBase.primarys   rc||_yrrrrHs rrzColumnDefBase.set_schema %rN) rrrrOrrrrvrrrrrrrs% &rrcleZdZdZdfd ZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZxZS) ColumnDefzClass containing the complete definition of the Column. Args: name (string): Name of the column. type (MySQL.ColumnType): Type of the column. size (int): Size of the column. ctt| |||d|_d|_d|_d|_d|_d|_d|_ g|_ g|_ d|_ d|_ yr)rUrr_ref_default _decimals _ref_table_binaryrn _unsignedr _ref_fieldsrdre)rrrrras rrzColumnDef.__init__sd i'dD9     rcd}|jrytj|js>tj|jstj |jrdj |j}ntj|jr7|jr+dj |j|jxsd}nItj|jr*dj dj|j}|jrdj |}|jrdj |}|jrdj ||j}|jrd j ||j}d j tj |j|S) Nrz({0})z ({0}, {1})rrhz {0} UNSIGNEDz {0} BINARYz{0} CHARACTER SET {1}z{0} COLLATE {1}{0} {1})rr is_numericris_char is_binaryr, is_decimalsr is_finite_setr1rrrrdre to_string)rtype_defs r _data_typezColumnDef._data_typesB :::00<   tzz *j.B.B4::.N~~djj1H  # #DJJ /DJJ#**4::t~~7JKH  % %djj 1~~chht||&<=H >>%,,X6H <<#**84H ==.55h NH ??(//$//JH 4 4TZZ @(KKrcf|jrdnd}|jrdnd}|jrdnd}|jrdnd}dj |j ||||}|j rdj |}n|jrd j |}|jra|jrUtt|j|j}d j ||d j|j}|j |j|j S) Nz NOT NULLz NULLz AUTO_INCREMENTrz DEFAULT {default}z COMMENT '{comment}'z{0}{1}{2}{3}{4}z{0} PRIMARY KEYz{0} UNIQUE KEYz{0} REFERENCES {1} ({2})rh)defaultrv)rrnrrfr,rrrrrr3r<rr1)rnullauto_incrrvdefn ref_tables r_col_definitionzColumnDef._col_definitions"nn{'(,$B*.--&R,0MM(r ''(94 g ;;$++D1D ]]#**40D ??t//23C$$doo478I-44T9))*,D{{4==$--{HHrct|tr|j|_|S| d|_|St ||_|S)zSets the default value of this Column. Args: default_val (object): The default value of the Column. Can be a string, number or :class`MySQLx.Expr`. Returns: mysqlx.ColumnDef: ColumnDef object. NULL)rrrrrepr)r default_vals r set_defaultzColumnDef.set_defaultsK k4 (',,DM   "DM !-DM rcd|_|S)zlSet the Column to Auto Increment. Returns: mysqlx.ColumnDef: ColumnDef object. TrrFs rauto_incrementzColumnDef.auto_incrementrrc.t||_||_|S)zSets the Column as a Foreign Key. Args: name (string): Name of the referenced Table. *refs: Fields this Column references. Returns: mysqlx.ColumnDef: ColumnDef object. )r!rrrrrefss r foreign_keyzColumnDef.foreign_key$s+D1 rcd|_|S)zfSet the Column as unsigned. Returns: mysqlx.ColumnDef: ColumnDef object. T)rrFs runsignedzColumnDef.unsigned2rrc||_|S)zSet the size of the decimal Column. Args: size (int): Size of the decimal. Returns: mysqlx.ColumnDef: ColumnDef object. )r)rrs rdecimalszColumnDef.decimals;s rc||_|S)zSet the Charset type of the Column. Args: charset (string): Charset type. Returns: mysqlx.ColumnDef: ColumnDef object. rrs rrtzColumnDef.charsetGrPrc||_|S)zSet the Collation type of the Column. Args: collation (string): Collation type. Returns: mysqlx.ColumnDef: ColumnDef object. rrs rruzColumnDef.collationSrKrcd|_|S)zqSet the current column to binary type. Returns: mysqlx.ColumnDef: ColumnDef object. T)rrFs rbinaryzColumnDef.binary_   rc<ttt||_|S)zSet the Enum/Set values. Args: *values: Values for Enum/Set type Column. Returns: mysqlx.ColumnDef: ColumnDef object. )maprr!rrs rr zColumnDef.valueshs4&!9:  rcVdj|j|jS)Nr)r,r1rrFs rrzColumnDef.get_sqlts" D,@,@,BCCrr)rrrrOrrrrrrrrrtrurr rrrs@rrrsL"L*I*&     Drrc2eZdZdZfdZdZfdZxZS)GeneratedColumnDefzClass used to describe a Generated Column. Args: name: Name of the column. col_type: Type of the column. expr: The Expression used to generate the value of this column. ctt| ||t|tsJd|_|j |_yr)rUrrrr_storedr_expr)rrcol_typerras rrzGeneratedColumnDef.__init__s7  $0x@$%%% YY rcd|_|S)zSet the Generated Column to be stored. Returns: mysqlx.GeneratedColumnDef: GeneratedColumnDef object. T)rrFs rstoredzGeneratedColumnDef.storedrrcdjtt||j|j rdSdS)Nz {0} GENERATED ALWAYS AS ({1}){2}z STOREDr)r,rUrrrr)rras rrzGeneratedColumnDef.get_sqls@188 $d 3 5 JJT\\ ; ;79; ;r)rrrrOrrrrrs@rrrxs ;;rrcVeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZy) ForeignKeyDefzClass describing a Foreign Key.rrcg|_g|_d|_d|_d|_|j t j|_|j t j|_ yr) r _f_fieldsr1_f_tabler_actionr NO_ACTION_update_action_delete_actionrFs rrzForeignKeyDef.__init__sT   #"ll=+B+BC"ll=+B+BCrcv|tjury|tjury|tjuryy)NRESTRICTCASCADEzSET NULLz NO ACTION)rr r SET_NULLractions rrzForeignKeyDef._actions8 ]++ + },, , }-- -rc||_yr)r1)rrs rrzForeignKeyDef.set_names  rc||_yrrrs rrzForeignKeyDef.set_schemarrc t||_|S)zAdd a list of fields in the parent table. Args: *fields: Fields in the given table which constitute the Foreign Key. Returns: mysqlx.ForeignKeyDef: ForeignKeyDef object. )r!rrls rrmzForeignKeyDef.fieldss'/  rc.t||_||_|S)zAdd the child table name and the fields. Args: name (string): Name of the referenced table. *refs: A list fields in the referenced table. Returns: mysqlx.ForeignKeyDef: ForeignKeyDef object. )r!rrrs r refers_tozForeignKeyDef.refers_tos)$/  rc2|j||_|S)aDefine the action on updating a Foreign Key. Args: action (int): Action to be performed on updating the reference. Can be any of the following values: 1. ForeignKeyDef.NO_ACTION 2. ForeignKeyDef.RESTRICT 3. ForeignKeyDef.CASCADE 4. ForeignKeyDef.SET_NULL Returns: mysqlx.ForeignKeyDef: ForeignKeyDef object. )rr rs r on_updatezForeignKeyDef.on_updates#ll62 rc2|j||_|S)aDefine the action on deleting a Foreign Key. Args: action (int): Action to be performed on updating the reference. Can be any of the following values: 1. ForeignKeyDef.NO_ACTION 2. ForeignKeyDef.RESTRICT 3. ForeignKeyDef.CASCADE 4. ForeignKeyDef.SET_NULL Returns: mysqlx.ForeignKeyDef: ForeignKeyDef object. )rr rs r on_deletezForeignKeyDef.on_deletes#ll62 rc dj|j}dj|j}dj|jdj |j t t|j|jdj |j}dj|||S)Nz ON UPDATE {0}z ON DELETE {0}z)FOREIGN KEY {0}({1}) REFERENCES {2} ({3})rhz {0} {1} {2}) r,r r r1r1rr3r<rrr)rrrrs rrzForeignKeyDef.get_sqls ''(;(;< ''(;(;<9@@ JJ.0J T114== A1C HHT^^ $&##C88rN)rrrrOrr r rrrrrrmrrrrrrrrrsG)IHGHD&  $"9rr)r)2rOrrerrorsrrrcompatr constantsrrdbdocr protobufr rresultr r r rrr!r*r.r3r<r>rRrrrrrrrr rrrr*r/r:r^rbrrrrrrrr!s|0$ $ -3116  >"=( 5$""DC")C"L+9+,'29'2T&b-)b-J9+'9+x=)=~2i2B-)-D-)-$-)-,'&Y'&TK9K, @ @ t)tn,Bl19l1^:&F:&zpD pDf;;:c9Fc9r