KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/22697/root/usr/lib64/python2.4/bsddb/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/22697/root/usr/lib64/python2.4/bsddb/dbtables.pyo
mò
‚=5Dc@s‚dZdkZdkZdkZdkZdkZdklZlZdk	Z
ydkTWnej
odk
TnXdefd„ƒYZdefd„ƒYZdfd	„ƒYZd
efd„ƒYZdefd
„ƒYZdefd„ƒYZdefd„ƒYZdZdZd„ZdZdZdZd„Zd„Zd„Zd„Zd„Z d„Z!dfd„ƒYZ"dS( s5$Id: dbtables.py 36901 2004-08-08 00:54:21Z tim_one $N(sListTypes
StringType(t*tTableDBErrorcBstZRS(N(t__name__t
__module__(((t&/usr/lib64/python2.4/bsddb/dbtables.pyR$stTableAlreadyExistscBstZRS(N(RR(((RR&stCondcBstZdZd„ZRS(s!This condition matches everythingcCsdS(Ni((tselfts((Rt__call__,s(RRt__doc__R	(((RR*st	ExactCondcBs tZdZd„Zd„ZRS(s)Acts as an exact match condition functioncCs
||_dS(N(t
strtomatchR(RR((Rt__init__1scCs
||ijS(N(RRR(RR((RR	3s(RRR
R
R	(((RR/s	t
PrefixCondcBs tZdZd„Zd„ZRS(s9Acts as a condition function for matching a string prefixcCs
||_dS(N(tprefixR(RR((RR
8scCs|t|iƒ |ijS(N(RtlenRR(RR((RR	:s(RRR
R
R	(((RR6s	tPostfixCondcBs tZdZd„Zd„ZRS(s:Acts as a condition function for matching a string postfixcCs
||_dS(N(tpostfixR(RR((RR
?scCs|t|iƒ|ijS(N(RRRR(RR((RR	As(RRR
R
R	(((RR=s	tLikeCondcBs&tZdZeid„Zd„ZRS(sÇ
    Acts as a function that will match using an SQL 'LIKE' style
    string.  Case insensitive and % signs are wild cards.
    This isn't perfect but it should work for the simple common cases.
    cCsfd}x$|D]}|i|d|ƒ}q
W|iddƒ|_tid|id|ƒ|_dS(Ns.*+()[]?s\t%s.*t^t$(tchars_to_escapetchartlikestrtreplaceRtretcompiletre_flags(RRRRR((RR
JscCs|ii|ƒS(N(RRtmatchR(RR((RR	Rs(RRR
Rt
IGNORECASER
R	(((RRDst__TABLE_NAMES__s._COLUMNS__cCs|tS(N(ttablet_columns(R!((Rt_columns_key[ss._DATA_.s	._ROWID_.icCs|t|t|S(N(R!t_datatcoltrowid(R!R%R&((Rt	_data_keyfscCs|t|tS(N(R!R$R%(R!R%((Rt_search_col_data_keyiscCs|tS(N(R!R$(R!((Rt_search_all_data_keylscCs|t|tS(N(R!t_rowidR&(R!R&((Rt
_rowid_keyoscCs|tS(N(R!R*(R!((Rt_search_rowid_keyrscCsh|itƒdjpB|itƒdjp,|itƒdjp|itƒdjodSndSdS(s‚Verify that the given string does not contain any
    metadata strings that might interfere with dbtables database operation.
    iiN(Rtfindt_table_names_keyR"R$R*(R((Rtcontains_metastringsusXt
bsdTableDBcBsÈtZdddddd„Zd„Zd„Zdd„Zd„Zd„Zd	„Zd
„Z	d„Z
d„Zd
„Zd„Z
d„Zhhd„Zhd„Zhd„Zd„Zd„ZRS(Nii€cCs“d|_t}|o|tO}nttBt	Bt
B|B}
y|t
O}Wntj
onX|o|
tB}
ntƒ|_|iitƒ|ii|||
Bƒ|o|tO}nt|iƒ|_|iidƒ|iitƒ|ii|t||B|ƒ||_ |ii!ƒ}	yC|ii#t$|	ƒp)|ii%t$t&i'gdƒd|	ƒnWn|	i(ƒ‚nX|	i)ƒh|_*dS(sÇbsdTableDB.open(filename, dbhome, create=0, truncate=0, mode=0600)
        Open database name in the dbhome BerkeleyDB directory.
        Use keyword arguments when calling this constructor.
        ittxnN(+tNoneRtdbt	DB_THREADtmyflagstcreatet	DB_CREATEt
DB_INIT_MPOOLtDB_INIT_LOCKtDB_INIT_LOGtDB_INIT_TXNtdbflagstflagsforenvtDB_AUTO_COMMITtAttributeErrortrecovert
DB_RECOVERtDBEnvtenvt
set_lk_detecttDB_LOCK_DEFAULTtopentdbhomettruncatetDB_TRUNCATEtDBtset_get_returns_nonet	set_flagstDB_DUPtfilenametDB_BTREEtmodet
dbfilenamet	txn_beginR1thas_keyR.tputtpickletdumpstaborttcommitt_bsdTableDB__tablecolumns(RRNRGR6RHRPR@R<R5R1R=((RR
„s>		-

cCs|iƒdS(N(Rtclose(R((Rt__del__³scCsX|idj	o|iiƒd|_n|idj	o|iiƒd|_ndS(N(RR3R2RZRC(R((RRZ¶s


cCs.y|ii|ƒWntj
onXdS(N(RRCttxn_checkpointtminstDBIncompleteError(RR]((Rt
checkpoint¾scCs+y|iiƒWntj
onXdS(N(RR3tsyncR^(R((RR`ÄscCs›dGH|iiƒ}yc|iƒ\}}xJth||<ƒGH|iƒ}|o|\}}q,|i	ƒdSq,WWnt
j
o|i	ƒnXdS(s*Print the database to stdout for debuggings5******** Printing raw database for debugging ********iN(RR3tcursortcurtfirsttkeytdatatreprtnextRZtDBNotFoundError(RRbRgRdRe((Rt	_db_printÊs

cCsod}y+t|ƒotdƒ‚nx+|D]#}t|ƒotdƒ‚q-q-Wt|ƒ}|i
i|ƒo
td‚n|i
iƒ}|i
i|ti|dƒd|ƒti|i
itd|dtƒƒ}|i|ƒ|i
it|ƒ|i
itti|dƒd|ƒ|iƒd}Wn7tj
o+}|o|iƒnt|d‚nXdS(s’CreateTable(table, columns) - Create a new table in the database
        raises TableDBError if it already exists or for other DB errors.
        s-bad table name: contains reserved metastringss.bad column name: contains reserved metastringsstable already existsiR1tflagsN(R2R1R/R!t
ValueErrortcolumnstcolumnR#tcolumnlist_keyRR3RSRRCRRRTRURVtloadstgetR.tDB_RMWt	tablelisttappendtdeleteRXtDBErrortdberrorRWR(RR!RlR1RvRmRnRr((RtCreateTableÜs4


%
%

cCsst|ƒo
td‚nt|ƒ}|ii|ƒpgSn|ii|ƒ}|ot
i|ƒSngSdS(s\Return a list of columns in the given table.
        [] if the table doesn't exist.
        s-bad table name: contains reserved metastringsN(R/R!RkR#RnRR3RSRptpickledcolumnlistRURo(RR!RnRx((RtListTableColumnss

cCs2|iitƒ}|oti|ƒSngSdS(s)Return a list of tables in this database.N(RR3RpR.tpickledtablelistRURo(RRz((Rt
ListTabless
c
Cs|y|i||ƒWnatj
oUd}yt|ƒ}|i	i
ƒ}ti|i
i|d|dtƒƒ}h}x|D]}|||<q}Wti|ƒ}	x/|D]'}|i|ƒp|	i|ƒq§q§W|	|jo<|i
i||ƒ|i
i|ti|	dƒd|ƒn|iƒd}|i|ƒWqxtj
o+}|o|iƒnt|d‚qxXnXdS(sCreateOrExtendTable(table, columns)

        - Create a new table in the database.
        If a table of this name already exists, extend it to have any
        additional columns present in the given list as well as
        all of its current columns.
        R1RjiN( RRwR!RlRR2R1R#RnRCRRRURoR3RpRqt
oldcolumnlistt
oldcolumnhashtctcopyt
newcolumnlistRSRsRtRTRVRXt_bsdTableDB__load_column_infoRuRvRWR(
RR!RlR1RnR~R}R|RvR€((RtCreateOrExtendTables>'

cCswy|iit|ƒƒ}Wn#tj
otd|f‚nX|ptd|f‚nti	|ƒ|i
|<dS(s'initialize the self.__tablecolumns dictsunknown table: %rN(RR3RpR#R!ttcolpicklesRhRRURoRY(RR!Rƒ((Rt__load_column_infoRscCs³d}x¦|pžtiƒ}|ittiƒdƒƒ|ittiƒdƒƒ|iƒ}y,|i
it||ƒdd|dtƒWntj
oq	Xd}q	W|S(s"Create a new unique row identifieriiÿÿÿR1RjiN(tuniquetxdrlibtPackertptpack_inttinttrandomt
get_buffertnewidRR3RTR+R!R2R1tDB_NOOVERWRITEtDBKeyExistError(RR!R1RˆRR…((Rt__new_rowid]sc	Csvd}y|iit|ƒƒp
td‚n|ii|ƒp|i	|ƒnx?|iƒD]1}|i|i
|ƒptd|f‚q`q`W|iiƒ}|i|d|ƒ}x?|iƒD]1\}}|iit|||ƒ|d|ƒqÆW|iƒd}Wnctj
oW}tiƒ}|o'|iƒ|iit||ƒƒnt|d|d‚nXdS(sƒInsert(table, datadict) - Insert a new row into the table
        using the keys+values from rowdict as the column values.
        s
unknown tablesunknown column: %rR1iiN(R2R1RR3RSR#R!RRYRtrowdicttkeysRmtcountRCRRt_bsdTableDB__new_rowidR&titemstdataitemRTR'RXRuRvtsystexc_infotinfoRWRtR+(	RR!R‘R™R1R–RmRvR&((RtInsertus0


)


cCsuyL|i|g|ƒ}
|iƒ}	x$|
iƒD]}d}yÚxÓ|	D]Ë}|ii
ƒ}yD|iit|||ƒ|ƒ}|iit|||ƒ|ƒWntj
o
d}nX|||ƒ}|djo)|iit|||ƒ|d|ƒn|iƒd}qGWWq1tj
o!}|o|iƒn‚q1Xq1WWn"tj
o}t|d‚nXdS(sâModify(table, conditions) - Modify in rows matching 'conditions'
        using mapping functions in 'mappings'
        * conditions is a dictionary keyed on column names
        containing condition functions expecting the data string as an
        argument and returning a boolean.
        * mappings is a dictionary keyed on column names containint condition
        functions expecting the data string as an argument and returning the
        new string for that column.
        R1iN(Rt_bsdTableDB__SelectR!t
conditionstmatching_rowidstmappingsR’RlR&R2R1RmRCRRR3RpR'R–RtRhRTRXRuRvRWR(RR!RœRžR1RmR–RvR&RlR((RtModifys<	
	

c	Cs?y|i|g|ƒ}|i|}xí|iƒD]ß}d}y£|iiƒ}xG|D]?}y#|iit|||ƒ|ƒWqWtj
oqWXqWWy |iit||ƒ|ƒWntj
onX|iƒd}Wq2tj
o!}|o|iƒn‚q2Xq2WWn"tj
o}t|d‚nXdS(sDelete(table, conditions) - Delete items matching the given
        conditions from the table.
        * conditions is a dictionary keyed on column names
        containing condition functions expecting the data string as an
        argument and returning a boolean.
        iN(RR›R!RœRRYRlR’R&R2R1RCRRRmR3RtR'RhR+RXRuRvRWR(	RR!RœR1RRmRvR&Rl((RtDeleteÍs8

	 

cCsŠy[|ii|ƒp|i|ƒn|djo|i|}n|i|||ƒ}Wn"t
j
o}t|d‚nX|i
ƒS(sªSelect(table, conditions) - retrieve specific row data
        Returns a list of row column->value mapping dictionaries.
        * columns is a list of which column data to return.  If
          columns is None, all columns will be returned.
        * conditions is a dictionary keyed on column names
          containing callable conditions expecting the data string as an
          argument and returning a boolean.
        iN(RRYRSR!RRlR2R›RœRRuRvRtvalues(RR!RlRœRRv((RtSelectõs
cCsö|ii|ƒp|i|ƒn|djo|i|}nxC||i	ƒD]1}|i|i|ƒptd|f‚qSqSWh}h}d„}
|iƒ}|i|
ƒ|iiƒ}d}x[|D]S\}}|d}t||ƒ}||jo
d}nd}yÞ|i|ƒ\}}	xÂ|t|ƒ |joª|t}|i|ƒpy|p
||	ƒo;|i|ƒph||<n|o|	|||<qÖqÚ|i|ƒo||=n|||<n|i!ƒ\}}	q/WWqÒt"j
o$}
|
dt$jo‚qÒqÒqÒXqÒW|i%ƒ~t|ƒdjo©x¦|iƒD]”\}}x…|D]}}|i|ƒoqiny&|ii't(|||ƒƒ||<Wqit"j
o+}
|
dt$jo‚nd||<qiXqiWqVWn|S(s™__Select() - Used to implement Select and Delete (above)
        Returns a dictionary keyed on rowids containing dicts
        holding the row data for columns listed in the columns param
        that match the given conditions.
        * conditions is a dictionary keyed on column names
        containing callable conditions expecting the data string as an
        argument and returning a boolean.
        sunknown column: %rcCs|d}|d}t|ƒt|ƒjoŽt|tƒo3t|tƒo#tt|i	ƒt|i	ƒƒSnt|t
ƒo3t|t
ƒo#tt|iƒt|iƒƒSndSnt|tƒodSnt|tƒodSnt|tƒodSnt|tƒodSndS(Niiiÿÿÿÿ(
tatupletatbtupletbttypet
isinstanceRtcmpRRRRR(R£R¥R¤R¦((Rtcmp_conditions$s"

 # #iÿÿÿÿiiN()RRYRSR!RRlR2ttablecolumnsRœR’RmR“RRtrejected_rowidsRªR•t
conditionlisttsortR3RaRbt
column_numt	conditionR(t	searchkeytsavethiscolumndatat	set_rangeRdReRt_rowid_str_lenR&RgRuRvtDB_NOTFOUNDRZtrowdataRpR'(RR!RlRœR¶R&R²R±RReRªR­R¬RvRdR°RbRmR¯((Rt__Select
st
	





&c	Csd}yÓ|iiƒ}|iit|ƒ|ƒ|ii	|ƒ}t|ƒ}x[y|i
|ƒ\}}Wntj
oPnX|t|ƒ |joPn|iƒqRWt|ƒ}x[y|i
|ƒ\}}Wntj
oPnX|t|ƒ |joPn|iƒq¼W|iƒti|iitd|dtƒƒ}y|i|ƒWntj
onX|iit|ƒ|iitti|dƒd|ƒ|iƒd}|ii |ƒo|i|=nWn7t!j
o+}|o|i#ƒnt$|d‚nXdS(s(Remove an entire table from the databaseiR1RjN(%R2R1RRCRRR3RtR#R!RaRbR)t	table_keyR³RdReRhRR,RZRURoRpR.RqRrtremoveRkRTRVRXRYRSRuRvRWR(	RR!RdR1RbR¸RrRvRe((RtDrop{sT
'%
(RRR
R[RZR_R`RiRwRyR{R‚RR”RšRŸR R¢R›Rº(((RR0ƒs$/					)			4			(0(	q(#t_cvsidRR—RR†R‹ttypestListTypet
StringTypetcPickleRUt	bsddb3.dbtImportErrortbsddb.dbt
StandardErrorRRRRRRRR.R"R#R$R*R´R'R(R)R+R,R/R0(R+RR‹R.R)R/R¾R"R»R*RRRRR†R—R#R'R½R´R$RRR0R(RR,RRU((Rt?s>													

Anon7 - 2021