Commit e14bf0d7 authored by yiwenshao's avatar yiwenshao

modify big_proxy and micro_db_init_int to be able to specify ip and db

parent 5f9a77e1
int main(){
return 0;
}
...@@ -9,7 +9,13 @@ main(int argc,char ** argv) { ...@@ -9,7 +9,13 @@ main(int argc,char ** argv) {
"use micro_db;", "use micro_db;",
"create table int_table(id integer);", "create table int_table(id integer);",
}; };
big_proxy b; if(argc!=3){
std::cout<<"1:db, 2:ip"<<std::endl;
return 0;
}
std::string db = std::string(argv[1]);
std::string ip = std::string(argv[2]);
big_proxy b("tdb","127.0.0.1","root","letmein",3306);
for(auto item:create){ for(auto item:create){
b.go(item); b.go(item);
} }
......
#include "big_proxy.hh" #include "main/big_proxy.hh"
using std::string; using std::string;
int int
main(int argc,char ** argv) { main(int argc,char ** argv) {
......
...@@ -7,7 +7,7 @@ CRYPTDB_SRCS := schema.cc Translator.cc Connect.cc \ ...@@ -7,7 +7,7 @@ CRYPTDB_SRCS := schema.cc Translator.cc Connect.cc \
rewrite_func.cc rewrite_sum.cc metadata_tables.cc \ rewrite_func.cc rewrite_sum.cc metadata_tables.cc \
error.cc stored_procedures.cc rewrite_ds.cc rewrite_main.cc big_proxy.cc error.cc stored_procedures.cc rewrite_ds.cc rewrite_main.cc big_proxy.cc
CRYPTDB_PROGS:= cdb_test load_and_store test_layer test_schema test_proxy change_test insert_conf_onion CRYPTDB_PROGS:= cdb_test load_and_store test_layer test_schema change_test insert_conf_onion
CRYPTDBPROGOBJS := $(patsubst %,$(OBJDIR)/main/%,$(CRYPTDB_PROGS)) CRYPTDBPROGOBJS := $(patsubst %,$(OBJDIR)/main/%,$(CRYPTDB_PROGS))
......
...@@ -148,12 +148,12 @@ void parseResType(const ResType &rd) { ...@@ -148,12 +148,12 @@ void parseResType(const ResType &rd) {
} }
} }
big_proxy::big_proxy(std::string db){ big_proxy::big_proxy(std::string db,std::string ip,std::string user,std::string passwd,int port){
client="192.168.1.1:1234"; client="192.168.1.1:1234";
//one Wrapper per user. //one Wrapper per user.
clients[client] = new WrapperState(); clients[client] = new WrapperState();
//Connect phase //Connect phase
ConnectionInfo ci("localhost", "root", "letmein",3306); ConnectionInfo ci(ip, user, passwd,port);
//const std::string master_key = "113341234"; //const std::string master_key = "113341234";
const std::string master_key = "113341234"; const std::string master_key = "113341234";
char *buffer; char *buffer;
......
...@@ -88,7 +88,8 @@ struct big_proxy{ ...@@ -88,7 +88,8 @@ struct big_proxy{
std::string client; std::string client;
std::string embeddedDir="/t/cryt/shadow"; std::string embeddedDir="/t/cryt/shadow";
big_proxy(std::string db = "tdb"); big_proxy(std::string db = "tdb",std::string ip="127.0.0.1",std::string user="root",
std::string passwd="letmein",int port=3306);
void myNext(std::string client,bool isFirst,ResType inRes); void myNext(std::string client,bool isFirst,ResType inRes);
void batchTogether(std::string client, std::string curQuery,unsigned long long _thread_id); void batchTogether(std::string client, std::string curQuery,unsigned long long _thread_id);
bool myRewrite(std::string curQuery,unsigned long long _thread_id,std::string client); bool myRewrite(std::string curQuery,unsigned long long _thread_id,std::string client);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment