def get_connection(user=None, password=None): global vtgate_port timeout = 10.0 return vtgatev3.connect("localhost:%s" % (vtgate_port), timeout, user=user, password=password)
def main(): print "Content-Type: application/json\n" try: conn = vtgatev3.connect("localhost:12345", 10.0) cursor = conn.cursor("master") args = cgi.FieldStorage() query = args.getvalue("query") response = {} try: queries = [] stats = capture_log(12345, queries) time.sleep(0.25) exec_query(cursor, "result", query, response) finally: stats.terminate() time.sleep(0.25) response["queries"] = queries exec_query(cursor, "user0", "select * from user where keyrange('','\x80')", response) exec_query(cursor, "user1", "select * from user where keyrange('\x80', '')", response) exec_query(cursor, "user_extra0", "select * from user_extra where keyrange('','\x80')", response) exec_query(cursor, "user_extra1", "select * from user_extra where keyrange('\x80', '')", response) exec_query(cursor, "music0", "select * from music where keyrange('','\x80')", response) exec_query(cursor, "music1", "select * from music where keyrange('\x80', '')", response) exec_query(cursor, "music_extra0", "select * from music_extra where keyrange('','\x80')", response) exec_query(cursor, "music_extra1", "select * from music_extra where keyrange('\x80', '')", response) exec_query(cursor, "user_idx", "select * from user_idx", response) exec_query(cursor, "name_user_idx", "select * from name_user_idx", response) exec_query(cursor, "music_user_idx", "select * from music_user_idx", response) print json.dumps(response) except Exception as e: print json.dumps({"error": str(e)})
def main(): print "Content-Type: application/json\n" try: conn = vtgatev3.connect("localhost:15009", 10.0) cursor = conn.cursor("master") args = cgi.FieldStorage() query = args.getvalue("query") response = {} try: queries = [] user0 = capture_log("user0", 15003, queries) user1 = capture_log("user1", 15005, queries) lookup = capture_log("lookup", 15007, queries) time.sleep(0.25) exec_query(cursor, "result", query, response) finally: user0.terminate() user1.terminate() lookup.terminate() time.sleep(0.25) response["queries"] = queries exec_query(cursor, "user0", "select * from user where keyrange('','\x80')", response) exec_query(cursor, "user1", "select * from user where keyrange('\x80', '')", response) exec_query(cursor, "user_extra0", "select * from user_extra where keyrange('','\x80')", response) exec_query(cursor, "user_extra1", "select * from user_extra where keyrange('\x80', '')", response) exec_query(cursor, "music0", "select * from music where keyrange('','\x80')", response) exec_query(cursor, "music1", "select * from music where keyrange('\x80', '')", response) exec_query(cursor, "music_extra0", "select * from music_extra where keyrange('','\x80')", response) exec_query(cursor, "music_extra1", "select * from music_extra where keyrange('\x80', '')", response) exec_query(cursor, "user_idx", "select * from user_idx", response) exec_query(cursor, "name_user_idx", "select * from name_user_idx", response) exec_query(cursor, "music_user_idx", "select * from music_user_idx", response) print json.dumps(response) except Exception as e: print json.dumps({"error": str(e)})
def get_connection(user=None, password=None): timeout = 10.0 return vtgatev3.connect(utils.vtgate.addr(), timeout, user=user, password=password)