https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /lib64/python2.7/site-packages/django/db/backends/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib64/python2.7/site-packages/django/db/backends/creation.pyc
�
r�\c@s�ddlZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
dZd	efd
��YZdS(i����N(tsettings(tload_backend(tforce_bytes(tinputi(t
truncate_namettest_tBaseDatabaseCreationcBs�eZdZiZd�Zd�Ze�d�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zded�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�ZRS(s
    This class encapsulates all backend-specific differences that pertain to
    database *creation*, such as the column types to use for particular Django
    Fields, the SQL used to create and destroy tables, and the creation and
    destruction of test databases.
    cCs
||_dS(N(t
connection(tselfR((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyt__init__scGs>tj�}x!|D]}|jt|��qW|j�d S(sx
        Generates a 32-bit digest of a set of arguments that can be used to
        shorten identifying names.
        i(thashlibtmd5tupdateRt	hexdigest(Rtargsthtarg((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyt_digests
c
Cs�|j}|js%|js%|jr/gifSg}g}i}|jjj}x�|jD]�}	|	jd|j�}
|	j	p�|j	}|
dkr�qZn|j||	j��|j
|
�g}|	j}
|	jr�|	jr�|jjjr�t}
n|
s|j|jd��n|	jr5|j|jd��n"|	jrW|j|jd��n|r�|	jr�|jjj|dt�}|r�|j|�q�n|	jr|	jr|j||	||�\}}|r�|j|	jjg�j||	f�q|j|�n|jdj|��qZWxf|jD][}|j|jd�ddjg|D]'}	|j||j |	�j��^qT��q,W|jd	�d|j!||j"��d
g}xMt#|�D]?\}}|jd||t$|�dkr�d
ndf�q�W|jd�|j	rR|jjj|j	�}|rR|j|�qRn|jd�|jdj|��|j%r�|j&j'p�|j&j(}|jjj)|j"|�}|r�x|D]}|j|�q�Wq�n||fS(s�
        Returns the SQL required to create a single model, as a tuple of:
            (list_of_sql, pending_references_dict)
        RsNOT NULLsPRIMARY KEYtUNIQUEtinlinet s (%s)s, sCREATE TABLEs (s    %s%sit,tt)t;s
N(*t_metatmanagedtproxytswappedRtopst
quote_nametlocal_fieldstdb_typet
db_tablespacetNonet	SQL_FIELDtcolumntSQL_COLTYPEtnulltempty_strings_allowedtprimary_keytfeaturest!interprets_empty_strings_as_nullstTruetappendtSQL_KEYWORDtuniquettablespace_sqltrelt
db_constraintt%sql_for_inline_foreign_key_referencest
setdefaultttotextendtjointunique_togethert	get_fieldt	SQL_TABLEtdb_tablet	enumeratetlenthas_auto_fieldt
auto_fieldt	db_columntnametautoinc_sql(Rtmodeltstyletknown_modelstoptstfinal_outputttable_outputtpending_referencestqntftcol_typet
tablespacetfield_outputR&R/t
ref_outputtpendingtfield_constraintstfull_statementtitlinetauto_columnRAtstmt((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pytsql_create_model(s|	
				;01
	
		
c	Cs�|jjj}|jj}||ks3||kr�|jd�d|j||jj��d|j	||jj
|jj�j��d|jjj
�g}t}ng}t}||fS(sX
        Return the SQL snippet defining the foreign key reference for a field.
        t
REFERENCESRs (R(RRRR0R4R-R9RR:R#R8t
field_nameR$tdeferrable_sqltFalseR+(	RRBtfieldRDRCRItrel_totoutputRO((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyR2zsY	cCs4|j}|js|jr gS|jjj}g}||kr0x�||D]�\}}|j}	|	j}
|j}|j}|j|j	j
�j}
d||
|j|
|�f}|j|j
d�d||
�|t||jjj���||�||�||
�|jjj�f�qLW||=n|S(sW
        Returns any ALTER TABLE statements to add constraints after the fact.
        s
%s_refs_%s_%ssALTER TABLEs< %s ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s (%s)%s;(RRRRRRR:R$R8R0RXRR,R-Rtmax_name_lengthRY(RRBRCRHRERIRFt	rel_classRJtrel_optstr_tabletr_colttabletcoltr_name((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pytsql_for_pending_references�s,					
cCs�|jjs%|jjs%|jjr)gSg}x0|jjD]"}|j|j|||��q<WxY|jjD]K}g|D]}|jj|�d^q|}|j|j	|||��qoW|S(sM
        Returns the CREATE INDEX SQL statements for a single model.
        i(
RRRRRR5tsql_indexes_for_fieldtindex_togethertget_field_by_nametsql_indexes_for_fields(RRBRCR]RJtfstfields((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pytsql_indexes_for_model�s% ) cCs1|jr)|jr)|j||g|�SgSdS(sR
        Return the CREATE INDEX SQL statements for a single model field.
        N(tdb_indexR.Rj(RRBRJRC((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyRg�sc	Cs�t|�dkr>|djr>|jjj|dj�}n0|jjrh|jjj|jj�}nd}|r�d|}ng}|jjj}x-|D]%}|j|j||j	���q�Wd|jj
|jg|D]}|j^q��f}|j
d�d|j|t||jjj����d|j
d�d|j||jj
��dd|jd	j|��d
|gS(NiiRRs%s_%ssCREATE INDEXtONs(%s)s, s%s;(R<R!RRR/RRR,R#R$R:RR@R-R9RR^R6(	RRBRlRCR/tfield_namesRIRJt
index_name((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyRj�s

#5�cCs�|jjs%|jjs%|jjr)gS|jjj}d|jd�|j||jj	��fg}||kr�|j
|j|||��n|jjr�|jjj
|jj	�}|r�|j|�q�n|S(se
        Return the DROP TABLE and restraint dropping statements for a single
        model.
        s%s %s;s
DROP TABLE(RRRRRRRR-R9R:R5tsql_remove_table_constraintsR=tdrop_sequence_sqlR,(RRBtreferences_to_deleteRCRIR]tds((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pytsql_destroy_model�s%"c

Cs-|jjs%|jjs%|jjr)gSg}|jjj}x�||D]�\}}|jj}|j}	|jj}
|jj	|j
j�j}d|	||j||
�f}|j
d|jd�|j||��|j|jjj��|j|t||jjj����f�qIW||=|S(Ns
%s_refs_%s_%ss%s %s %s %s;sALTER TABLE(RRRRRRRR:R$R8R0RXRR,R-R9tdrop_foreignkey_sqlR#RR^(
RRBRtRCR]RIR_RJRcRdRaRbRe((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyRr�s&%		'cCs�|jjs%|jjs%|jjr)gSg}x0|jjD]"}|j|j|||��q<WxY|jjD]K}g|D]}|jj|�d^q|}|j|j	|||��qoW|S(sK
        Returns the DROP INDEX SQL statements for a single model.
        i(
RRRRRR5tsql_destroy_indexes_for_fieldRhRitsql_destroy_indexes_for_fields(RRBRCR]RJRkRl((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pytsql_destroy_indexes_for_models% ) cCs1|jr)|jr)|j||g|�SgSdS(sP
        Return the DROP INDEX SQL statements for a single model field.
        N(RnR.Ry(RRBRJRC((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyRxsc	Cs?t|�dkr>|djr>|jjj|dj�}n0|jjrh|jjj|jj�}nd}|r�d|}ng}|jjj}x-|D]%}|j|j||j	���q�Wd|jj
|jg|D]}|j^q��f}|j
d�d|j|t||jjj����ddgS(NiiRRs%s_%ss
DROP INDEXR(R<R!RRR/RRR,R#R$R:RR@R-R9RR^(	RRBRlRCR/RpRIRJRq((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyRys

#5<ic

Cs�ddlm}|j�}|dkr_d}|dkrGd|}nd|jj|fGHn|j||�|jj�|tj|jjd<||jj	d<|d	d
t
|dd�dtd
|jjdt�|dd
t
|dd�dtd
|jj�ddlm
}ddlm}xKtjD]@}||�}	t|	|�r1|d|	jd
|jj�q1q1W|jj�|S(s�
        Creates a test database, prompting the user for confirmation if the
        database already exists. Returns the name of the test database created.
        i����(tcall_commandiRis ('%s')s*Creating test database for alias '%s'%s...tNAMEtsyncdbt	verbosityitinteractivetdatabasetload_initial_datatflush(t	get_cache(tBaseDatabaseCachetcreatecachetable(tdjango.core.managementR{t_get_test_db_nameRtaliast_create_test_dbtcloseRt	DATABASESt
settings_dicttmaxRZtdjango.core.cacheR�tdjango.core.cache.backends.dbR�tCACHESt
isinstancet_tabletcursor(
RR~tautoclobberR{ttest_database_namettest_db_reprR�R�tcache_aliastcache((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pytcreate_test_db5s<

		

cCs0|jjdr|jjdSt|jjdS(s
        Internal implementation - returns the name of the test DB that will be
        created. Only useful when called from create_test_db() and
        _create_test_db() and when no external munging is done with the 'NAME'
        or 'TEST_NAME' settings.
        t	TEST_NAMER|(RR�tTEST_DATABASE_PREFIX(R((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyR�msc	CsR|j�}|j�}|jjj}|jj�}y!|jd||�|f�Wn�tk
rM}tj	j
d|�|s�td|�}n|s�|dkr8yV|dkr�d|jjGHn|jd||��|jd||�|f�WqJtk
r4}tj	j
d|�tj
d	�qJXqNd
GHtj
d�nX|S(sG
        Internal implementation - creates the test db tables.
        sCREATE DATABASE %s %ss,Got an error creating the test database: %s
sXType 'yes' if you would like to try deleting the test database '%s', or 'no' to cancel: tyesis$Destroying old test database '%s'...sDROP DATABASE %ss.Got an error recreating the test database: %s
isTests cancelled.(tsql_table_creation_suffixR�RRRR�texecutet	ExceptiontsyststderrtwriteRR�texit(	RR~R�tsuffixR�RIR�tetconfirm((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyR�xs>	
	cCs�|jj�|jjd}|dkr`d}|dkrHd|}nd|jj|fGHn|jjj�}||d<t|d�}|j|dd	d
t�}|jj	||�dS(sv
        Destroy a test database, prompting the user for confirmation if the
        database already exists.
        R|iRis ('%s')s,Destroying test database for alias '%s'%s...tENGINER�t__destroy_test_db__tallow_thread_sharingN(
RR�R�R�tcopyRtDatabaseWrapperRZtcreationt_destroy_test_db(Rtold_database_nameR~R�R�R�tbackendtnew_connection((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pytdestroy_test_db�s 


	cCsM|jj�}tjd�|jd|jjj|��|jj�dS(sF
        Internal implementation - remove the test db tables.
        isDROP DATABASE %sN(RR�ttimetsleepR�RRR�(RR�R~R�((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyR��s

	cCs&tjdtdd�|jjt�S(s�
        Make sure a connection is in autocommit mode. - Deprecated, not used
        anymore by Django code. Kept for compatibility with user code that
        might use it.
        sJset_autocommit was moved from BaseDatabaseCreation to BaseDatabaseWrapper.t
stackleveli(twarningstwarntPendingDeprecationWarningRtset_autocommitR+(R((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyR��s
cCsdS(sQ
        SQL to append to the end of the test table creation statements.
        R((R((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyR��scCs,|jj}|d|d|d|dfS(s�
        Returns a tuple with elements of self.connection.settings_dict (a
        DATABASES setting value) that uniquely identify a database
        accordingly to the RDBMS particularities.
        tHOSTtPORTR�R|(RR�(RR�((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyttest_db_signature�s
(t__name__t
__module__t__doc__t
data_typesR	RtsetRVR2RfRmRgRjRvRrRzRxRyRZR�R�R�R�R�R�R�R�(((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyRs.		
R												8		*			(R
R�R�R�tdjango.confRtdjango.db.utilsRtdjango.utils.encodingRtdjango.utils.six.movesRtutilRR�tobjectR(((s=/tmp/pip-install-XxeQeY/django/django/db/backends/creation.pyt<module>s

https://t.me/AnonymousX5 - 2025