OwlCyberSecurity - MANAGER
Edit File: creation.cpython-39.pyc
a ���ebQ � @ s\ d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl m Z dZG dd � d e�ZdS ) � N)�settings)� DatabaseError)�BaseDatabaseCreation)�get_random_string)�cached_propertyZtest_c @ s e Zd Zedd� �ZdDdd�Zdd� Zd d � Zdd� ZdEd d�Z dFdd�Z dGdd�Zdd� Zdd� Z dHdd�Zdd� Zdd� ZdIdd�Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� Zd.d/� Zd0d1� Zd2d3� Zd4d5� Zd6d7� Zd8d9� Zd:d;� Zd<d=� Z d>d?� Z!d@dA� Z"dBdC� Z#dS )J�DatabaseCreationc C s^ t j| jj }|�d�p|d }|�d�p0|d }i |�||d��}t| j�}||| jjd�S )a> This is analogous to other backends' `_nodb_connection` property, which allows access to an "administrative" connection which can be used to manage the test databases. For Oracle, the only connection that can be used for that purpose is the main (non-test) connection. � SAVED_USER�USER�SAVED_PASSWORD�PASSWORD)r r )�alias)r � DATABASES� connectionr �get�type)�self� settings_dict�user�passwordZDatabaseWrapper� r �c/home/gouroczh/virtualenv/pat/3.9/lib/python3.9/site-packages/django/db/backends/oracle/creation.py�_maindb_connection s z#DatabaseCreation._maindb_connection� Fc C s^ | � � }| j�� ��}| �� �r�z| �||||� W �n� t�y� } �z�dt|�vrn| �d| � t� d� |s�t d|d �}|s�|dk�r�|dkr�| �d| jj � z| � |||� W n� t�y } zBd t|�v r�| �||||� n| �d | � t� d� W Y d }~nFd }~0 t�yT } z$| �d | � t� d� W Y d }~n d }~0 0 z| �||||� W n> t�y� } z$| �d| � t� d� W Y d }~n d }~0 0 n| �d� t� d� W Y d }~n d }~0 0 | �� �r|dk�r�| �d � z| �||||� W �n t�y } z�dt|�v�rB| �d| � t� d� |�sXt d|d �}|�sh|dk�r�zJ|dk�r~| �d� | �|||� |dk�r�| �d � | �||||� W n> t�y� } z$| �d| � t� d� W Y d }~n d }~0 0 n| �d� t� d� W Y d }~n d }~0 0 W d � n1 �s40 Y | j�� | �|� | jjd S )N� ORA-01543z+Got an error creating the test database: %s� z^It appears the test database, %s, already exists. Type 'yes' to delete it, or 'no' to cancel: r �yesr �.Destroying old test database for alias '%s'...z ORA-29857z1Got an error destroying the old test database: %sz-Got an error recreating the test database: %szTests cancelled.zCreating test user...� ORA-01920z'Got an error creating the test user: %szZIt appears the test user, %s, already exists. Type 'yes' to delete it, or 'no' to cancel: �Destroying old test user...z)Got an error recreating the test user: %s�NAME)�_get_test_db_paramsr �cursor�_test_database_create�_execute_test_db_creation� Exception�str�log�sys�exit�inputr r �_execute_test_db_destructionr �)_handle_objects_preventing_db_destruction�_test_user_create�_create_test_user�_destroy_test_user�close�_switch_to_test_userr )r � verbosity�autoclobber�keepdb� parametersr! �e�confirmr r r �_create_test_db s� � ��������� ��" �� �" @ z DatabaseCreation._create_test_dbc C s� t j| jj }| jjd |d<