<s> import sys <EOL> import os <EOL> APPSCALE_HOME = os . environ . get ( "<STR_LIT>" ) <EOL> if APPSCALE_HOME : <EOL> pass <EOL> else : <EOL> print "<STR_LIT>" <EOL> APPSCALE_HOME = "<STR_LIT>" <EOL> sys . path . append ( APPSCALE_HOME + "<STR_LIT>" ) <EOL> import pyodbc <EOL> import MySQLdb <EOL> import _mysql <EOL> import socket <EOL> import py_timesten <EOL> ROW_KEY = "<STR_LIT>" <EOL> USER_TABLE = "<STR_LIT>" <EOL> APPS_TABLE = "<STR_LIT>" <EOL> SLAVES_FILE = APPSCALE_HOME + "<STR_LIT>" <EOL> DB_CONN_STR = "<STR_LIT>" <EOL> DEBUG_PRINT_SQL = False <EOL> TT_ERROR = "<STR_LIT>" <EOL> def set_db_location ( ) : <EOL> global DB_CONN_STR <EOL> file = open ( SLAVES_FILE , "<STR_LIT:r>" ) <EOL> DB_CONN_STR = file . readline ( ) <EOL> file . close ( ) <EOL> def drop_all ( ) : <EOL> try : <EOL> client = pyodbc . connect ( DB_CONN_STR ) <EOL> cursor = client . cursor ( ) <EOL> if ( py_timesten . __table_exist ( USER_TABLE ) == <NUM_LIT:1> ) : <EOL> cursor . execute ( "<STR_LIT>" + USER_TABLE ) <EOL> if DEBUG_PRINT_SQL : print "<STR_LIT>" + USER_TABLE <EOL> client . commit ( ) <EOL> if ( py_timesten . __table_exist ( APPS_TABLE ) == <NUM_LIT:1> ) : <EOL> cursor . execute ( "<STR_LIT>" + APPS_TABLE ) <EOL> if DEBUG_PRINT_SQL : print "<STR_LIT>" + APPS_TABLE <EOL> client . commit ( ) <EOL> cursor . execute ( "<STR_LIT>" ) <EOL> list = [ ] <EOL> for row in cursor : <EOL> list += [ row [ <NUM_LIT:0> ] ] <EOL> for ii in range ( <NUM_LIT:0> , len ( list ) ) : <EOL> if ( py_timesten . __table_exist ( list [ ii ] ) == <NUM_LIT:1> ) : <EOL> cursor . execute ( "<STR_LIT>" + list [ ii ] ) <EOL> if DEBUG_PRINT_SQL : print "<STR_LIT>" + list [ ii ] <EOL> client . commit ( ) <EOL> except pyodbc . Error , e : <EOL> print e . args [ <NUM_LIT:0> ] <EOL> print TT_ERROR + "<STR_LIT>" <EOL> return <NUM_LIT:0> <EOL> return <NUM_LIT:1> <EOL> if drop_all ( ) == <NUM_LIT:0> : <EOL> print "<STR_LIT>" <EOL> exit ( <NUM_LIT:1> ) </s>
