Commit 0ee22c25 authored by yiwenshao's avatar yiwenshao

able to specify db and table, to be tested. and also, ASHE should be stronger

parent 88b96d60
...@@ -252,6 +252,10 @@ main(int argc, char* argv[]){ ...@@ -252,6 +252,10 @@ main(int argc, char* argv[]){
init(); init();
create_embedded_thd(0); create_embedded_thd(0);
std::string db="tdb",table="student"; std::string db="tdb",table="student";
if(argc==3){
db = std::string(argv[1]);
table = std::string(argv[2]);
}
std::unique_ptr<SchemaInfo> schema = myLoadSchemaInfo(embeddedDir); std::unique_ptr<SchemaInfo> schema = myLoadSchemaInfo(embeddedDir);
schema.get(); schema.get();
......
...@@ -47,6 +47,7 @@ std::string getTestQuery(SchemaInfo &schema, std::vector<FieldMetaTrans> &tfds, ...@@ -47,6 +47,7 @@ std::string getTestQuery(SchemaInfo &schema, std::vector<FieldMetaTrans> &tfds,
res += item; res += item;
res += " , "; res += " , ";
} }
//actually the salt should be selected if RND is used,this should be changed later.
if(tf.getHasSalt()){ if(tf.getHasSalt()){
res += tf.getSaltName() + " , "; res += tf.getSaltName() + " , ";
} }
...@@ -82,10 +83,13 @@ static void store(std::string db, std::string table){ ...@@ -82,10 +83,13 @@ static void store(std::string db, std::string table){
res.push_back(ft); res.push_back(ft);
res.back().trans(fms[i]); res.back().trans(fms[i]);
} }
/*this is our strategy, each field should be able to choose the selected onion*/
storeStrategies(res); storeStrategies(res);
//generate the backup query and then fetch the tuples //generate the backup query and then fetch the tuples
std::string backup_query = getTestQuery(*schema,res,db,table); std::string backup_query = getTestQuery(*schema,res,db,table);
rawMySQLReturnValue resraw = executeAndGetResultRemote(globalConn,backup_query); rawMySQLReturnValue resraw = executeAndGetResultRemote(globalConn,backup_query);
//then we should set the type and length of FieldMetaTrans //then we should set the type and length of FieldMetaTrans
...@@ -102,19 +106,24 @@ static void store(std::string db, std::string table){ ...@@ -102,19 +106,24 @@ static void store(std::string db, std::string table){
} }
item.setChoosenFieldTypes(tempTypes); item.setChoosenFieldTypes(tempTypes);
item.setChoosenFieldLengths(tempLengths); item.setChoosenFieldLengths(tempLengths);
if(item.getHasSalt()){ if(item.getHasSalt()){//also this should be changed.
item.setSaltType(types[base_types++]); item.setSaltType(types[base_types++]);
item.setSaltLength(lengths[base_lengths++]); item.setSaltLength(lengths[base_lengths++]);
} }
} }
//write the tuples into files //write the tuples into files
write_raw_data_to_files(resraw,res,db,table); write_raw_data_to_files(resraw,res,db,table);
} }
int int
main(int argc, char* argv[]){ main(int argc, char* argv[]){
init(); init();
std::string db="tdb",table="student"; std::string db="tdb",table="student";
if(argc==3){
db = std::string(argv[1]);
table = std::string(argv[2]);
}
store(db,table); store(db,table);
return 0; return 0;
} }
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