<s> import sys <EOL> import argparse <EOL> import buprivate <EOL> import MySQLdb <EOL> def main ( ) : <EOL> """<STR_LIT>""" <EOL> parser = argparse . ArgumentParser ( description = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" , type = int ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" , required = False , default = '<STR_LIT:.>' ) <EOL> result = parser . parse_args ( ) <EOL> cmdstr = "<STR_LIT>" % ( buprivate . user , buprivate . dbpasswd , result . database , result . table , result . outputdir , result . database , result . table ) <EOL> print cmdstr <EOL> conn = MySQLdb . connect ( host = "<STR_LIT:localhost>" , <EOL> user = buprivate . user , <EOL> passwd = buprivate . dbpasswd , <EOL> db = result . database ) <EOL> sql = "<STR_LIT>" % result . table <EOL> cursor = conn . cursor ( ) <EOL> try : <EOL> cursor . execute ( sql ) <EOL> except MySQLdb . Error , e : <EOL> print "<STR_LIT>" % ( e . args [ <NUM_LIT:0> ] , e . args [ <NUM_LIT:1> ] , sql ) <EOL> sys . exit ( - <NUM_LIT:1> ) <EOL> row = cursor . fetchone ( ) <EOL> if ( row [ <NUM_LIT:0> ] == None ) : <EOL> print "<STR_LIT>" <EOL> sys . exit ( - <NUM_LIT:1> ) <EOL> else : <EOL> maxzidx = int ( row [ <NUM_LIT:0> ] ) <EOL> curzidx = <NUM_LIT:0> <EOL> stride = <NUM_LIT> << result . partition_size_bits <EOL> while curzidx < maxzidx : <EOL> cmdstr = "<STR_LIT>" % ( buprivate . user , buprivate . dbpasswd , result . database , result . table , str ( curzidx ) , str ( curzidx + stride ) , result . outputdir , result . database , result . table , curzidx ) <EOL> print cmdstr <EOL> curzidx += stride <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
