a „oe˜Âã@s²dZdZdeZddlZddlZddlZddlZddlZddlm Z m Z m Z zeejdƒZWndZYn0er|eeƒdZe jrÈdd lmZdd lmZmZmZmZmZmZmZd d „Zd d„Z nZz(ddl!Z!ddl"Z"ddl#Z$dZdd „ZWn(e%�yddl&Z&e& 'de(¡Yn0dd„Z ddl)m*Z*e+Z,eZ-e+Z.ej/Z0dd„Z1dd„Z2e j3Z4e j5Z6e  7¡Z8d"dd„Z9dd„Z:Gdd„de;ƒZd k�r®e  ?ed!¡‚dS)#aadodbapi - A python DB API 2.0 (PEP 249) interface to Microsoft ADO Copyright (C) 2002 Henrik Ekelund, versions 2.1 and later by Vernon Cole * http://sourceforge.net/projects/pywin32 * https://github.com/mhammond/pywin32 * http://sourceforge.net/projects/adodbapi This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA django adaptations and refactoring by Adam Vandenberg DB-API 2.0 specification: http://www.python.org/dev/peps/pep-0249/ This module source should run correctly in CPython versions 2.7 and later, or IronPython version 2.7 and later, or, after running through 2to3.py, CPython 3.4 or later. z2.6.2.0z adodbapi véNé)Ú ado_constsÚapibaseÚprocess_connect_stringZADODBAPI_VERBOSEF)Ú Reference)Ú ActivatorÚArrayÚByteÚDateTimeÚDBNullÚDecimalÚTypecCst |¡}t |¡S©N)r ZGetTypeFromProgIDrZCreateInstance)ÚdispatchÚtype©rú2C:\Program Files\Certbot\pkgs\adodbapi\adodbapi.pyÚDispatch?s rcCs |j|Sr)ZItem©ÚobjÚindexrrrÚgetIndexedValueCsrTcCs tj |¡Sr)Úwin32comZclientr)rrrrrNsz6pywin32 package (or IronPython) required for adodbapi.cCs||ƒSrrrrrrrXs)ÚMappingcCs4ztrt ¡tdƒ}Wnt d¡‚Yn0|S)NzADODB.Connectionz7Windows COM Error: Dispatch('ADODB.Connection') failed.)ÚonWin32Ú pythoncomZ CoInitializerÚapiÚInterfaceError)ÚcrrrÚmake_COM_connecterfs ÿ rc Osdtƒ}t ||d¡}z| |¡|WSty^}z"d|j}t ||¡‚WYd}~n d}~00dS)a,Connect to a database. call using: :connection_string -- An ADODB formatted connection string, see: * http://www.connectionstrings.com * http://www.asp101.com/articles/john/connstring/default.asp :timeout -- A command timeout value, in seconds (default 30 seconds) Tz Error opening connection to "%s"N)Ú ConnectionrZprocessÚconnectÚ ExceptionÚconnection_stringrÚOperationalError)ÚargsÚkwargsÚcoÚeÚmessagerrrr!rs   r!cCsJz6|rdd„|Dƒ}ndd„|Dƒ}dd |¡dWSYdS0dS) zeFormat a collection of ADO Command Parameters. Used by error reporting in _execute_command. c SsJg|]B}d|jtj|jtj |jt|jƒd¡|j|j |j |j f‘qS)zTName: %s, Dir.: %s, Type: %s, Size: %s, Value: "%s", Precision: %s, NumericScale: %sú (unknown type)) ÚNameÚadcÚ directionsÚ DirectionÚ adTypeNamesÚgetr ÚstrÚSizeÚValueÚ PrecisionÚ NumericScale©Ú.0ÚprrrÚ £s ö ùÿz%format_parameters..c SsFg|]>}d|jtj|jtj |jt|jƒd¡|j|j |j f‘qS)zGName: %s, Dir.: %s, Type: %s, Size: %s, Precision: %s, NumericScale: %sr*) r+r,r-r.r/r0r r1r2r4r5r6rrrr9±s ÷ úÿú[Ú ú]z[]N)Újoin)Z ADOparametersZ show_valueÚdescrrrÚformat_parametersœs õ ö r?cCs®|tjvr"t|ƒ|_| |¡�nˆt|tƒrvt|ƒ}|tjvr^|rNt||jƒ}|d|…|_ n||_ |dkrr||_�n4t|t j ƒ�rtj r¤t |ƒ}||_ t|ƒ|_n||_ | ¡d}t| ¡dƒ}||_|dkrÜd|_n:|dk�r| |_|j|jk�r|j|_nd|_|||_n’t|ƒtjv�rd|�rH|tjv�rHt |¡|_ nt |¡}||_ t|ƒ|_nFtj �rˆt|tƒ�rˆt |ƒ}||_ n"|tjk�r¤tj|_d|_ n||_ dS)z>Configure the given ADO Parameter 'p' with the Python 'value'.Nrér)rZadoBinaryTypesÚlenr2Z AppendChunkÚ isinstanceÚ StringTypesZadoStringTypesÚminr3Údecimalr Ú onIronPythonr1Zas_tupler4r5rÚ dateconverterÚtypesZadoDateTimeTypesZCOMDateZDateObjectToIsoFormatStringÚlongTyper,ZadEmptyÚ adIntegerr )r8ÚvalueÚadotypeZsettings_knownÚLÚsZexponentZ digit_countrrrÚ_configure_parameterÂsV              ÿrOc@sôeZdZejZejZejZejZejZej Z ej Z ej Z ej Z ej Z ejZejZedd„ƒZdd„Zefdd„Zdd„Zd d „Zd d „Zd d„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Z dd „Z!d!d"„Z"d#d$„Z#d%d&„Z$d'S)(r cCstS)z;Return a reference to the DBAPI module for this Connection.)r©ÚselfrrrÚdbapiszConnection.dbapicCsFd|_tj|_d|_d|_t ¡|_d|_d|_ d|_ d|_ d|_ dS)NFÚr) Ú connectorrÚ paramstyleÚsupportsTransactionsr#ÚweakrefÚWeakValueDictionaryÚcursorsÚ dbms_nameÚ dbms_versionÚ errorhandlerÚtransaction_levelÚ _autocommitrPrrrÚ__init__s zConnection.__init__c Csätdkrtdt|ƒƒz|d||_Wn0tyX}z| td¡WYd}~n d}~00| dd¡|_| dt j ¡|_ ||_ tr”tdt |jfƒ|ƒ|_|j|j_|j|j_|j |j_z|j ¡Wn(tjyð| tjd |j¡Yn0z t|jjd ƒjd k�rd |_Wntj�y(Yn0t|jjd ƒj|_zt|jjdƒj|_Wntj�yhYn0t|j_|j�rªt |j_!t"| dd¡ƒ|_#|j#�s°|j $¡|_%nd |_#d|v�rÄ|d|_&g|_'t�ràtdt(|ƒƒdS)Né zkwargs=r#z1Python string format error in connection string->ÚtimeoutéÚmodez%s attempting: "%s"zADO error trying to Open=%szTransaction DDLrTz DBMS Namez DBMS VersionÚ autocommitFrUzadodbapi New connection at %X))ÚverboseÚprintÚreprr#r"Ú_raiseConnectionErrorÚKeyErrorr0rar,Z adModeUnknownrcr&ÚversionrTZConnectionTimeoutZConnectionStringZModeZOpenrÚErrorÚ DatabaseErrorrZ Propertiesr3rVÚ pywintypesÚ com_errorrZr[ÚdefaultCursorLocationZCursorLocationÚdefaultIsolationLevelZIsolationLevelÚboolr^Ú BeginTransr]rUÚmessagesÚid)rQr&Zconnection_makerr(rrrr!"sd ÿÿ   þ  ÿ ÿ  zConnection.connectcCs&|j}|durtj}||d||ƒdSr)r\rÚstandardErrorHandler©rQZ errorclassZ errorvalueZehrrrrh[sz Connection._raiseConnectionErrorcCsX|jdurdS|js6|jr6z|j ¡Wn Yn0|j ¡trTtdt|ƒƒdS)zfclose the underlying ADO Connection object, rolling it back first if it supports transactions.Nz adodbapi Closed connection at %X)rTr^r]Ú RollbackTransÚClosererfrtrPrrrÚ_closeAdoConnectionas  zConnection._closeAdoConnectionc Cs†t|j ¡ƒdd…D]}|jdd�qg|_z | ¡Wn@tyz}z(| t  ¡dt  ¡d¡WYd}~n d}~00d|_ dS)aEClose the connection now (rather than whenever __del__ is called). The connection will be unusable from this point forward; an Error (or subclass) exception will be raised if any operation is attempted with the connection. The same applies to all cursor objects trying to use the connection. NT)Ú dont_tell_merr) ÚlistrYÚvaluesÚclosersryr"rhÚsysÚexc_inforT)rQÚcrsrr(rrrr}ps ÿ 2zConnection.closec Cs�g|_|jsdSzH|j ¡|_tdkr6tdt|ƒƒ|jsV|jj t j @sV|j  ¡|_Wn2t yŠ}z| tj|¡WYd}~n d}~00dS)aHCommit any pending transaction to the database. Note that if the database supports an auto-commit feature, this must be initially off. An interface method may be provided to turn it back on. Database modules that do not support transactions should implement this method with void functionality. Nrzcommit done on connection at %X)rsrVrTZ CommitTransr]rerfrtr^Ú Attributesr,ÚadXactAbortRetainingrrr"rhrÚProgrammingError©rQr(rrrÚcommit…s ÿ þzConnection.commitc Cs’g|_|jrŽzN|j ¡|_tdkr2tdt|ƒƒ|jsX|jjt j @sX|jsX|j  ¡|_Wn2t yŒ}z|  tj|¡WYd}~n d}~00dS)aÈIn case a database does provide transactions this method causes the the database to roll back to the start of any pending transaction. Closing a connection without committing the changes first will cause an implicit rollback to be performed. If the database does not support the functionality required by the method, the interface should throw an exception in case the method is used. The preferred approach is to not implement the method and thus have Python generate an AttributeError in case the method is requested. This allows the programmer to check for database capabilities using the standard hasattr() function. For some dynamically configured interfaces it may not be appropriate to require dynamically making the method available. These interfaces should then raise a NotSupportedError to indicate the non-ability to perform the roll back when the method is invoked. rz!rollback done on connection at %XN)rsr]rTrwrerfrtr^r�r,r‚rrr"rhrrƒr„rrrÚ _rollbackŸsÿ  ÿÿzConnection._rollbackcCs’|dkr>|jr:t |dt|ƒ¡z | ¡Wn Yn0dS|dkrn|tjvr€| tjd|t tjƒf¡n|dkr€t   |¡}t |||¡dS)Nrdr^rUzparamstyle="%s" not in:%sÚvariantConversions) rVÚobjectÚ __setattr__rqr†rZaccepted_paramstylesrhÚNotSupportedErrorrgÚcopy)rQÚnamerKrrrr‰Ãs*   ÿþÿzConnection.__setattr__cCs<|dkr|jr|jStdƒ‚n|dkr,|jStd|ƒ‚dS)NZrollbackz,this data provider does not support Rollbackrdz2no such attribute in ADO connection object as="%s")rVr†ÚAttributeErrorr^©rQÚitemrrrÚ __getattr__Ùsÿÿ ÿzConnection.__getattr__cCsg|_t|ƒ}|S)z0Return a new Cursor Object using the connection.)rsÚCursor)rQrrrrÚcursorêszConnection.cursorcCst|ƒ}||j|<dS)z3message from a new cursor proclaiming its existenceN)rtrY)rQr€ZoidrrrÚ _i_am_hereðszConnection._i_am_herecCs"z|jt|ƒ=Wn Yn0dS)z|jjD]*}t|jƒ}| d¡s2|dkrtjSqtjS)a\Introspect the current ADO Errors and determine an appropriate error class. Error.SQLState is a SQL-defined error condition, per the SQL specification: http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt The 23000 class of errors are integrity errors. Error 40002 is a transactional integrity error. NZ23Z40002)rTr–r1r™Ú startswithrÚIntegrityErrorrl)rQr(ÚstaterrrÚ_suggest_error_class s    zConnection._suggest_error_classcCs$z | ¡Wn Yn0d|_dSr)ryrTrPrrrÚ__del__s  zConnection.__del__cCs|SrrrPrrrÚ __enter__"szConnection.__enter__cCs|r| ¡n| ¡dSr)r†r…©rQÚexc_typeZexc_valZexc_tbrrrÚ__exit__%s zConnection.__exit__cCs>|j d¡}g}|js8t|jdƒj}| |¡| ¡q~|S)NéZ TABLE_NAME)rTZ OpenSchemaÚEOFrÚFieldsr3ÚappendZMoveNext)rQZschemaZtablesrŒrrrÚget_table_names+s   zConnection.get_table_namesN)%Ú__name__Ú __module__Ú __qualname__rÚWarningrkrÚ DataErrorrlr$r�Ú InternalErrorrŠrƒÚFetchFailedErrorreÚpropertyrRr_rr!rhryr}r…r†r‰r�r’r“r”r›rŸr r¡r¤r©rrrrr s@  9$r c@s&eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dd„ZdBdd„Zdd„Zejfdd„Zd d!„Zd"d#„Zd$d%„ZdCd'd(„Zd)d*„ZdDd+d,„ZdEd-d.„Zd/d0„ZdFd1d2„Zd3d4„ZdGd5d6„Zd7d8„Zd9d:„Z d;d<„Z!dHd=d>„Z"d?d@„Z#e$e#d&d&dAƒZ%d&S)Ir‘cCsŒd|_d|_g|_||_|j|_g|_d|_d|_g|_i|_ d|_ d|_ d|_ |j |_ d|_| |¡trˆtdtt|ƒt|jƒfƒdS)NFréÿÿÿÿrz%s New cursor at %X on conn %X)ÚcommandÚ _ado_preparedrsÚ connectionrUÚ_parameter_namesZrecordset_is_remoteÚrsÚ convertersÚ columnNamesÚnumberOfColumnsÚ _descriptionÚrowcountr\Ú arraysizer“rerfrjrt)rQrµrrrr_Rs, ÿÿzCursor.__init__cCs t|jdƒSr)ÚiterÚfetchonerPrrrÚ__iter__iszCursor.__iter__cCs||_d|_d|_dS)NÚsetup)r³r»r´)rQÚ operationrrrÚpreparelszCursor.preparecCs| ¡}|r|St‚dSr)r¿Ú StopIteration)rQÚrrrrÚ__next__qszCursor.__next__cCs|S)ú8Allow database cursors to be used with context managers.rrPrrrr¡wszCursor.__enter__cCs | ¡dS)rÇN©r}r¢rrrr¤{szCursor.__exit__cCs(|j}|durtj}||j|||ƒdSr)r\rrurµrvrrrÚ_raiseCursorErrorszCursor._raiseCursorErrorc Csðg|_i|_d|_|dus&|jtjkr6d|_d|_dS||_tj rHtj ntj |_ |j j|_z |jj}Wnty~tj}Yn0t|jƒD]`}t|jj |ƒ}z|j ||j¡Wn&tyØ| tjd|j¡Yn0||j|j ¡<qŠdS)Nrz"Data column of Unknown ADO type=%s)r¸r¹r»ÚStater,Ú adStateClosedr·rºrrFÚRS_ARRAYZ RS_WIN_32Úrecordset_formatr§r—rµr‡r�Úrangerr¨r rirÉr¯r+Úlower)rQÚ recordsetZvarConÚiÚfrrrÚbuild_column_info…s2    ÿ  ÿ zCursor.build_column_infoc CsŽ|jdurd|_dSg}t|jƒD]`}t|jj|ƒ}|jjsD|jjrJd}n|j}t |j t j @ƒ}|  |j|j||j|j|j|f¡q"||_dSr)r·r»rÎrºrr§r¦ÚBOFZ ActualSizerqr�r,ZadFldMayBeNullr¨r+r Z DefinedSizer4r5)rQr>rÑrÒZ display_sizeZnull_okrrrÚ_makeDescriptionFromRS¢s, ÿùÿ zCursor._makeDescriptionFromRScCs|js| ¡|jSr)r»rÕrPrrrÚget_description¾szCursor.get_descriptioncCs |dkr| ¡St ||¡dS)NÚ description)rÖrˆÚ__getattribute__rŽrrrr�Ãs ÿzCursor.__getattr__c Csr|jdur| ¡t|tƒr&|j|}d|dtj |dt|dƒd¡|d|d|d|d |d f}|S) z-Format db_api description tuple for printing.NzQName= %s, Type= %s, DispSize= %s, IntSize= %s, Precision= %s, Scale= %s NullOK=%srrr*r@éééé)r×rÕrBÚintr,r/r0r1)rQÚdr>rrrÚformat_descriptionÊs    ùÿÿ zCursor.format_descriptionFcCsf|jdurdSg|_|jr8|jjtjkr8|j ¡d|_|sH|j |¡d|_trbt dt |ƒƒdS)zëClose the cursor now (rather than whenever __del__ is called). The cursor will be unusable from this point forward; an Error (or subclass) exception will be raised if any operation is attempted with the cursor. Nzadodbapi Closed cursor at %X) rµrsr·rÊr,rËrxr”rerfrt)rQrzrrrr}Þs" ÿ ÿ ÿÿz Cursor.closecCsz | ¡Wn Yn0dSrrÈrPrrrr õs zCursor.__del__c Cs˜d|_g|_|jdur(| tjd¡dSzFtdƒ|_|jj|j_|jj |j_ ||j_ |j |j_ t|jƒ|j_Wn$| tjdt|j ƒ¡Yn0dS)Nz ADODB.Commandz0Error creating new ADODB.Command object for "%s")ÚcmdrsrµrÉrrrrTZActiveConnectionraZCommandTimeoutZ CommandTypeÚ commandTextZ CommandTextrqr´ZPreparedrlrg)rQÚ command_typerrrÚ _new_commandûs&     ÿþzCursor._new_commandc Csüd|_d}d}tr td|jƒz6tjrFttƒ}|j  |¡}|j }n|j  ¡\}}Wnvt yÌ}z^d}t |dƒr†|t |jƒd7}|d|jt|jjdƒf7}|j ¡}| ||¡WYd}~n d}~00z |j|_Wn||_Yn0| |¡dS)Nr²zExecuting command="%s"rSr%r;zCommand: %s Parameters: %sT)Ú return_valuererfrárrFrrÝràZExecuter3r"Úhasattrr1r%r?Ú ParametersrµrŸrÉZ RecordCountr¼rÓ)rQrÐÚcountZrar(Ú_messageÚklassrrrÚ_execute_commands4    þ "  zCursor._execute_commandcCs|jSr)r¼rPrrrÚ get_rowcount7szCursor.get_rowcountc Csžg}t|jjƒD]ˆ}tdkr^td|jtj|jtj   |j t |j ƒd¡|j |j|j|jfƒt |jtj|j ¡}|jtjkrŽ||_||_q| |¡q|S)awith some providers, returned parameters and the .return_value are not available until after the last recordset has been read. In that case, you must coll nextset() until it returns None, then call this method to get your returned information.r@z]Returned=Name: %s, Dir.: %s, Type: %s, Size: %s, Value: "%s", Precision: %s, NumericScale: %sr*)Útupleràrærerfr+r,r-r.r/r0r r1r2r3r4r5rZconvert_to_pythonr‡ÚadParamReturnValueZ returnValuerär¨)rQZretLstr8ZpyObjectrrrÚget_returned_parameters:s.ÿ ùþÿ  ÿ zCursor.get_returned_parametersNcCsTg|_||_|jtjd�|j|dd�tdkrDtdt|j j dƒƒ|  ¡|  ¡S)atCall a stored database procedure with the given name. The sequence of parameters must contain one entry for each argument that the sproc expects. The result of the call is returned as modified copy of the input sequence. Input parameters are left untouched, output and input/output parameters replaced with possibly new values. The sproc may also provide a result set as output, which is available through the standard .fetch*() methods. Extension: A "return_value" property may be set on the cursor if the sproc defines an integer return value. )râT)Úsprocr@z Calling Stored Proc with Params=) r¶rárãr,ZadCmdStoredProcÚ_buildADOparameterListrerfr?ràrærêrî)rQZprocnameÚ parametersrrrÚcallproc[s  þzCursor.callproccCsN|jdvrt |¡\}|_n.|jdks:|jdkrJt|tƒrJt |¡\}|_|S)N)ÚformatZpyformatZnamedZdynamic)rUrZchangeFormatToQmarkr¶rBrZchangeNamedToQmark©rQrÂrñrrrÚ_reformat_operationts  ÿÿÿ zCursor._reformat_operationc Csè||_|durg}d}|r¨z>|jj ¡tdkrRtdt|jjdƒƒtdt|ƒƒd}Wn tj yxtrttdƒYn00t |ƒ|jjj dkr¨t  d|jjj d¡‚|s¶|gk�räd }|�r.|j �rlt|j ƒD]–\}}t|jj|ƒ}zt||||j|ƒWqÒt�yf}zLd |jt |j¡|jt||ƒf}| tj|d t|jƒ¡WYd}~qÒd}~00qÒn¾|D]¸} t|jj|ƒ}|jtjk�r¦|d7}t|jj|ƒ}zt|| |j|ƒWnbt�y}zHd |jt |j¡|jt| ƒf}| tj|d t|jƒ¡WYd}~n d}~00|d7}�qp�n¶|j �rî|j D]®} || } t | ¡} |j | | tj¡}t|| | |ƒz|jj |¡Wnbt�yæ}zHd |jt |j¡|jt| ƒf}| tj|d t|jƒ¡WYd}~n d}~00�qz*Error Building Parameter %s: %s, %s <- %s z @RETURN_VALUEzp%irÁ)"rñràræZRefreshrerfr?rgrrkrAr—rƒr¶Ú enumeraterrOr r"r+r,Z ado_type_namer3rÉr®r%r.ríZpyTypeToADOTypeZCreateParameterZ adParamInputZAppendrJr´)rQrñrïZparameters_knownrÑZpm_namer8r(rèrKZ parm_nameÚelemrLrŒrrrrðsè  þ ÿÿÿ  üÿÿ ÿ ÿ üÿÿ ÿÿ  ÿ üÿ  ÿ ÿ üÿ  ÿzCursor._buildADOparameterListcCs”|j|us|jdkst|dƒsZ|j|ur4d|_||_g|_|jdksH|sL|n | ||¡|_| ¡| |¡t dkrˆt dt |j j dƒƒ| ¡dS) añPrepare and execute a database operation (query or command). Parameters may be provided as sequence or mapping and will be bound to variables in the operation. Variables are specified in a database-specific notation (see the module's paramstyle attribute for details). [5] A reference to the operation will be retained by the cursor. If the same operation object is passed in again, then the cursor can optimize its behavior. This is most effective for algorithms where the same operation is used, but different parameters are bound to it (many times). For maximum efficiency when reusing an operation, it is best to use the setinputsizes() method to specify the parameter types and sizes ahead of time. It is legal for a parameter to not match the predefined information; the implementation should compensate, possibly with a loss of efficiency. The parameters may also be specified as list of tuples to e.g. insert multiple rows in a single operation, but this kind of usage is depreciated: executemany() should be used instead. Return value is not defined. [5] The module will use the __getitem__ method of the parameters object to map either positions (integers) or names (strings) to parameter values. This allows for both sequences and mappings to be used as input. The term "bound" refers to the process of binding an input value to a database execution buffer. In practical terms, this means that the input value is directly used as a value in the operation. The client should not be required to "escape" the value so that it can be used -- the value should be equal to the actual database value.rÁráFZqmarkrÙzParams=TN)r³r´rår¶rUrõrárãrðrerfr?ràrærêrôrrrÚexecutes*ÿþý ÿÿ ý zCursor.executecCsXtƒ|_d}| |¡|D]2}| |j|¡|jdkr:d}|dkr||j7}q||_dS)zÕPrepare a database operation (query or command) and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters. Return values are not defined. rr²N)r{rsrÃrør³r¼)rQrÂZseq_of_parametersZtotal_recordcountÚparamsrrrÚ executemany0s   zCursor.executemanycCs |jdus|jdur&| tjd¡dS|jjtjksD|jjsD|jj rJt ƒS|r\|j  |¡}n |j  ¡}|j tj kr‚t|ƒ|j}n t|dƒ}t |||¡}|S)zFetch rows from the current recordset. limit -- Number of rows to fetch, or None (default) to fetch all rows. Nz/fetch() on closed connection or empty query setr)rµr·rÉrr°rÊr,rËrÔr¦r{ZGetRowsrÍrÌrArºZSQLrows)rQÚlimitZ ado_resultsÚlengthZ fetchObjectrrrÚ_fetchBs&ÿ  ÿ ÿ ÿz Cursor._fetchcCs g|_| d¡}|r|dSdS)aFetch the next row of a query result set, returning a single sequence, or None when no more data is available. An Error (or subclass) exception is raised if the previous call to executeXXX() did not produce any result set or no call was issued yet. rrN©rsrý)rQÚresultrrrr¿`s  zCursor.fetchonecCsg|_|dur|j}| |¡S)aÝFetch the next set of rows of a query result, returning a list of tuples. An empty sequence is returned when no more rows are available. The number of rows to fetch per call is specified by the parameter. If it is not given, the cursor's arraysize determines the number of rows to be fetched. The method should try to fetch as many rows as indicated by the size parameter. If this is not possible due to the specified number of rows not being available, fewer rows may be returned. An Error (or subclass) exception is raised if the previous call to executeXXX() did not produce any result set or no call was issued yet. Note there are performance considerations involved with the size parameter. For optimal performance, it is usually best to use the arraysize attribute. If the size parameter is used, then it is best for it to retain the same value from one fetchmany() call to the next. N)rsr½rý)rQÚsizerrrÚ fetchmanymszCursor.fetchmanycCsg|_| ¡S)a}Fetch all (remaining) rows of a query result, returning them as a sequence of sequences (e.g. a list of tuples). Note that the cursor's arraysize attribute can affect the performance of this operation. An Error (or subclass) exception is raised if the previous call to executeXXX() did not produce any result set or no call was issued yet. rþrPrrrÚfetchallƒszCursor.fetchallc Csög|_|jdus|jdur,| tjd¡dStjrŽz|j ¡}WqÜtyVd}YqÜtj yŠ}z| tj |j ¡WYd}~qÜd}~00nNz|j ¡}Wn6t j yÒ}z| tj |j ¡WYd}~n d}~00|d}|durèdS| |¡dS)aÀSkip to the next available recordset, discarding any remaining rows from the current recordset. If there are no more sets, the method returns None. Otherwise, it returns a true value and subsequent calls to the fetch methods will return rows from the next result set. An Error (or subclass) exception is raised if the previous call to executeXXX() did not produce any result set or no call was issued yet. Nz1nextset() on closed connection or empty query setrT)rsrµr·rÉrr$rFZ NextRecordsetÚ TypeErrorrkrŠr%rmrnrÓ)rQrÐÚexcZrsTuplerrrÚnextsetŽs2 þ (ÿ zCursor.nextsetcCsdSrr)rQZsizesrrrÚ setinputsizes³szCursor.setinputsizescCsdSrr)rQrÚcolumnrrrÚ setoutputsize¶szCursor.setoutputsizecCs@z*|jdkr|j}nd|jt|jƒf}Wnd}Yn0|S)Nz%s,parameters=%s)rñrárg)rQÚretrrrÚ _last_query¹s  zCursor._last_queryzreturns the last query executed)F)N)F)N)N)N)N)&rªr«r¬r_rÀrÃrÆr¡r¤rÉrÓrÕrÖr�rßr}r r,Z adCmdTextrãrêrërîròrõrðrørúrýr¿rrrrrr r±Úqueryrrrrr‘8sB '!   0   %  r‘Ú__main__z! cannot be run as a main program.)F)@Ú__doc__Ú __version__rjr‹rEÚosr~rWrSrr,rrrrÝÚenvironrerfrrFZclrrZSystemrrr r r r Z SystemDecimalr rrrrmZwin32com.clientrÚ ImportErrorÚwarningsÚwarnÚ ImportWarningÚcollections.abcrr1Z unicodeTyperIrCÚmaxsizeZmaxintrr!ZadXactReadCommittedrpZ adUseClientroZpythonDateTimeConverterrGr?rOrˆr r‘rªrƒrrrrÚsn  $   ÿ    &?9