Tryag File Manager
Home
-
Turbo Force
Current Path :
/
proc
/
self
/
root
/
proc
/
self
/
root
/
usr
/
lib
/
python2.4
/
bsddb
/
Upload File :
New :
File
Dir
//proc/self/root/proc/self/root/usr/lib/python2.4/bsddb/dbtables.pyc
mò ‚=5Dc�����������@���s‚��d��Z��d�k�Z�d�k�Z�d�k�Z�d�k�Z�d�k�Z�d�k�l�Z�l�Z�d�k �Z �y�d�k�TWn�e�j �o�d�k �Tn�Xd�e�f�d�„��ƒ��YZ�d�e�f�d�„��ƒ��YZ�d�f��d �„��ƒ��YZ�d �e�f�d�„��ƒ��YZ�d�e�f�d �„��ƒ��YZ�d�e�f�d�„��ƒ��YZ�d�e�f�d�„��ƒ��YZ�d�Z�d�Z�d�„��Z�d�Z�d�Z�d�Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z �d�„��Z!�d�f��d�„��ƒ��YZ"�d�S( ���s5���$Id: dbtables.py 36901 2004-08-08 00:54:21Z tim_one $N(���s���ListTypes ���StringType(���t���*t���TableDBErrorc�����������B���s���t��Z�RS(���N(���t���__name__t ���__module__(����(����(����t$���/usr/lib/python2.4/bsddb/dbtables.pyR���$���s���t���TableAlreadyExistsc�����������B���s���t��Z�RS(���N(���R���R���(����(����(����R���R���&���s���t���Condc�����������B���s���t��Z�d��Z�d�„��Z�RS(���s!���This condition matches everythingc���������C���s���d�S(���Ni���(����(���t���selft���s(����(����R���t���__call__,���s����(���R���R���t���__doc__R ���(����(����(����R���R���*���s����t ���ExactCondc�����������B���s ���t��Z�d��Z�d�„��Z�d�„��Z�RS(���s)���Acts as an exact match condition functionc���������C���s ���|�|��_��d��S(���N(���t ���strtomatchR���(���R���R���(����(����R���t���__init__1���s����c���������C���s ���|�|��i�j�S(���N(���R���R���R���(���R���R���(����(����R���R ���3���s����(���R���R���R ���R ���R ���(����(����(����R���R���/���s���� t ���PrefixCondc�����������B���s ���t��Z�d��Z�d�„��Z�d�„��Z�RS(���s9���Acts as a condition function for matching a string prefixc���������C���s ���|�|��_��d��S(���N(���t���prefixR���(���R���R���(����(����R���R ���8���s����c���������C���s���|�t�|��i�ƒ� |��i�j�S(���N(���R���t���lenR���R���(���R���R���(����(����R���R ���:���s����(���R���R���R ���R ���R ���(����(����(����R���R���6���s���� t���PostfixCondc�����������B���s ���t��Z�d��Z�d�„��Z�d�„��Z�RS(���s:���Acts as a condition function for matching a string postfixc���������C���s ���|�|��_��d��S(���N(���t���postfixR���(���R���R���(����(����R���R ���?���s����c���������C���s���|�t�|��i�ƒ�|��i�j�S(���N(���R���R���R���R���(���R���R���(����(����R���R ���A���s����(���R���R���R ���R ���R ���(����(����(����R���R���=���s���� t���LikeCondc�����������B���s&���t��Z�d��Z�e�i�d�„�Z�d�„��Z�RS(���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. c���������C���sf���d�}�x$�|�D]�}�|�i�|�d�|�ƒ�}�q �W|�i�d�d�ƒ�|��_�t�i�d�|��i�d�|�ƒ�|��_�d��S(���Ns���.*+()[]?s���\t���%s���.*t���^t���$(���t���chars_to_escapet���chart���likestrt���replaceR���t���ret���compilet���re_flags(���R���R���R���R���R���(����(����R���R ���J���s�����c���������C���s���|��i�i�|�ƒ�S(���N(���R���R���t���matchR���(���R���R���(����(����R���R ���R���s����(���R���R���R ���R���t ���IGNORECASER ���R ���(����(����(����R���R���D���s����t���__TABLE_NAMES__s���._COLUMNS__c���������C���s���|��t�S(���N(���t���tablet���_columns(���R!���(����(����R���t���_columns_key[���s����s���._DATA_.s ���._ROWID_.i���c���������C���s���|��t�|�t�|�S(���N(���R!���t���_datat���colt���rowid(���R!���R%���R&���(����(����R���t ���_data_keyf���s����c���������C���s���|��t�|�t�S(���N(���R!���R$���R%���(���R!���R%���(����(����R���t���_search_col_data_keyi���s����c���������C���s���|��t�S(���N(���R!���R$���(���R!���(����(����R���t���_search_all_data_keyl���s����c���������C���s���|��t�|�t�S(���N(���R!���t���_rowidR&���(���R!���R&���(����(����R���t ���_rowid_keyo���s����c���������C���s���|��t�S(���N(���R!���R*���(���R!���(����(����R���t���_search_rowid_keyr���s����c���������C���sh���|��i�t�ƒ�d�j�pB�|��i�t�ƒ�d�j�p,�|��i�t�ƒ�d�j�p�|��i�t�ƒ�d�j�o�d�Sn�d�Sd�S(���s‚���Verify that the given string does not contain any metadata strings that might interfere with dbtables database operation. i����i���N(���R���t���findt���_table_names_keyR"���R$���R*���(���R���(����(����R���t���contains_metastringsu���s�����Xt ���bsdTableDBc�����������B���sÈ���t��Z�d�d�d�d�d�d�„�Z�d�„��Z�d�„��Z�d�d�„�Z�d�„��Z�d�„��Z�d �„��Z�d �„��Z �d�„��Z �d�„��Z�d �„��Z�d�„��Z �d�„��Z�h��h��d�„�Z�h��d�„�Z�h��d�„�Z�d�„��Z�d�„��Z�RS(���Ni����i€��c���������C���s“��d�|��_�t�}�|�o�|�t�O}�n�t�t�Bt �Bt �B|�B} �y�|�t �O}�Wn�t�j �o�n�X|�o�| �t�B} �n�t�ƒ��|��_�|��i�i�t�ƒ�|��i�i�|�|�| �Bƒ�|�o�|�t�O}�n�t�|��i�ƒ�|��_�|��i�i�d�ƒ�|��i�i�t�ƒ�|��i�i�|�t�|�|�B|�ƒ�|�|��_ �|��i�i!�ƒ��} �yC�|��i�i#�t$�| �ƒ�p)�|��i�i%�t$�t&�i'�g��d�ƒ�d�| �ƒn�Wn�| �i(�ƒ��‚��n�X| �i)�ƒ��h��|��_*�d�S(���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. i���t���txnN(+���t���NoneR���t���dbt ���DB_THREADt���myflagst���createt ���DB_CREATEt ���DB_INIT_MPOOLt���DB_INIT_LOCKt���DB_INIT_LOGt���DB_INIT_TXNt���dbflagst���flagsforenvt���DB_AUTO_COMMITt���AttributeErrort���recovert ���DB_RECOVERt���DBEnvt���envt ���set_lk_detectt���DB_LOCK_DEFAULTt���opent���dbhomet���truncatet���DB_TRUNCATEt���DBt���set_get_returns_nonet ���set_flagst���DB_DUPt���filenamet���DB_BTREEt���modet ���dbfilenamet ���txn_beginR1���t���has_keyR.���t���putt���picklet���dumpst���abortt���committ���_bsdTableDB__tablecolumns(���R���RN���RG���R6���RH���RP���R@���R<���R5���R1���R=���(����(����R���R ���„���s>����� - c���������C���s���|��i�ƒ��d��S(���N(���R���t���close(���R���(����(����R���t���__del__³���s����c���������C���sX���|��i�d��j �o�|��i�i�ƒ��d��|��_�n�|��i�d��j �o�|��i�i�ƒ��d��|��_�n�d��S(���N(���R���R3���R2���RZ���RC���(���R���(����(����R���RZ���¶���s���� c���������C���s.���y�|��i�i�|�ƒ�Wn�t�j �o�n�Xd��S(���N(���R���RC���t���txn_checkpointt���minst���DBIncompleteError(���R���R]���(����(����R���t ���checkpoint¾���s����c���������C���s+���y�|��i�i�ƒ��Wn�t�j �o�n�Xd��S(���N(���R���R3���t���syncR^���(���R���(����(����R���R`���Ä���s����c���������C���s›���d�GH|��i�i�ƒ��}�yc�|�i�ƒ��\�}�}�xJ�t�h��|�|�<ƒ�GH|�i�ƒ��}�|�o�|�\�}�}�q,�|�i �ƒ��d�Sq,�WWn�t �j �o�|�i �ƒ��n�Xd�S(���s*���Print the database to stdout for debuggings5���******** Printing raw database for debugging ********i���N(���R���R3���t���cursort���curt���firstt���keyt���datat���reprt���nextRZ���t���DBNotFoundError(���R���Rb���Rg���Rd���Re���(����(����R���t ���_db_printÊ���s������� c���������C���s†��t��|�t�ƒ�p�t�‚�d�}�y+t�|�ƒ�o�t�d�ƒ�‚�n�x+�|�D]#�}�t�|�ƒ�o�t�d�ƒ�‚�qD�qD�Wt �|�ƒ�}�|��i �i�|�ƒ�o �t�d�‚�n�|��i�i�ƒ��}�|��i �i�|�t�i�|�d�ƒ�d�|�ƒt�i�|��i �i�t�d�|�d�t�ƒƒ�}�|�i�|�ƒ�|��i �i�t�|�ƒ�|��i �i�t�t�i�|�d�ƒ�d�|�ƒ|�i�ƒ��d�}�Wn7�t�j �o+�}�|�o�|�i�ƒ��n�t �|�d�‚�n�Xd�S(���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 metastringss���table already existsi���R1���t���flagsN(!���t ���isinstancet���columnst���ListTypet���AssertionErrorR2���R1���R/���R!���t ���ValueErrort���columnR#���t���columnlist_keyR���R3���RS���R���RC���RR���RT���RU���RV���t���loadst���getR.���t���DB_RMWt ���tablelistt���appendt���deleteRX���t���DBErrort���dberrorRW���R���(���R���R!���Rl���R1���Ry���Rp���Rq���Ru���(����(����R���t���CreateTableÜ���s4����� � % % c���������C���sŠ���t��|�t�ƒ�p�t�‚�t�|�ƒ�o �t�d�‚�n�t�|�ƒ�}�|��i �i �|�ƒ�p�g��Sn�|��i �i�|�ƒ�}�|�o�t �i�|�ƒ�Sn�g��Sd�S(���s\���Return a list of columns in the given table. [] if the table doesn't exist. s-���bad table name: contains reserved metastringsN(���Rk���R!���t ���StringTypeRn���R/���Ro���R#���Rq���R���R3���RS���Rs���t���pickledcolumnlistRU���Rr���(���R���R!���Rq���R|���(����(����R���t���ListTableColumns��s����� c���������C���s2���|��i�i�t�ƒ�}�|�o�t�i�|�ƒ�Sn�g��Sd�S(���s)���Return a list of tables in this database.N(���R���R3���Rs���R.���t���pickledtablelistRU���Rr���(���R���R~���(����(����R���t ���ListTables��s �����c��� ������C���s“��t��|�t�ƒ�p�t�‚�y�|��i�|�|�ƒ�Wnat�j �oUd�}�yt �|�ƒ�}�|��i�i �ƒ��}�t�i�|��i�i�|�d�|�d�t�ƒƒ�}�h��}�x�|�D]�}�|�|�|�<q”�Wt�i�|�ƒ�} �x/�|�D]'�}�|�i�|�ƒ�p�| �i�|�ƒ�q¾�q¾�W| �|�j�o<�|��i�i�|�|�ƒ�|��i�i�|�t�i�| �d�ƒ�d�|�ƒn�|�i�ƒ��d�}�|��i�|�ƒ�Wqt�j �o+�}�|�o�|�i!�ƒ��n�t"�|�d�‚�qXn�Xd�S(���s��CreateOrExtendTable(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. R1���Rj���i���N(#���Rk���Rl���Rm���Rn���R���Rz���R!���R���R2���R1���R#���Rq���RC���RR���RU���Rr���R3���Rs���Rt���t ���oldcolumnlistt ���oldcolumnhasht���ct���copyt ���newcolumnlistRS���Rv���Rw���RT���RV���RX���t���_bsdTableDB__load_column_infoRx���Ry���RW���R���( ���R���R!���Rl���R1���Rq���R‚���R���R€���Ry���R„���(����(����R���t���CreateOrExtendTable��s>�����'�� c���������C���sw���y�|��i�i�t�|�ƒ�ƒ�}�Wn#�t�j �o�t�d�|�f�‚�n�X|�p�t�d�|�f�‚�n�t�i �|�ƒ�|��i �|�<d�S(���s'���initialize the self.__tablecolumns dicts���unknown table: %rN(���R���R3���Rs���R#���R!���t���tcolpicklesRh���R���RU���Rr���RY���(���R���R!���R‡���(����(����R���t���__load_column_infoR��s�����c���������C���s³���d�}�x¦�|�pž�t�i�ƒ��}�|�i�t�t�i�ƒ��d�ƒ�ƒ�|�i�t�t�i�ƒ��d�ƒ�ƒ�|�i�ƒ��}�y,�|��i �i�t�|�|�ƒ�d�d�|�d�t�ƒWn�t�j �o�q �Xd�}�q �W|�S(���s"���Create a new unique row identifieri����iÿÿÿR1���Rj���i���N(���t���uniquet���xdrlibt���Packert���pt���pack_intt���intt���randomt ���get_buffert���newidR���R3���RT���R+���R!���R2���R1���t���DB_NOOVERWRITEt���DBKeyExistError(���R���R!���R1���RŒ���R‘���R‰���(����(����R���t���__new_rowid]��s������c��� ������C���sv��d�}�y|��i�i�t�|�ƒ�ƒ�p �t�d�‚�n�|��i�i�|�ƒ�p�|��i �|�ƒ�n�x?�|�i�ƒ��D]1�}�|��i�|�i �|�ƒ�p�t�d�|�f�‚�q`�q`�W|��i�i�ƒ��}�|��i�|�d�|�ƒ}�x?�|�i�ƒ��D]1�\�}�}�|��i�i�t�|�|�|�ƒ�|�d�|�ƒqÆ�W|�i�ƒ��d�}�Wnc�t�j �oW�}�t�i�ƒ��}�|�o'�|�i�ƒ��|��i�i�t�|�|�ƒ�ƒ�n�t�|�d�|�d�‚�n�Xd�S(���sƒ���Insert(table, datadict) - Insert a new row into the table using the keys+values from rowdict as the column values. s ���unknown tables���unknown column: %rR1���i���i���N(���R2���R1���R���R3���RS���R#���R!���R���RY���R…���t���rowdictt���keysRp���t���countRC���RR���t���_bsdTableDB__new_rowidR&���t���itemst���dataitemRT���R'���RX���Rx���Ry���t���syst���exc_infot���infoRW���Rw���R+���( ���R���R!���R•���R���R1���Rš���Rp���Ry���R&���(����(����R���t���Insertu��s0����� � �) c���������C���su��yL|��i�|�g��|�ƒ�} �|�i�ƒ��} �x$| �i�ƒ��D]}�d�}�yÚ�xÓ�| �D]Ë�}�|��i�i �ƒ��}�yD�|��i�i�t�|�|�|�ƒ�|�ƒ�}�|��i�i�t�|�|�|�ƒ�|�ƒ�Wn�t�j �o �d�}�n�X|�|�|�ƒ�}�|�d�j�o)�|��i�i�t�|�|�|�ƒ�|�d�|�ƒn�|�i�ƒ��d�}�qG�WWq1�t�j �o!�}�|�o�|�i�ƒ��n�‚��q1�Xq1�WWn"�t�j �o�}�t�|�d�‚�n�Xd�S(���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. R1���i���N(���R���t���_bsdTableDB__SelectR!���t ���conditionst���matching_rowidst���mappingsR–���Rl���R&���R2���R1���Rp���RC���RR���R3���Rs���R'���Rš���Rw���Rh���RT���RX���Rx���Ry���RW���R���(���R���R!���R ���R¢���R1���Rp���Rš���Ry���R&���Rl���R¡���(����(����R���t���Modify��s<���� � �� c��� ������C���s?��y|��i�|�g��|�ƒ�}�|��i�|�}�xí�|�i�ƒ��D]ß�}�d�}�y£�|��i�i�ƒ��}�xG�|�D]?�}�y#�|��i�i�t�|�|�|�ƒ�|�ƒ�WqW�t�j �o�qW�XqW�Wy �|��i�i�t�|�|�ƒ�|�ƒ�Wn�t�j �o�n�X|�i�ƒ��d�}�Wq2�t�j �o!�}�|�o�|�i�ƒ��n�‚��q2�Xq2�WWn"�t�j �o�}�t�|�d�‚�n�Xd�S(���s��Delete(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. i���N(���R���RŸ���R!���R ���R¡���RY���Rl���R–���R&���R2���R1���RC���RR���Rp���R3���Rw���R'���Rh���R+���RX���Rx���Ry���RW���R���( ���R���R!���R ���R1���R¡���Rp���Ry���R&���Rl���(����(����R���t���DeleteÍ��s8����� �� c���������C���sŠ���y[�|��i�i�|�ƒ�p�|��i�|�ƒ�n�|�d�j�o�|��i�|�}�n�|��i�|�|�|�ƒ�}�Wn"�t �j �o�}�t�|�d�‚�n�X|�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. i���N(���R���RY���RS���R!���R…���Rl���R2���RŸ���R ���R¡���Rx���Ry���R���t���values(���R���R!���Rl���R ���R¡���Ry���(����(����R���t���Selectõ��s����� c���������C���sö��|��i�i�|�ƒ�p�|��i�|�ƒ�n�|�d�j�o�|��i�|�}�n�xC�|�|�i �ƒ��D]1�}�|��i�|�i�|�ƒ�p�t�d�|�f�‚�qS�qS�Wh��}�h��}�d�„��} �|�i�ƒ��}�|�i�| �ƒ�|��i�i�ƒ��}�d�}�x[|�D]S\�}�}�|�d�}�t�|�|�ƒ�}�|�|�j�o �d�}�n�d�}�yÞ�|�i�|�ƒ�\�}�} �xÂ�|�t�|�ƒ� |�j�oª�|�t�}�|�i�|�ƒ�py�|�p �|�| �ƒ�o;�|�i�|�ƒ�p�h��|�|�<n�|�o�| �|�|�|�<qÖqÚ|�i�|�ƒ�o�|�|�=n�|�|�|�<n�|�i!�ƒ��\�}�} �q/WWqÒ�t"�j �o$�} �| �d�t$�j�o�‚��qÒ�qÒ�qÒ�XqÒ�W|�i%�ƒ��~�t�|�ƒ�d�j�o©�x¦�|�i�ƒ��D]”�\�}�}�x…�|�D]}�}�|�i�|�ƒ�o�qin�y&�|��i�i'�t(�|�|�|�ƒ�ƒ�|�|�<Wqit"�j �o+�} �| �d�t$�j�o�‚��n�d�|�|�<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. s���unknown column: %rc���������C���s��|��d�}�|�d�}�t�|�ƒ�t�|�ƒ�j�oŽ�t�|�t�ƒ�o3�t�|�t�ƒ�o#�t�t�|�i �ƒ�t�|�i �ƒ�ƒ�Sn�t�|�t �ƒ�o3�t�|�t �ƒ�o#�t�t�|�i�ƒ�t�|�i�ƒ�ƒ�Sn�d�Sn�t�|�t�ƒ�o�d�Sn�t�|�t�ƒ�o�d�Sn�t�|�t�ƒ�o�d�Sn�t�|�t�ƒ�o�d�Sn�d�S(���Ni���i����iÿÿÿÿ( ���t���atuplet���at���btuplet���bt���typeRk���R���t���cmpR���R���R���R���R���(���R§���R©���R¨���Rª���(����(����R���t���cmp_conditions$��s"���� # #iÿÿÿÿi���i����N()���R���RY���RS���R!���R…���Rl���R2���t���tablecolumnsR ���R–���Rp���R—���R���R¡���t���rejected_rowidsR���R™���t ���conditionlistt���sortR3���Ra���Rb���t ���column_numt ���conditionR(���t ���searchkeyt���savethiscolumndatat ���set_rangeRd���Re���R���t���_rowid_str_lenR&���Rg���Rx���Ry���t���DB_NOTFOUNDRZ���t���rowdataRs���R'���(���R���R!���Rl���R ���R¹���R&���Rµ���R´���R¡���Re���R���R°���R¯���Ry���Rd���R³���Rb���Rp���R²���(����(����R���t���__Select ��st����� � � � ��&c��� ������C���s��d�}�yÓ|��i�i�ƒ��}�|��i�i�t�|�ƒ�|�ƒ�|��i�i �|�ƒ�}�t�|�ƒ�}�x[�y�|�i �|�ƒ�\�}�}�Wn�t�j �o�Pn�X|�t�|�ƒ� |�j�o�Pn�|�i�ƒ��qR�Wt�|�ƒ�}�x[�y�|�i �|�ƒ�\�}�}�Wn�t�j �o�Pn�X|�t�|�ƒ� |�j�o�Pn�|�i�ƒ��q¼�W|�i�ƒ��t�i�|��i�i�t�d�|�d�t�ƒƒ�}�y�|�i�|�ƒ�Wn�t�j �o�n�X|��i�i�t�|�ƒ�|��i�i�t�t�i�|�d�ƒ�d�|�ƒ|�i�ƒ��d�}�|��i�i �|�ƒ�o�|��i�|�=n�Wn7�t!�j �o+�}�|�o�|�i#�ƒ��n�t$�|�d�‚�n�Xd�S(���s(���Remove an entire table from the databasei���R1���Rj���N(%���R2���R1���R���RC���RR���R3���Rw���R#���R!���Ra���Rb���R)���t ���table_keyR¶���Rd���Re���Rh���R���R,���RZ���RU���Rr���Rs���R.���Rt���Ru���t���removeRo���RT���RV���RX���RY���RS���Rx���Ry���RW���R���( ���R���R!���Rd���R1���Rb���R»���Ru���Ry���Re���(����(����R���t���Drop{��sT��������� '% (���R���R���R ���R[���RZ���R_���R`���Ri���Rz���R}���R���R†���R…���R˜���Rž���R£���R¤���R¦���RŸ���R½���(����(����(����R���R0���ƒ���s$���/ ) 4 (0( q(#���t���_cvsidR���R›���Rƒ���RŠ���R���t���typesRm���R{���t���cPickleRU���t ���bsddb3.dbt���ImportErrort���bsddb.dbt ���StandardErrorR���R���R���R���R���R���R���R.���R"���R#���R$���R*���R·���R'���R(���R)���R+���R,���R/���R0���(���R+���R���R���R.���R)���R/���R{���R"���R¾���R*���R���R���R���R���RŠ���R›���R#���R'���Rm���R·���R$���Rƒ���R���R0���R(���R���R,���R���RU���(����(����R���t���?���s>���