
    $
i,                     &    d Z ddlmZ d Z	 ddZdS )zka clumsy attempt at a macro language to let the programmer execute code on the server (ex: determine 64bit)   )is64bitc                 l   t          |t          t          f          r|g}|d         }	 | dk    r<t          j                    r
||d         fS 	 ||d         fS # t          $ r |dfcY S w xY w| dk    r||vrddl}||                                fS n| dk    rJddl}	 ||d         |                                z  fS # t          $ r ||                                fcY S w xY w| d	k    rCddl	}	 |d         }n# t          $ r d}Y nw xY w||j
                            |d         |          fS | d
k    rd|vs|d         s|dfS |d|z  fS | dk    r>ddl	}ddl}||j                            |                                d|d                   fS t!          d|            #  t!          d|  d|          xY w)ay  allow the programmer to perform limited processing on the server by passing macro names and args

    :new_key - the key name the macro will create
    :args[0] - macro name
    :args[1:] - any arguments
    :code - the value of the keyword item
    :kwargs - the connection keyword dictionary. ??key has been removed
    --> the value to put in for kwargs['name'] = value
        r   r       getuserNgetnodegetenvauto_securityuserzIntegrated Security=SSPIz'User ID=%(user)s; Password=%(password)sfind_temp_test_pathadodbapi_testzUnknown connect string macro=zError in macro processing  )
isinstancestrr   Python
IndexErrorgetpassr   platformnodeosenvirongettempfilepathjoin
gettempdir
ValueError)	
macro_nameargskwargsnew_keyr   r   r   dfltr   s	            C:\Users\Dell Inspiron 16\Desktop\tws\AgrotaPowerBi\back-agrota-powerbi\mcp-client-agrota\venv\Lib\site-packages\adodbapi/process_connect_string.py
macro_callr%      s    $c
## 

 1gG6M""~ 'Q'''"DG++! ' ' '"B;&&&' )##f$$ 1 111 %
 9$$OOO0Q(--// 999 0 0 0////0 8##IIIAw   BJNN47D9999?**f$$F6N$ :::ENNN ///IIIOOOBGLL##%%Q    EEEFFFMKjKK4KKLLLs   "F 	A A(%F 'A((&F F B: : CF CF +C4 3F 4D F D%F )F ?F AF 
F F3Fc                 |   	 | d         }n# t           $ r d}Y nw xY wt          |t                    r|                    |           n|r||d<   	 | d         }n# t           $ r d}Y nw xY wt          |t                    r||d<   nEt          |t
                    r||d<   n*t          |t                    r|                    |           	 | d         |d<   | d	         |d
<   | d         |d<   n# t           $ r Y nw xY wd|vrG	 |d         |d<   n:# t          $ r- 	 |d
         |d<   n# t          $ r t          d          w xY wY nw xY w|rqt          |	                                          D ]O}|
                    d          r8|dd         }|                    |          }t          |||          \  }}	|	||<   P|S )zattempts to inject arguments into a connection string using Python "%" operator for strings

    co: adodbapi connection object
    args: positional parameters from the .connect() call
    kvargs: keyword arguments from the .connect() call
    r   Nconnection_stringr   timeoutr   r   password   host   databasedsnz3Must define 'connection_string' for ado connectionsmacro_   )r   r   dictupdateintr   KeyError	TypeErrorlistkeys
startswithpopr%   )
r    r!   expand_macrosr.   a1kwargr   
macro_coder"   rslts
             r$   processr?   N   sz   1g    #t *c	 *&)"#!W    "c y	B		 v	B		 b!!Wzav!!Wz    &((	W*0-F&'' 	W 	W 	WW.4Vn*++ W W W UVVVW ,+	W
  
'&++--(( 		' 		'E)) '"122Y
#ZZ 
 !+
F! ! #'wMsZ    A A('A(!C. .
C;:C;D 
ED&%E&E  EEN)F)__doc__r   r   r%   r?        r$   <module>rC      sV    q q      EM EM EMR !&; ; ; ; ; ;rB   