zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
U
¤ý°d©ã@spdZddlmZddlZddlZddlZddlmZmZddlm    Z    m
Z
m Z m Z m Z mZmZmZddlmZddlmZdd    lmZmZdd
lmZmZd d d dœdd„Zd d dœdd„Zd ddœdd„Zd ddœdd„Zd ddœdd„Zd ddœdd„Z d ddœdd „Z!d d!dœd"d#„Z"d d$dœd%d&„Z#d d'dœd(d)„Z$d d*dœd+d,„Z%Gd-d.„d.ƒZ&Gd/d0„d0ƒZ'Gd1d2„d2ƒZ(Gd3d4„d4ƒZ)Gd5d6„d6e)ƒZ*Gd7d8„d8e*ƒZ+Gd9d:„d:e*ƒZ,Gd;d<„d<e*ƒZ-Gd=d>„d>e*ƒZ.Gd?d@„d@e*ƒZ/GdAdB„dBe*ƒZ0GdCd „d ƒZ1GdDdE„dEƒZ2GdFdG„dGƒZ3GdHdI„dIe3ƒZ4GdJdK„dKe3ƒZ5GdLdM„dMe5ƒZ6GdNdO„dOe6ƒZ7GdPdQ„dQe5ƒZ8dS)Rz%Implementation of the Result classes.é)Ú annotationsN)ÚdatetimeÚ    timedelta)ÚAnyÚCallableÚDictÚListÚOptionalÚSequenceÚTupleÚUnioné)ÚMYSQL_CHARACTER_SETS)ÚDbDoc)Údecode_from_bytesÚ
deprecated)ÚConnectionTypeÚ
FieldTypesÚColumnÚbytesr)ÚcolumnÚpayloadÚreturnc
Cs’t|ƒdkrdS| ¡tjkr.t|dd…ƒSztj| ¡|ƒWStk
rŒ}z,t    j
  |›¡t    j
  |  d¡›¡WY¢dSd}~XYnXdS)NréÿÿÿÿÚhex) ÚlenÚget_typeÚ
ColumnTypeÚSTRINGrÚColumnProtoTypeÚ converter_mapÚget_proto_typeÚKeyErrorÚsysÚstderrÚwriteÚencode)rrÚerr©r(úDd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\mysqlx/result.pyÚ from_protobuf/s r*)rrcCs |dd…S)Nrr(©rr(r(r)Úbytes_from_protobuf>sr,ÚfloatcCs t|ƒdkst‚t d|¡dS)Néz<fr©rÚAssertionErrorÚstructÚunpackr+r(r(r)Úfloat_from_protobufCsr3cCs t|ƒdkst‚t d|¡dS)Néz<drr/r+r(r(r)Údouble_from_protobufHsr5zTuple[int, bytes]cCsœt|ƒdkrtdƒ‚d}d}d}|D]j}t|tƒr6|nt|ƒ}|d@dk}|d@}||K}||O}|r~|||dd…fS|d7}|d7}q$tdƒ‚dS)NrzPayload is emptyé€ér ézPayload too short)rÚ
ValueErrorÚ
isinstanceÚintÚordÚEOFError)rÚcurÚiÚshiftÚitemÚcharZeosZcur_bitsr(r(r)Úvarint_from_protobuf_streamMs   
rCr;cCs$t|ƒ\}}t|ƒdkr tdƒ‚|S)NrúPayload too long©rCrr9©rr?r(r(r)Úvarint_from_protobufcs  rGcCsLt|ƒ\}}t|ƒdkr tdƒ‚|d@r@|}|d?}|dO}n|d?}|S)NrrDr lrErFr(r(r)Úvarsint_from_protobufks  
rHz List[bytes]cCsœg}zxt|ƒ\}}t|ƒ|krLt|ƒdkrD|dkrDt|ƒdkrDgWStdƒ‚| |d|…¡||d…}t|ƒdkrzWq˜Wqtk
r”Yq˜YqXq|S)Nrr zInvalid Set encoding)rCrr9Úappend)rZset_pbZ    field_lenr(r(r)Úset_from_protobuf{s      rJzdecimal.DecimalcCs$g}d}t|dtƒr|dn
t|dƒ}|dd…}|D]Ö}t|tƒrL|nt|ƒ}|d@d?}|d@}|dkrÀ| |¡|dkrŽ| |¡n0|dkr¢d}qn|dkr¶d}qntd    ƒ‚q:|dkràd}|dksØt‚qq:|dkrd}|dksút‚qq:td
|›ƒ‚q:t ||| f¡S) Nrr éðr.éé
é é z Invalid BCDz Invalid BCD: )r:r;r<rIr9r0ÚdecimalÚDecimal)rÚdigitsÚsignZscalerArBZhigh_bcdZlow_bcdr(r(r)Údecimal_from_protobufs:"  
 
 
 rTrcCs’d}d}d}d}t|ƒ\}}t|ƒ\}}t|ƒ\}}z4t|ƒ\}}t|ƒ\}}t|ƒ\}}t|ƒ\}}Wntk
r|YnXt|||||||ƒS)Nr)rCr9r)rÚhourÚminutesÚsecondsÚusecondsÚyearÚmonthÚdayr(r(r)Údatetime_from_protobuf´s      r\rcCs¼d}d}d}d}|ddk}|dd…}z4t|ƒ\}}t|ƒ\}}t|ƒ\}}t|ƒ\}}Wntk
rpYnX|r¬|r„|d9}n(|r’|d9}n|r |d9}n |r¬|d9}t||||dS)Nrr r)ÚhoursrVrWÚ microseconds)rCr9r)rrUrVrWrXÚnegater(r(r)Útime_from_protobufÉs8     
 
 
ÿr`c@seZdZdZdS)Ú
Collationsé!N)Ú__name__Ú
__module__Ú __qualname__ZUTF8_GENERAL_CIr(r(r(r)raêsrac@s8eZdZdZdZdZdZdZdZdZ    dZ
d    Z d
Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%e&d$d%d&œd'd(„ƒZ'e&d)d$d*œd+d,„ƒZ(e&d-d.d/œd0d1„ƒZ)e&d-d.d/œd2d3„ƒZ*e&d-d.d/œd4d5„ƒZ+e&d-d.d/œd6d7„ƒZ,e&d-d.d/œd8d9„ƒZ-e&d-d.d/œd:d;„ƒZ.d<S)=rr éér.éér8r4é    rMé rNrOérLééééééééééééééééé rbé"é#rú Optional[str])ÚneedlercCs*t|ƒ ¡D]\}}||kr |Sq dS©N)ÚvarsÚitems)ÚclsrÚkeyÚvaluer(r(r)Ú    to_strings
zColumnType.to_stringÚstr)r†rcCst|| ¡dƒSr‚)ÚgetattrÚupper)r…r†r(r(r)Ú from_stringszColumnType.from_stringr;Úbool)Úcol_typercCs||j|jfkSr‚)ÚCHARÚVARCHAR©r…rŽr(r(r)Úis_charsþzColumnType.is_charcCs||j|jfkSr‚)ÚBINARYÚ    VARBINARYr‘r(r(r)Ú    is_binary%sþzColumnType.is_binarycCs||j|j|j|jfkSr‚)ÚTEXTÚTINYTEXTÚ
MEDIUMTEXTÚLONGTEXTr‘r(r(r)Úis_text,s üzColumnType.is_textcCs||j|j|j|j|jfkSr‚)ÚREALÚDOUBLEÚFLOATÚDECIMALÚNUMERICr‘r(r(r)Ú is_decimals5sûzColumnType.is_decimalscCs ||j|j|j|j|j|jfkSr‚)ÚBITÚTINYINTÚSMALLINTÚ    MEDIUMINTÚINTÚBIGINTr‘r(r(r)Ú
is_numeric?súzColumnType.is_numericcCs||j|jfkSr‚)ÚSETÚENUMr‘r(r(r)Ú is_finite_setJsþzColumnType.is_finite_setN)/rcrdrer¡r¢r£r¤r¥r¦r›rržrŸrœÚJSONrÚBYTESÚTIMEÚDATEÚDATETIMEÚ    TIMESTAMPr¨r©ÚGEOMETRYÚXMLZYEARrrr“r”ZTINYBLOBZBLOBZ
MEDIUMBLOBZLONGBLOBr—r–r˜r™Ú classmethodrˆrŒr’r•ršr r§rªr(r(r(r)rîsf    
rc@sreZdZUdZdZdZdZdZdZdZ    dZ
d    Z d
Z d Z eeeeeee    eeeeeeee ee
ee ee ei Zd ed <dS)rr rfrhrir8rMrNrLrmrnroz!Dict[int, Callable[[bytes], Any]]r N)rcrdreÚSINTÚUINTrœrr¬r­r¯r¨r©r¡ržrHrGr,r\r`r3r5rJrTr Ú__annotations__r(r(r(r)rRsD
õrc@sReZdZdddœdd„Zddœdd    „Zeddœd
d „ƒZejddd œd d „ƒZdS)ÚFlagsr;ÚNone)r‡rcCsVi|_i|_|jj ¡D]2\}}| d¡r,qt|tƒr||j|<||j|<q||_dS)NÚ__)    Z_allowed_flagsÚ _flag_namesÚ    __class__Ú__dict__r„Ú
startswithr:r;Ú_value)Úselfr‡r†Úvalr(r(r)Ú__init__os
 
 
 zFlags.__init__r‰©rc    Csˆd}g}|j}tddƒD]d}|dK}||@}|rz| |j|¡Wqtk
rztj |j›¡tj |jj    ›¡YqXqd 
|¡S)Nr ré?ú,) r¾ÚrangerIrºr"r#r$r%r»r¼Újoin)r¿ÚmaskZ
flag_namesr‡Ú_Úflagr(r(r)Ú__str__zsz Flags.__str__cCs|jSr‚©r¾©r¿r(r(r)r‡Œsz Flags.value)rÀrcCs
||_dSr‚rË)r¿rÀr(r(r)r‡sN)rcrdrerÁrÊÚpropertyr‡Úsetterr(r(r(r)r·ns  r·c@s eZdZdZdZdZdZdZdS)Ú ColumnFlagsrmr}é@r6éN)rcrdreZNOT_NULLZ PRIMARY_KEYZ
UNIQUE_KEYZ MULTIPLE_KEYZAUTO_INCREMENTr(r(r(r)rϕs
rÏc@seZdZdZdS)ÚDatetimeColumnFlagsr N)rcrdrer°r(r(r(r)rҝsrÒc@seZdZdZdS)ÚUIntColumnFlagsr N)rcrdreZZEROFILLr(r(r(r)rÓ¡srÓc@seZdZdZdS)ÚDoubleColumnFlagsr N©rcrdreÚUNSIGNEDr(r(r(r)rÔ¥srÔc@seZdZdZdS)ÚFloatColumnFlagsr NrÕr(r(r(r)rשsr×c@seZdZdZdS)ÚBytesColumnFlagsr N)rcrdreZ    RIGHT_PADr(r(r(r)rØ­srØc@seZdZdZdZdZdS)ÚBytesContentTyper rfrgN)rcrdrer±r«r²r(r(r(r)rÙ±srÙc@seZdZdZdJddddddddddddddœ dd    „Zd
d œd d „Zdd œdd„Zdd œdd„Zdd œdd„Zdd œdd„Z    dd œdd„Z
e d
d œdd„ƒZ e d
d œdd„ƒZ e d
d œdd„ƒZe d
d œdd„ƒZe d
d œd d!„ƒZe dd œd"d#„ƒZe dd œd$d%„ƒZe dd œd&d'„ƒZe d
d œd(d)„ƒZe d
d œd*d+„ƒZd
d œd,d-„Zd
d œd.d/„Zd
d œd0d1„Zd
d œd2d3„Zd
d œd4d5„Zdd œd6d7„Zdd œd8d9„Zdd œd:d;„Zdd œd<d=„Zd
d œd>d?„Zd
d œd@dA„Z dBd œdCdD„Z!dEd œdFdG„Z"dBd œdHdI„Z#dS)Kra_Represents meta data for a table column.
 
    Args:
        col_type (int): The column type.
        catalog (str): The catalog.
        schema (str): The schema name.
        table (str): The table name.
        original_table (str): The original table name.
        name (str): The column name.
        original_name (str): The original table name.
        length (int): The column length,
        collation (str): The collation name.
        fractional_digits (int): The fractional digits.
        flags (int): The flags.
        content_type (int): The content type.
 
    .. versionchanged:: 8.0.12
    Nr;r€ú Optional[int]r¸) rŽÚcatalogÚschemaÚtableÚoriginal_tableÚnameÚ original_nameÚlengthÚ    collationÚfractional_digitsÚflagsÚ content_typerc Cst|ƒ|_t|ƒ|_t|ƒ|_t|ƒ|_t|ƒ|_||_d|_||_||_    |    |_
|
|_ | |_ | |_ d|_d|_d|_d|_d|_d|_d|_|j
dkrè|j
ttƒkr´td|j
›ƒ‚t|j
} | d|_| d|_d|jkpäd|jk|_| ¡|jtjtjtjtjtjfk|_dS)NFrzNo mapping found for collation r ÚbinaryZ_bin)rÚ_schemaÚ_nameÚ_original_nameÚ_tableÚ_original_tableÚ _proto_typeÚ    _col_typeÚ_catalogÚ_lengthZ
_collationÚ_fractional_digitsÚ_flagsÚ _content_typeÚ_number_signedÚ
_is_paddedÚ
_is_binaryÚ    _is_bytesÚ_collation_nameÚ_character_set_nameÚ
_zero_fillrrr9Ú    _map_typerr±r«r²r¬r)r¿rŽrÛrÜrÝrÞrßràrárârãräråÚinfor(r(r)rÁÎsH
 
 
 
 
 
 
 
 
ÿûzColumn.__init__r‰rÂcCst|j|j|jt|jƒdœƒS)N)rŽrÜrÝrä)r‰rírçrêrñrÌr(r(r)rÊsüÿzColumn.__str__cCsj|jtjkrtj|_nD|jtjkr,tj|_n.|jtjkrBtj|_n|jrRtj|_ntj    |_|j
d@|_ dS)z
Map bytes.r N) ròrÙr±rrír«r²rõr¬rrñrôrÌr(r(r)Ú
_map_bytess 
 
 
 
zColumn._map_bytescCsN|jdkrtj|_n6|jtj@dkr.tj|_n|jdkrBtj|_ntdƒ‚dS)z Map datetime.rMrrpz#Datetime mapping scenario unhandledN)    rïrr®rírñrÒr°r¯r9rÌr(r(r)Ú _map_datetimes
 
 
 
 
zColumn._map_datetimecCsb|jdkrtj|_nD|jdkr(tj|_n0|jdkr<tj|_n|jdkrPtj|_ntj|_d|_dS)z Map int type.r.rirjrkTN)    rïrr¢rír£r¤r¥r¦rórÌr(r(r)Ú _map_int_type's
 
 
 
 
 
 
 
zColumn._map_int_typecCsh|jdkrtj|_nD|jdkr(tj|_n0|jdkr<tj|_n|jdkrPtj|_ntj|_|jd@|_    dS)zMap uint type.rgrhr4rMr N)
rïrr¢rír£r¤r¥r¦rñrùrÌr(r(r)Ú_map_uint_type5s
 
 
 
 
 
 
 
zColumn._map_uint_typecCsF|jtjkr| ¡n*|jtjkr0| ¡n|jtjkrXtj|_|j    t
j @dk|_ nê|jtj kr€tj |_|j    t
j @dk|_ nÂ|jtjkr¨tj|_|j    t
j @dk|_ nš|jtjkr¾| ¡n„|jtjkrÔtj|_nn|jtjkrê| ¡nX|jtjkrtj|_n@|jtjkrtj|_n(|jtjkr2tj|_ntd|j›ƒ‚dS)z    Map type.rzUnknown column type N)rìrr´rþrµrÿrrrírñr×rÖZ_is_number_signedržrœr¬rür­r¯rýr¨r©r¡r9rÌr(r(r)rúCs4        
 
 
 
 
 
zColumn._map_typecCs|jS)z@str: The schema name.
 
        .. versionadded:: 8.0.12
        ©rçrÌr(r(r)Ú schema_nameaszColumn.schema_namecCs |jp
|jS)z?str: The table name.
 
        .. versionadded:: 8.0.12
        ©rërêrÌr(r(r)Ú
table_nameiszColumn.table_namecCs |jp
|jS)z@str: The table label.
 
        .. versionadded:: 8.0.12
        ©rêrërÌr(r(r)Ú table_labelqszColumn.table_labelcCs |jp
|jS)z@str: The column name.
 
        .. versionadded:: 8.0.12
        ©rérèrÌr(r(r)Ú column_nameyszColumn.column_namecCs |jp
|jS)zAstr: The column label.
 
        .. versionadded:: 8.0.12
        ©rèrérÌr(r(r)Ú column_labelszColumn.column_labelcCs|jS)z@int: The column type.
 
        .. versionadded:: 8.0.12
        ©rírÌr(r(r)Útype‰sz Column.typecCs|jS)zBint. The column length.
 
        .. versionadded:: 8.0.12
        ©rïrÌr(r(r)rá‘sz Column.lengthcCs|jS)zMint: The column fractional digits.
 
        .. versionadded:: 8.0.12
        ©rðrÌr(r(r)rã™szColumn.fractional_digitscCs|jS)zCstr: The collation name.
 
        .. versionadded:: 8.0.12
        ©r÷rÌr(r(r)Úcollation_name¡szColumn.collation_namecCs|jS)zGstr: The character set name.
 
        .. versionadded:: 8.0.12
        ©rørÌr(r(r)Úcharacter_set_name©szColumn.character_set_namecCs|jS)zUReturns the schema name.
 
        Returns:
            str: The schema name.
        rrÌr(r(r)Úget_schema_name±szColumn.get_schema_namecCs |jp
|jS)zSReturns the table name.
 
        Returns:
            str: The table name.
        rrÌr(r(r)Úget_table_name¹szColumn.get_table_namecCs |jp
|jS)zUReturns the table label.
 
        Returns:
            str: The table label.
        rrÌr(r(r)Úget_table_labelÁszColumn.get_table_labelcCs |jp
|jS)zUReturns the column name.
 
        Returns:
            str: The column name.
        rrÌr(r(r)Úget_column_nameÉszColumn.get_column_namecCs |jp
|jS)zWReturns the column label.
 
        Returns:
            str: The column label.
        rrÌr(r(r)Úget_column_labelÑszColumn.get_column_labelcCs|jS)zaReturns the column proto type.
 
        Returns:
            int: The column proto type.
        )rìrÌr(r(r)r!ÙszColumn.get_proto_typecCs|jS)zUReturns the column type.
 
        Returns:
            int: The column type.
        r
rÌr(r(r)rászColumn.get_typecCs|jS)zYReturns the column length.
 
        Returns:
            int: The column length.
        r rÌr(r(r)Ú
get_lengthészColumn.get_lengthcCs|jS)zoReturns the column fractional digits.
 
        Returns:
            int: The column fractional digits.
        r rÌr(r(r)Úget_fractional_digitsñszColumn.get_fractional_digitscCs|jS)z[Returns the collation name.
 
        Returns:
            str: The collation name.
        rrÌr(r(r)Úget_collation_nameùszColumn.get_collation_namecCs|jS)zcReturns the character set name.
 
        Returns:
            str: The character set name.
        rrÌr(r(r)Úget_character_set_nameszColumn.get_character_set_namercCs|jS)zxReturns `True` if is a number signed.
 
        Returns:
            bool: Returns `True` if is a number signed.
        )rórÌr(r(r)Úis_number_signed    szColumn.is_number_signedúUnion[bool, int]cCs|jS)zfReturns `True` if is padded.
 
        Returns:
            bool: Returns `True` if is padded.
        )rôrÌr(r(r)Ú    is_paddedszColumn.is_paddedcCs|jS)zdReturns `True` if is bytes.
 
        Returns:
            bool: Returns `True` if is bytes.
        )rörÌr(r(r)Úis_bytesszColumn.is_bytes) NNNNNNNNNNN)$rcrdreÚ__doc__rÁrÊrürýrþrÿrúrÍrrrrr    r rárãrrrrrrrr!rrrrrrrrr(r(r(r)rºsjó(6
 c@sXeZdZdZddddœdd„Zdd    œd
d „Zd d dœdd„Zedƒdddœdd„ƒZdS)ÚRowz½Represents a row element returned from a SELECT query.
 
    Args:
        resultset (mysqlx.SqlResult or mysqlx.RowResult): The result set.
        fields (`list`): The list of fields.
    z!Union[BufferingResult, RowResult]zSequence[FieldTypes]r¸)Ú    resultsetÚfieldsrcCs||_||_dSr‚)Ú_fieldsÚ
_resultset)r¿r!r"r(r(r)rÁ*sz Row.__init__r‰rÂcCs
t|jƒSr‚)Úreprr#rÌr(r(r)Ú__repr__0sz Row.__repr__zUnion[int, str]r©ÚindexrcCsdt|tƒr|j |¡n|}|dkr<t|tƒr<td|›dƒ‚|t|jƒksR|dkrZtdƒ‚|j|S)z\Returns the value of a column by name or index.
 
        .. versionchanged:: 8.0.12
        rú Column name 'ú ' not foundrzIndex out of range)r:r‰r$Úindex_ofr9rr#Ú
IndexError)r¿r(Ú    int_indexr(r(r)Ú __getitem__3s zRow.__getitem__ú8.0.12)Ú    str_indexrcCsH|j |¡}|t|jƒkr"tdƒ‚|dkr:td|›dƒ‚t|j|ƒS)zŽReturns the value using the column name.
 
        Args:
            str_index (str): The column name.
 
        .. deprecated:: 8.0.12
        zArgument out of rangerr)r*)r$r+rr#r,r9r‰)r¿r0r-r(r(r)Ú
get_string?s      zRow.get_stringN)    rcrdrerrÁr&r.rr1r(r(r(r)r "s  r c@sžeZdZdZdddœdd„Zddœd    d
„Zd dœd d „Zddœdd„Zdddœdd„Zdddddœdd„Z    dddœdd„Z
dddœdd„Z dddœd d!„Z d"S)#Ú
BaseResultz‰Provides base functionality for result objects.
 
    Args:
        connection (mysqlx.connection.Connection): The Connection object.
    rr¸©Ú
connectionrcCsH||_d|_d|_d|_g|_g|_|dkr4d|_n|j|_| ¡dS©NFrr)    Ú _connectionÚ_closedÚ_rows_affectedÚ _generated_idÚ_generated_idsÚ    _warningsÚ    _protocolÚprotocolZfetch_active_result©r¿r4r(r(r)rÁWszBaseResult.__init__r;rÂcCs|jS)z†Returns the number of affected items for the last operation.
 
        Returns:
            int: The number of affected items.
        ©r8rÌr(r(r)Úget_affected_items_countesz#BaseResult.get_affected_items_countz List[Dict[str, Union[int, str]]]cCs|jS)zZReturns the warnings.
 
        Returns:
            `list`: The list of warnings.
        )r;rÌr(r(r)Ú get_warningsmszBaseResult.get_warningscCs
t|jƒS)zcReturns the number of warnings.
 
        Returns:
            int: The number of warnings.
        )rr;rÌr(r(r)Úget_warnings_countuszBaseResult.get_warnings_countr©rÉrcCs
||_dS)z Sets if resultset fetch is done.N)r7©r¿rÉr(r(r)Ú
set_closed}szBaseResult.set_closedr‰)ÚlevelÚcodeÚmsgrcCs|j |||dœ¡dS)z«Append a warning.
 
        Args:
            level (int): The warning level.
            code (int): The warning code.
            msg (str): The warning message.
        )rFrGrHN)r;rI)r¿rFrGrHr(r(r)Úappend_warningszBaseResult.append_warningú    List[int])Ú generated_idsrcCs
||_dS)zSets the generated ids.N©r:)r¿rKr(r(r)Úset_generated_ids‹szBaseResult.set_generated_ids)Ú generated_idrcCs
||_dS)zSets the generated insert id.N©r9)r¿rNr(r(r)Úset_generated_insert_idsz"BaseResult.set_generated_insert_id)ÚtotalrcCs
||_dS)z!Sets the number of rows affected.Nr?)r¿rQr(r(r)Úset_rows_affected“szBaseResult.set_rows_affectedN) rcrdrerrÁr@rArBrErIrMrPrRr(r(r(r)r2Ps
r2csteZdZdZdddddœ‡fdd„ Zd    d
œd d „Zed ƒdd
œdd„ƒZed ƒd    d
œdd„ƒZdd
œdd„Z    ‡Z
S)ÚResultaAllows retrieving information about non query operations performed on
    the database.
 
    Args:
        connection (mysqlx.connection.Connection): The Connection object.
                                                   ids (`list`): A list of IDs.
    NzOptional[ConnectionType]zOptional[List[int]]r¸)r4Úidsrcs*tƒ |¡||_|dk    r&|j |¡dSr‚)ÚsuperrÁÚ_idsr6Z close_result)r¿r4rT©r»r(r)rÁ¡s zResult.__init__r;rÂcCs|jS)zjReturns the last insert id auto generated.
 
        Returns:
            int: The last insert id.
        rOrÌr(r(r)Úget_autoincrement_value¬szResult.get_autoincrement_valuer/rÚcCs&|jdkst|jƒdkrdS|jdS)zdReturns ID of the last document inserted into a collection.
 
        .. deprecated:: 8.0.12
        Nr)rVrrÌr(r(r)Úget_document_id´szResult.get_document_idcCs|jS)zIReturns the generated insert id.
 
        .. deprecated:: 8.0.12
        rOrÌr(r(r)Úget_generated_insert_id¾szResult.get_generated_insert_idrJcCs|jS)zReturns the generated ids.rLrÌr(r(r)Úget_generated_idsÆszResult.get_generated_ids)NN) rcrdrerrÁrXrrYrZr[Ú __classcell__r(r(rWr)rS˜s
ý     rScsÂeZdZdZdddœ‡fdd„ Zddd    œd
d „Zedd œd d„ƒZdd œdd„Zdddœdd„Z    dd œdd„Z
dddœdd„Z dd œdd„Z dd œd d!„Z ddd"œd#d$„Zddd"œd%d&„Z‡ZS)'ÚBufferingResultzãProvides base functionality for buffering result objects.
 
    Args:
        connection (mysqlx.connection.Connection): The Connection object.
                                                   ids (`list`): A list of IDs.
    rr¸r3cs<tƒ |¡g|_d|_d|_g|_d|_d|_| ¡dSr5)    rUrÁÚ_columnsÚ    _has_dataÚ_has_more_resultsÚ_itemsÚ
_page_sizeÚ    _positionÚ _init_resultr>rWr(r)rÁÓs zBufferingResult.__init__r;zUnion[Row, DbDoc]r'cCs
|j|Sr‚)ra)r¿r(r(r(r)r.ÝszBufferingResult.__getitem__rÂcCs
t|jƒS)zint: The total of items.)rrarÌr(r(r)ÚcountàszBufferingResult.countcCsJ|j |¡|_t|jƒdk|_g|_d|_d|_|j |jr@|nd¡dS)zInitialize the result.rrqrN)    r6Zget_column_metadatar^rZ_has_more_datararbrcZset_active_resultrÌr(r(r)rdås zBufferingResult._init_resultrzOptional[Union[Row, DbDoc]]©ÚdumpingrcCsn|j |¡}|dkrdSdgt|dƒ}|sdtt|dƒƒD]$}|j|}t||d|ƒ||<q>t||ƒS)z•Read item.
 
        Args:
            dumping (bool): `True` for dumping.
 
        Returns:
            :class:`mysqlx.Row`: A `Row` object.
        NÚfield)r6Zread_rowrrÅr^r*r )r¿rgÚrowrAr†rr(r(r)Ú
_read_itemîs     
zBufferingResult._read_itemrcCsL|jr
dSd}t|jƒD].}| d¡}|dkr2qH|j |¡|d7}q|S)zSReads the page items.
 
        Returns:
            int: Total items read.
        FrNr )r7rÅrbrjrarI)r¿rerÈrAr(r(r)Ú_page_in_itemss
 
zBufferingResult._page_in_itemsr‰)Úcol_namercCs0d}|jD] }| ¡|kr"|S|d7}q
dS)zeReturns the index of the column.
 
        Returns:
            int: The index of the column.
        rr r)r^r)r¿rlr(Úcolr(r(r)r+s 
 
zBufferingResult.index_ofcCs|jr
dS| d¡S)zuFetch one item.
 
        Returns:
            :class:`mysqlx.Row` or :class:`mysqlx.DbDoc`: one result item.
        NF)r7rjrÌr(r(r)Ú    fetch_one szBufferingResult.fetch_onezList[Union[Row, DbDoc]]cCs| ¡sq q|jS)z–Fetch all items.
 
        Returns:
            `list`: The list of items of :class:`mysqlx.DbDoc` or
                    :class:`mysqlx.Row`.
        )rkrarÌr(r(r)Ú    fetch_all+szBufferingResult.fetch_allrCcCs
||_dS)zdSets if result has data.
 
        Args:
            flag (bool): `True` if result has data.
        N©r_rDr(r(r)Ú set_has_data7szBufferingResult.set_has_datacCs
||_dS)zfSets if has more results.
 
        Args:
            flag (bool): `True` if has more results.
        N)r`rDr(r(r)Úset_has_more_results?sz$BufferingResult.set_has_more_results)rcrdrerrÁr.rÍrerdrjrkr+rnrorqrrr\r(r(rWr)r]Ës
       r]c@s0eZdZdZeddœdd„ƒZddœdd„ZdS)    Ú    RowResultz¡Allows traversing the Row objects returned by a Table.select operation.
 
    Args:
        connection (mysqlx.connection.Connection): The Connection object.
    z List[Column]rÂcCs|jS)z`list`: The list of columns.©r^rÌr(r(r)ÚcolumnsOszRowResult.columnscCs|jS)z‚Returns the list of columns.
 
        Returns:
            `list`: The list of columns.
 
        .. versionadded:: 8.0.12
        rtrÌr(r(r)Ú get_columnsTszRowResult.get_columnsN)rcrdrerrÍrurvr(r(r(r)rsHsrsc@s:eZdZdZddœdd„Zddœdd„Zddœd    d
„Zd S) Ú    SqlResultzƒRepresents a result from a SQL statement.
 
    Args:
        connection (mysqlx.connection.Connection): The Connection object.
    r;rÂcCs|jS)zŒReturns the identifier for the last record inserted.
 
        Returns:
            str: The identifier of the last record inserted.
        rOrÌr(r(r)rXfsz!SqlResult.get_autoincrement_valuercCs|jr
dSd|_| ¡dS)zjProcess the next result.
 
        Returns:
            bool: Returns `True` if the fetch is done.
        FT)r7r`rdrÌr(r(r)Ú next_resultns
zSqlResult.next_resultcCs|jS)z’Returns True if result has data.
 
        Returns:
            bool: Returns `True` if result has data.
 
        .. versionadded:: 8.0.12
        rprÌr(r(r)Úhas_datazszSqlResult.has_dataN)rcrdrerrXrxryr(r(r(r)rw_s rwcs(eZdZdZdddœ‡fdd„ Z‡ZS)Ú    DocResultzªAllows traversing the DbDoc objects returned by a Collection.find
    operation.
 
    Args:
        connection (mysqlx.connection.Connection): The Connection object.
    rrrfcs(tƒ |¡}|dkrdStt|dƒƒS)z™Read item.
 
        Args:
            dumping (bool): `True` for dumping.
 
        Returns:
            :class:`mysqlx.DbDoc`: A `DbDoc` object.
        Nr)rUrjrr)r¿rgrirWr(r)rjs     zDocResult._read_item)rcrdrerrjr\r(r(rWr)rz…srz)9rÚ
__future__rrPr1r#rrÚtypingrrrrr    r
r r ZcharsetsrZdbdocrZhelpersrrÚtypesrrr*r,r3r5rCrGrHrJrTr\r`rarrr·rÏrÒrÓrÔr×rØrÙrr r2rSr]rsrwrzr(r(r(r)Ú<module>sT (  $!d'    j.H3}&