#NEWLINE# def migrate_blob_db( old_db_dir , new_db_dir ) : #NEWLINE# #INDENT# old_blob_db_path = os . path . join ( old_db_dir , 'blobs.db' ) #NEWLINE# if ( not os . path . exists ( old_blob_db_path ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# old_db = leveldb . LevelDB ( old_blob_db_path ) #NEWLINE# new_db_conn = sqlite3 . connect ( os . path . join ( new_db_dir , 'blobs.db' ) ) #NEWLINE# c = new_db_conn . cursor ( ) #NEWLINE# c . execute ( ( ( ( ( 'create table if not exists blobs (' + '    blob_hash text primary key, ' ) + '    blob_length integer, ' ) + '    last_verified_time real, ' ) + '    next_announce_time real)' ) ) #NEWLINE# new_db_conn . commit ( ) #NEWLINE# c = new_db_conn . cursor ( ) #NEWLINE# for ( blob_hash , blob_info ) in old_db . RangeIter ( ) : #NEWLINE# #INDENT# ( blob_length , verified_time , announce_time ) = json . loads ( blob_info ) #NEWLINE# c . execute ( 'insert into blobs values (?, ?, ?, ?)' , ( blob_hash , blob_length , verified_time , announce_time ) ) #NEWLINE# #UNINDENT# new_db_conn . commit ( ) #NEWLINE# new_db_conn . close ( )