Format: application/x-python-code
⬇ Download File (2.9 KB)
   1  o
   2  
   3  ��h,�@s(dZddlmZdd�Z	d	dd�ZdS)
   4  zka clumsy attempt at a macro language to let the programmer execute code on the server (ex: determine 64bit)�)�is64bitc	Cs�t|ttf�r
   5  |g}|d}z�|dkr5t��r||dfWSz||dfWWSty4|dfYWSw|dkrI||vrHddl}||��fWSn~|dkrnddl}z||d|��fWWStym||��fYWSw|d	kr�ddl	}z|d}Wnty�d}Ynw||j
   6  �|d|�fWS|d
   7  kr�d|vs�|ds�|dfWS|d
   8  |fWS|dkr�ddl	}ddl}||j
   9  �|��d|d�fWStd|����td|�d|����)ayallow the programmer to perform limited processing on the server by passing macro names and args
  10  
  11      :new_key - the key name the macro will create
  12      :args[0] - macro name
  13      :args[1:] - any arguments
  14      :code - the value of the keyword item
  15      :kwargs - the connection keyword dictionary. ??key has been removed
  16      --> the value to put in for kwargs['name'] = value
  17      �rr���getuserN�getnode�getenvZ
  18  auto_security�userzIntegrated Security=SSPIz'User ID=%(user)s; Password=%(password)sZfind_temp_test_pathZ
  19  adodbapi_testzUnknown connect string macro=zError in macro processing � )�
  20  isinstance�strr�Python�
  21  IndexError�getpassr�platform�node�os�environ�get�tempfile�path�join�
  22  gettempdir�
  23  ValueError)	�
  24  macro_name�args�kwargs�new_keyrrrZdfltr�r�Uc:\Users\shubh\Videos\agent\nova\Lib\site-packages\adodbapi/process_connect_string.py�
  25  macro_calls\
  26  �����
  27  �r Fc
  28  Cs�z|d}Wntyd}Ynwt|t�r|�|�n|r#||d<z|d}Wnty4d}Ynwt|t�r?||d<nt|t�rI||d<n
  29  t|t�rS|�|�z|d|d<|d	|d
  30  <|d|d<Wn	typYnwd|vr�z|d
  31  |d<Wnty�z|d
  32  |d<Wnty�td��wYnw|r�t|�	��D]}|�
  33  d�r�|dd�}|�|�}t|||�\}}	|	||<q�|S)z�attempts to inject arguments into a connection string using Python "%" operator for strings
  34  
  35      co: adodbapi connection object
  36      args: positional parameters from the .connect() call
  37      kvargs: keyword arguments from the .connect() call
  38      rNZconnection_stringr�timeoutr	r�password��host�Zdatabase�dsnz3Must define 'connection_string' for ado connectionsZmacro_�)
  39  rr�dict�update�intr�KeyError�	TypeError�list�keys�
  40  startswith�popr )
  41  rrZ
  42  expand_macrosr&Za1�kwargrZ
  43  macro_coderZrsltrrr�processNsf	�
  44  �
  45  
  46  
  47  
  48  
  49  
  50  ����
  51  ���r2N)F)�__doc__rrr r2rrrr�<module>s
  52  I�