@@ -0,0 +1,2353 @@
+#! /usr/bin/python%0A%0Aimport sys%0Aimport os%0Aimport shutil%0A%0Adef dbHelp():%0A    print %22Command:%22%0A    print %22%5Ctcreate DBName: create the database%22%0A    print %22%5Ctdelete DBName: delete the database%22%0A    print %22%5Ctlist: list the table infomation in the database%22%0A    print %22%5Cttranslate SQL: translate SQL into CUDA file%22%0A    print %22%5Ctexecute SQL: translate and execute given SQL on GPU%22%0A    print %22%5Ctload TableName data: load data into the given table%22%0A    print %22%5Ctexit%22%0A%0Adef dbCreate(dbName):%0A%0A    ret = 0%0A    dbTop = %22database%22%0A%0A    if not os.path.exists(dbTop):%0A        os.makedirs(dbTop)%0A%0A    dbPath = dbTop + %22/%22 + dbName%0A%0A    if os.path.exists(dbPath):%0A        return -1%0A%0A    os.makedirs(dbPath)%0A%0A    cmd = 'python XML2MapReduce/main.py ' + schemaFile%0A    ret = os.system(cmd)%0A%0A    if ret !=0 :%0A        exit(-1)%0A%0A    cmd = 'make -C src/GPUCODE/ loader &%3E /dev/null'%0A    ret = os.system(cmd)%0A%0A    if ret != 0:%0A        exit(-1)%0A%0A    cmd = 'cp src/GPUCODE/gpuDBLoader ' + dbPath%0A    ret = os.system(cmd)%0A%0A    if ret != 0:%0A        exit(-1)%0A%0A    return 0%0A%0Adef dbDelete(dbName):%0A%0A    dbTop = %22database%22%0A%0A    dbPath = dbTop + %22/%22 + dbName%0A    if os.path.exists(dbPath):%0A        shutil.rmtree(dbPath)%0A%0Aif len(sys.argv) != 2:%0A    print %22./gpudb.py schemaFile%22%0A    exit(-1)%0A%0AschemaFile = sys.argv%5B1%5D%0A%0Awhile 1:%0A    ret = 0%0A    dbCreated = 0%0A    dbName = %22%22%0A%0A    cmd = raw_input(%22%3E%22)%0A    cmdA = cmd.lstrip().rstrip().split()%0A%0A    if len(cmdA) == 0:%0A        continue%0A%0A    if cmdA%5B0%5D.upper() == %22HELP%22:%0A        dbHelp()%0A%0A    elif cmdA%5B0%5D.upper() == %22?%22:%0A        dbHelp()%0A%0A    elif cmdA%5B0%5D.upper() == %22EXIT%22:%0A        break%0A%0A    elif cmdA%5B0%5D.upper() == %22CREATE%22:%0A%0A        if dbCreated !=0:%0A            print %22Already created database. Delete first.%22%0A            continue%0A%0A%0A        if len(cmdA) !=2:%0A            print %22usage: create DBName%22%0A%0A        else:%0A            ret = dbCreate(cmdA%5B1%5D.upper())%0A            if ret == -1:%0A                print cmdA%5B1%5D + %22 already exists%22%0A            else:%0A                dbCreated = 1%0A                dbName = cmdA%5B1%5D.upper()%0A                print cmdA%5B1%5D + %22 has been successfully created%22%0A                %0A%0A%0A    elif cmdA%5B0%5D.upper() == %22DELETE%22:%0A        if len(cmdA) !=2:%0A            print %22usage: delete DBName%22%0A%0A        dbCreated = 0%0A        dbDelete(cmdA%5B1%5D.upper())%0A%0A    else:%0A        print %22Unknown command%22%0A%0Aos.system(%22clear%22)%0A%0A

add a wrapper, not finished yet