Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/psycopg2/__pycache__/ |
Upload File : |
o ��a�9 � @ s� d Z ddlZddlmZ e�� ZG dd� d�ZG dd� de�ZG dd � d e�Z G d d� de�Z G dd � d e�ZG dd� de�Ze d�Z e d�ZdS )zSQL composition utility module � N)� extensionsc @ sH e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z dS )� Composablea6 Abstract base class for objects that can be used to compose an SQL string. `!Composable` objects can be passed directly to `~cursor.execute()`, `~cursor.executemany()`, `~cursor.copy_expert()` in place of the query string. `!Composable` objects can be joined using the ``+`` operator: the result will be a `Composed` instance containing the objects joined. The operator ``*`` is also supported with an integer argument: the result is a `!Composed` instance containing the left argument repeated as many times as requested. c C s || _ d S �N��_wrapped)�self�wrapped� r �./usr/lib/python3/dist-packages/psycopg2/sql.py�__init__1 � zComposable.__init__c C s | j j� d| j�d�S )N�(�))� __class__�__name__r �r r r r �__repr__4 s zComposable.__repr__c C s t �)aj Return the string value of the object. :param context: the context to evaluate the string into. :type context: `connection` or `cursor` The method is automatically invoked by `~cursor.execute()`, `~cursor.executemany()`, `~cursor.copy_expert()` if a `!Composable` is passed instead of the query string. )�NotImplementedError�r �contextr r r � as_string7 s zComposable.as_stringc C s: t |t�rt| g�| S t |t�rt| g�t|g� S tS r )� isinstance�Composedr �NotImplemented�r �otherr r r �__add__D s zComposable.__add__c C s t | g| �S r )r )r �nr r r �__mul__L s zComposable.__mul__c C s t | �t |�u o | j|jkS r )�typer r r r r �__eq__O s zComposable.__eq__c C s | � |� S r )r r r r r �__ne__R s zComposable.__ne__N)r � __module__�__qualname__�__doc__r r r r r r r! r r r r r # s r c sL e Zd ZdZ� fdd�Zedd� �Zdd� Zdd � Zd d� Z dd � Z � ZS )r a A `Composable` object made of a sequence of `!Composable`. The object is usually created using `!Composable` operators and methods. However it is possible to create a `!Composed` directly specifying a sequence of `!Composable` as arguments. Example:: >>> comp = sql.Composed( ... [sql.SQL("insert into "), sql.Identifier("table")]) >>> print(comp.as_string(conn)) insert into "table" `!Composed` objects are iterable (so they can be used in `SQL.join` for instance). c sB g }|D ]}t |t�std|�d���|�|� qt� �|� d S )Nz*Composed elements must be Composable, got z instead)r r � TypeError�append�superr )r �seqr �i�r r r r h s �zComposed.__init__c C � t | j�S )z+The list of the content of the `!Composed`.)�listr r r r r r( r s zComposed.seqc C s* g }| j D ] }|�|�|�� qd�|�S )N� )r r&