Commit df10bf62 authored by Casualet's avatar Casualet

clean std::cout

parent 9dcd9f88
This diff is collapsed.
......@@ -540,7 +540,6 @@ bool CreateDelta::apply(const std::unique_ptr<Connect> &e_conn,
" '" + esc_serial_key + "',"
" " + std::to_string(parent_id) + ","
" " + std::to_string(old_object_id.get()) + ");";
std::cout<<"query in writedelta:"<<query<<std::endl;
RETURN_FALSE_IF_FALSE(e_conn->execute(query));
const unsigned int object_id = e_conn->last_insert_id();
......@@ -675,7 +674,6 @@ deltaOutputBeforeQuery(const std::unique_ptr<Connect> &e_conn,
" (SELECT DATABASE()), FALSE,"
" '" + TypeText<CompletionType>::toText(completion_type) + "'"
" );";
std::cout<<q_completion<<std::endl;
ROLLBACK_AND_RFIF(e_conn->execute(q_completion), e_conn);
*embedded_completion_id = e_conn->last_insert_id();
assert(*embedded_completion_id);
......
......@@ -221,14 +221,12 @@ class CreateDBHandler : public DDLHandler {
rewriteAndUpdate(Analysis &a, LEX *const lex, const Preamble &pre)
const
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
assert(a.deltas.size() == 0);
const std::string &dbname =
convert_lex_str(lex->name);
if (false == a.databaseMetaExists(dbname)) {
std::unique_ptr<DatabaseMeta> dm(new DatabaseMeta());
std::cout<<"create_db_id= : "<<dm->getDatabaseID()<<std::endl;
//可以看到, 建立数据库的时候,和建立表的时候类型, 使用了createdelta, 添加了从db到schema的映射过程.
a.deltas.push_back(std::unique_ptr<Delta>(
new CreateDelta(std::move(dm), a.getSchema(),
......@@ -240,7 +238,6 @@ class CreateDBHandler : public DDLHandler {
TEST_TextMessageError(test,
"Database " + dbname + " already exists!");
}
std::cout<<"delta_size: "<<a.deltas.size()<<std::endl;
return new DDLQueryExecutor(*copyWithTHD(lex), std::move(a.deltas));
}
};
......@@ -399,7 +396,6 @@ nextImpl(const ResType &res, const NextParams &nparams)
"deltaOutputBeforeQuery failed for DDL");
this->embedded_completion_id = embedded_completion_id;
}
std::cout<<RED_BEGIN<<"rewritten DDL: "<<this->new_query<<COLOR_END<<std::endl;
return CR_QUERY_AGAIN(this->new_query);
}
TEST_ErrPkt(res.success(), "DDL query failed");
......
......@@ -56,7 +56,6 @@ void rewriteInsertHelper(const Item &i, const FieldMeta &fm, Analysis &a,
//这里先做lookup, 找到类以后调用内部的结果, 试试
//对于普通的student操作, 最后调用的是ANON的typical_rewrite_insert_type来进行重写.
itemTypes.do_rewrite_insert(i, fm, a, &l);
std::cout<<"size after do_rewrite_insert: "<<l.size()<<std::endl;
for (auto it : l) {
append_list->push_back(it);
}
......@@ -166,7 +165,6 @@ class InsertHandler : public DMLHandler {
// -----------------
if (lex->many_values.head()) {
//开始处理many values
std::cout<<"start many values"<<std::endl;
auto it = List_iterator<List_item>(lex->many_values);
List<List_item> newList;
for (;;) {
......@@ -187,14 +185,13 @@ class InsertHandler : public DMLHandler {
//li指向了lex->many_values的迭代内容
auto it0 = List_iterator<Item>(*li);
auto fmVecIt = fmVec.begin();
int lnum=0;
for (;;) {
const Item *const i = it0++;
assert(!!i == (fmVec.end() != fmVecIt));
if (!i) {
break;
}
std::cout<<"c"<<lnum++<<std::endl;
//获得values中的内容,并且通过fieldMeta好帮助完成rewrite工作
//每个field都要进行洋葱的加密.
rewriteInsertHelper(*i, **fmVecIt, a, newList0);
......@@ -469,7 +466,6 @@ process_filters_lex(const st_select_lex &select_lex, Analysis &a)
void
process_select_lex(const st_select_lex &select_lex, Analysis &a)
{
// std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
//可以看到, 首先处理top_join_list, 是List<TABLE_LIST>类型. 其含义是join list of the top level.
//内部分别用process_table_aliases(tll, a); process_table_joins_and_derived(tll, a);两个函数处理.
//如果不是jion式的语句, 就不用管了.其内部通过递归处理nested join, 并且处理了*on*语句.
......@@ -488,10 +484,8 @@ process_select_lex(const st_select_lex &select_lex, Analysis &a)
if (!item)
break;
numOfItem++;
std::cout<<"item name in process_select_lex: "<<item->name<<std::endl;
gatherAndAddAnalysisRewritePlan(*item, a);
}
std::cout<<"numOfItem: "<<numOfItem<<std::endl;
//这里处理的是select_lex.where和select_lex.having, 通过Item类型的函数, 也就是下面那个, 为其添加
//rewriteplain. 然后再通过process_order, 对select_lex.group_list和select_lex.order_list添加
//rewritePlain
......@@ -662,21 +656,17 @@ rewrite_proj(const Item &i, const RewritePlan &rp, Analysis &a,
AssignOnce<Item *> ir;
if (i.type() == Item::Type::FIELD_ITEM) {
std::cout<<"type= "<<"FIELD_ITEM"<<std::endl;
const Item_field &field_i = static_cast<const Item_field &>(i);
const auto &cached_rewritten_i = a.item_cache.find(&field_i);
if (cached_rewritten_i != a.item_cache.end()) {
std::cout<<"used cached plain: "<<std::endl;
ir = cached_rewritten_i->second.first;
olk = cached_rewritten_i->second.second;
} else {
std::cout<<"do not use cached plain: "<<std::endl;
//对于select中的选择域来说,这里对应的是rewrite_field.cc中的83, do_rewrite_type
ir = rewrite(i, rp.es_out, a);
olk = rp.es_out.chooseOne();
}
} else {
std::cout<<"type != FIELD_ITEM"<<std::endl;
ir = rewrite(i, rp.es_out, a);
olk = rp.es_out.chooseOne();
}
......@@ -726,13 +716,11 @@ rewrite_select_lex(const st_select_lex &select_lex, Analysis &a)
if (!item)
break;
numOfItem++;
std::cout<<"itemname before: "<<item->name<<std::endl;
rewrite_proj(*item,
*constGetAssert(a.rewritePlans, item).get(),
a, &newList);
}
std::cout<<"numOfItem: "<<numOfItem<<std::endl;
// auto item_it_new =
// RiboldMYSQL::constList_iterator<Item>(newList);
// std::cout<<"rewrite#############" <<std::endl;
......@@ -1328,7 +1316,6 @@ DMLQueryExecutor::
nextImpl(const ResType &res, const NextParams &nparams)
{
reenter(this->corot) {
std::cout<<RED_BEGIN<<"rewritten DML: "<<this->query<<COLOR_END<<std::endl;
yield return CR_QUERY_AGAIN(this->query);
TEST_ErrPkt(res.success(), "DML query failed against remote database");
yield {
......@@ -1641,7 +1628,6 @@ addShowDirectiveEntry(const std::unique_ptr<Connect> &e_conn,
" ('" + database + "', '" + table + "',"
" '" + field + "', '" + onion + "', '" + level + "')";
std::cout<<"query: "<<query<<std::endl;
return e_conn->execute(query);
}
......@@ -1721,7 +1707,6 @@ nextImpl(const ResType &res, const NextParams &nparams)
std::pair<AbstractQueryExecutor::ResultType, AbstractAnything *>
ShowCreateTableExecutor::
nextImpl(const ResType &res, const NextParams &nparams){
std::cout<<"showCreateTableExecutor"<<std::endl;
//return CR_QUERY_AGAIN(nparams.original_query);
reenter(this->corot) {
yield return CR_QUERY_AGAIN(this->query);
......
......@@ -91,7 +91,6 @@ static bool
sanityCheck(TableMeta &tm)
{
for (const auto &it : tm.getChildren()) {
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
const auto &fm = it.second;
assert(sanityCheck(*fm.get()));
}
......@@ -122,7 +121,6 @@ static std::map<std::string, int>
collectTableNames(const std::string &db_name,
const std::unique_ptr<Connect> &c)
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
std::map<std::string, int> name_map;
assert(c->execute("USE " + quoteText(db_name)));
......@@ -152,7 +150,6 @@ tablesSanityCheck(SchemaInfo &schema,
{
for (const auto &dm_it : schema.getChildren()) {
const auto &db_name = dm_it.first.getValue();
std::cout<<"db_name: "<<db_name<<std::endl;
const auto &dm = dm_it.second;
// gather anonymous tables
std::map<std::string, int> anon_name_map =
......@@ -206,14 +203,12 @@ collectRecoveryDetails(const std::unique_ptr<Connect> &conn,
unsigned long unfinished_id,
std::unique_ptr<RecoveryDetails> *details)
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
// collect completion data
std::unique_ptr<DBResult> dbres;
const std::string &embedded_completion_q =
" SELECT complete, original_query, rewritten_query, default_db FROM " +
MetaData::Table::embeddedQueryCompletion() +
" WHERE id = " + std::to_string(unfinished_id) + ";";
std::cout<<"query: "<<embedded_completion_q<<std::endl;
RETURN_FALSE_IF_FALSE(e_conn->execute(embedded_completion_q, &dbres));
assert(mysql_num_rows(dbres->n) == 1);
......@@ -228,7 +223,6 @@ collectRecoveryDetails(const std::unique_ptr<Connect> &conn,
" SELECT COUNT(*) FROM " + MetaData::Table::remoteQueryCompletion() +
" WHERE embedded_completion_id = " +
std::to_string(unfinished_id) + ";";
std::cout<<"query: "<<remote_completion_q<<std::endl;
RETURN_FALSE_IF_FALSE(conn->execute(remote_completion_q, &dbres));
assert(1 == mysql_num_rows(dbres->n));
......@@ -258,12 +252,10 @@ static bool
abortQuery(const std::unique_ptr<Connect> &e_conn,
unsigned long unfinished_id)
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
const std::string update_aborted =
" UPDATE " + MetaData::Table::embeddedQueryCompletion() +
" SET aborted = TRUE"
" WHERE id = " + std::to_string(unfinished_id) + ";";
std::cout<<"query: "<<update_aborted<<std::endl;
RETURN_FALSE_IF_FALSE(e_conn->execute("START TRANSACTION"));
ROLLBACK_AND_RFIF(setBleedingTableToRegularTable(e_conn), e_conn);
ROLLBACK_AND_RFIF(e_conn->execute(update_aborted), e_conn);
......@@ -276,13 +268,11 @@ static bool
finishQuery(const std::unique_ptr<Connect> &e_conn,
unsigned long unfinished_id)
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
const std::string update_completed =
" UPDATE " + MetaData::Table::embeddedQueryCompletion() +
" SET complete = TRUE"
" WHERE id = " + std::to_string(unfinished_id) + ";";
std::cout<<"query: "<<update_completed<<std::endl;
RETURN_FALSE_IF_FALSE(e_conn->execute("START TRANSACTION"));
ROLLBACK_AND_RFIF(setRegularTableToBleedingTable(e_conn), e_conn);
ROLLBACK_AND_RFIF(e_conn->execute(update_completed), e_conn);
......@@ -297,7 +287,6 @@ fixAdjustOnion(const std::unique_ptr<Connect> &conn,
const std::unique_ptr<Connect> &e_conn,
unsigned long unfinished_id)
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
std::unique_ptr<RecoveryDetails> details;
RETURN_FALSE_IF_FALSE(
collectRecoveryDetails(conn, e_conn, unfinished_id, &details));
......@@ -375,7 +364,6 @@ enum class QueryStatus {UNKNOWN_ERROR, MALFORMED_QUERY, SUCCESS,
static QueryStatus
retryQuery(const std::unique_ptr<Connect> &c, const std::string &query)
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
if (true == c->execute(query)) {
return QueryStatus::SUCCESS;
}
......@@ -407,7 +395,6 @@ fixDDL(const std::unique_ptr<Connect> &conn,
const std::unique_ptr<Connect> &e_conn,
unsigned long unfinished_id)
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
std::unique_ptr<RecoveryDetails> details;
RETURN_FALSE_IF_FALSE(
collectRecoveryDetails(conn, e_conn, unfinished_id, &details));
......@@ -506,7 +493,6 @@ deltaSanityCheck(const std::unique_ptr<Connect> &conn,
" SELECT id, type FROM " + embedded_completion +
" WHERE complete = FALSE AND aborted != TRUE;";
//std::cout<<"query in deltaSanityCheck to find unfinished deltas: "<<unfinished_deltas<<__LINE__<<":"<<__FILE__<<std::endl;
RETURN_FALSE_IF_FALSE(e_conn->execute(unfinished_deltas, &dbres));
......@@ -523,7 +509,6 @@ deltaSanityCheck(const std::unique_ptr<Connect> &conn,
return false;
}
std::cout<<GREEN_BEGIN<<"We do reach here!!!!!"<<unfinished_count<<__LINE__<<":"<<__FILE__<<std::endl;
const MYSQL_ROW row = mysql_fetch_row(dbres->n);
const unsigned long *const l = mysql_fetch_lengths(dbres->n);
......@@ -900,11 +885,9 @@ std::pair<std::vector<std::unique_ptr<Delta> >,
adjustOnion(const Analysis &a, onion o, const TableMeta &tm,
const FieldMeta &fm, SECLEVEL tolevel)
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
TEST_Text(tolevel >= a.getOnionMeta(fm, o).getMinimumSecLevel(),
"your query requires to permissive of a security level");
std::cout << GREEN_BEGIN << "onion: " << TypeText<onion>::toText(o) << COLOR_END << std::endl;
// Make a copy of the onion meta for the purpose of making
// modifications during removeOnionLayer(...)
OnionMetaAdjustor om_adjustor(*fm.getOnionMeta(o));
......@@ -1355,8 +1338,6 @@ Rewriter::dispatchOnLex(Analysis &a, const std::string &query)
executor = handler.transformLex(a, lex);
} catch (OnionAdjustExcept e) {
LOG(cdb_v) << "caught onion adjustment";
std::cout << GREEN_BEGIN << "Adjusting onion!" << COLOR_END
<< std::endl;
//We use deltas to remove layers in the metadata, and queyrs to decrypt data.
std::pair<std::vector<std::unique_ptr<Delta> >,
......@@ -1411,7 +1392,6 @@ Rewriter::rewrite(const std::string &q, const SchemaInfo &schema,
AbstractQueryExecutor *const executor =
Rewriter::dispatchOnLex(analysis, q);
if (!executor) {
std::cout<<"we return noopexecutor here"<<__FILE__<<":"<<__LINE__<<std::endl;
return QueryRewrite(true, analysis.rmeta, analysis.kill_zone,
new NoOpExecutor());
}
......
......@@ -34,7 +34,6 @@ rewrite_agg_args(const Item_sum &oldi, const OLK &constr,
const RewritePlanOneOLK &rp, Analysis &a,
int no_args = -1)
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<"AAAAAAAAAAAAAAAAA"<<std::endl;
if (no_args >= 0) {
TEST_BadItemArgumentCount(oldi.type(), no_args,
RiboldMYSQL::get_arg_count(oldi));
......@@ -66,7 +65,6 @@ class CItemCount : public CItemSubtypeST<Item_sum_count, SFT> {
virtual RewritePlan *
do_gather_type(const Item_sum_count &i, Analysis &a) const
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<"AAAAAAAAAAAAAAAAA"<<std::endl;
const unsigned int arg_count =
RiboldMYSQL::get_arg_count(i);
TEST_BadItemArgumentCount(i.type(), 1, arg_count);
......@@ -95,7 +93,6 @@ class CItemCount : public CItemSubtypeST<Item_sum_count, SFT> {
do_rewrite_type(const Item_sum_count &i, const OLK &constr,
const RewritePlan &rp, Analysis &a) const
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<"AAAAAAAAAAAA"<<std::endl;
std::list<Item *> args =
rewrite_agg_args(i, constr,
static_cast<const RewritePlanOneOLK &>(rp),
......@@ -116,7 +113,6 @@ class CItemChooseOrder : public CItemSubtypeST<Item_sum_hybrid, SFT> {
virtual RewritePlan *
do_gather_type(const Item_sum_hybrid &i, Analysis &a) const
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<"AAAAAAAAAA"<<std::endl;
const unsigned int arg_count = RiboldMYSQL::get_arg_count(i);
TEST_BadItemArgumentCount(i.type(), 1, arg_count);
const Item *const child = RiboldMYSQL::get_arg(i, 0);
......@@ -138,7 +134,6 @@ class CItemChooseOrder : public CItemSubtypeST<Item_sum_hybrid, SFT> {
do_rewrite_type(const Item_sum_hybrid &i, const OLK &constr,
const RewritePlan &rp, Analysis &a) const
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<"AAAAAAAAAA"<<std::endl;
std::list<Item *> args =
rewrite_agg_args(i, constr,
static_cast<const RewritePlanOneOLK &>(rp),
......@@ -155,7 +150,6 @@ class CItemSum : public CItemSubtypeST<Item_sum_sum, SFT> {
virtual RewritePlan *
do_gather_type(const Item_sum_sum &i, Analysis &a) const
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<"AAAAAAAAA"<<std::endl;
LOG(cdb_v) << "gather Item_sum_sum " << i << std::endl;
const unsigned int arg_count = RiboldMYSQL::get_arg_count(i);
......@@ -184,7 +178,6 @@ class CItemSum : public CItemSubtypeST<Item_sum_sum, SFT> {
do_rewrite_type(const Item_sum_sum &i, const OLK &constr,
const RewritePlan &rp, Analysis &a) const
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<"AAAAAAAAA"<<std::endl;
auto rp_wc = static_cast<const RewritePlanWithChildren &>(rp);
assert(rp_wc.childr_rp.size() == 1);
......@@ -230,7 +223,6 @@ static class ANON : public CItemSubtypeST<Item_sum_bit, Item_sum::Sumfunctype::S
virtual RewritePlan *
do_gather_type(const Item_sum_bit &i, Analysis &a) const
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<"AAAAAAAA"<<std::endl;
/* LOG(cdb_v) << "do_a_t Item_sum_bit reason " << tr;
analyze(i->get_arg(0), reason(EMPTY_EncSet, "bitagg", i, &tr, false), a);
return tr.encset;
......@@ -243,7 +235,6 @@ static class ANON : public CItemSubtypeST<Item_func_group_concat, Item_sum::Sumf
virtual RewritePlan *
do_gather_type(const Item_func_group_concat &i, Analysis &a) const
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<"AAAAAAAAA"<<std::endl;
/* LOG(cdb_v) << "do_a_t Item_func_group reason " << tr;
uint arg_count_field = i->*rob<Item_func_group_concat, uint,
&Item_func_group_concat::arg_count_field>::ptr();
......@@ -264,7 +255,6 @@ static class ANON : public CItemSubtypeIT<Item_ref, Item::Type::REF_ITEM> {
virtual RewritePlan *
do_gather_type(const Item_ref &i, Analysis &a) const
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<"AAAAAAAAA"<<std::endl;
std::vector<std::shared_ptr<RewritePlan> >
childr_rp({std::shared_ptr<RewritePlan>(gather(**i.ref, a))});
......@@ -281,7 +271,6 @@ static class ANON : public CItemSubtypeIT<Item_ref, Item::Type::REF_ITEM> {
do_rewrite_type(const Item_ref &i, const OLK &constr,
const RewritePlan &rp, Analysis &a) const
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<"AAAAAAAA"<<std::endl;
const std::string &db_name = a.getDatabaseName();
// SUPPORT
TEST_Text(Item::Type::FIELD_ITEM == (*i.ref)->type(),
......@@ -305,7 +294,6 @@ static class ANON : public CItemSubtypeIT<Item_null, Item::Type::NULL_ITEM> {
virtual RewritePlan *
do_gather_type(const Item_null &i, Analysis &a) const
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<"AAAAAAAAA"<<std::endl;
const std::string why = "is null";
reason rsn(FULL_EncSet, why, i);
return new RewritePlan(FULL_EncSet, rsn);
......@@ -315,7 +303,6 @@ static class ANON : public CItemSubtypeIT<Item_null, Item::Type::NULL_ITEM> {
do_rewrite_type(const Item_null &i, const OLK &constr,
const RewritePlan &rp, Analysis &a) const
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<"AAAAAAAA"<<std::endl;
return RiboldMYSQL::clone_item(i);
}
......@@ -323,7 +310,6 @@ static class ANON : public CItemSubtypeIT<Item_null, Item::Type::NULL_ITEM> {
do_rewrite_insert_type(const Item_null &i, const FieldMeta &fm,
Analysis &a, std::vector<Item *> *l) const
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<"AAAAAAAAAA"<<std::endl;
for (uint j = 0; j < fm.getChildren().size(); ++j) {
l->push_back(RiboldMYSQL::clone_item(i));
}
......
......@@ -34,7 +34,6 @@ rewrite(const Item &i, const EncSet &req_enc, Analysis &a) {
TABLE_LIST *
rewrite_table_list(const TABLE_LIST * const t, const Analysis &a) {
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
// Table name can only be empty when grouping a nested join.
assert(t->table_name || t->nested_join);
if (t->table_name) {
......@@ -46,7 +45,6 @@ rewrite_table_list(const TABLE_LIST * const t, const Analysis &a) {
TEST_DatabaseDiscrepancy(t->db, a.getDatabaseName());
const std::string anon_name =
a.translateNonAliasPlainToAnonTableName(t->db, plain_name);
std::cout<<"table name: "<<plain_name<<"anno: "<<anon_name<<std::endl;
return rewrite_table_list(t, anon_name);
} else {
return copyWithTHD(t);
......@@ -57,7 +55,6 @@ TABLE_LIST *
rewrite_table_list(const TABLE_LIST * const t,
const std::string &anon_name)
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
TABLE_LIST *const new_t = copyWithTHD(t);
new_t->table_name = make_thd_string(anon_name);
new_t->table_name_length = anon_name.size();
......@@ -76,7 +73,6 @@ SQL_I_List<TABLE_LIST>
rewrite_table_list(const SQL_I_List<TABLE_LIST> &tlist, Analysis &a,
bool if_exists)
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
if (!tlist.elements) {
return SQL_I_List<TABLE_LIST>();
}
......@@ -115,7 +111,6 @@ rewrite_table_list(const SQL_I_List<TABLE_LIST> &tlist, Analysis &a,
List<TABLE_LIST>
rewrite_table_list(List<TABLE_LIST> tll, Analysis &a) {
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
List<TABLE_LIST> * const new_tll = new List<TABLE_LIST>();
List_iterator<TABLE_LIST> join_it(tll);
......@@ -253,9 +248,8 @@ rewrite_create_field(const FieldMeta * const fm,
// Restore the default to the original Create_field parameter.
f->def = save_def;
for(auto item:output_cfields){
std::cout<<RED_BEGIN<<item->field_name<<":"<<item->sql_type<<COLOR_END<<std::endl;
}
//for(auto item:output_cfields){
//}
return output_cfields;
}
......@@ -663,11 +657,8 @@ void
encrypt_item_all_onions(const Item &i, const FieldMeta &fm,
uint64_t IV, Analysis &a, std::vector<Item*> *l)
{
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
int numOfOnion = 0;
for (auto it : fm.orderedOnionMetas()) {
numOfOnion++;
std::cout<<"l size: "<<l->size()<<std::endl;
const onion o = it.first->getValue();
OnionMeta * const om = it.second;
//一个fieldmeta表示一个field, 内部的不同洋葱表现在onionMeta,每个onionMeta的不同层次表现
......@@ -675,14 +666,12 @@ std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std
//枚举的洋葱类型.
l->push_back(encrypt_item_layers(i, o, *om, a, IV));
}
std::cout<<"numOfOnions: "<<numOfOnion<<std::endl;
}
void
typical_rewrite_insert_type(const Item &i, const FieldMeta &fm,
Analysis &a, std::vector<Item *> *l) {
std::cout<<__PRETTY_FUNCTION__<<":"<<__LINE__<<":"<<__FILE__<<":"<<__LINE__<<std::endl<<std::endl;
const uint64_t salt = fm.getHasSalt() ? randomValue() : 0;
......
......@@ -36,7 +36,6 @@ DBMeta::doFetchChildren(const std::unique_ptr<Connect> &e_conn,
" WHERE " + table_name + ".parent_id"
" = " + parent_id + ";";
//all the metadata are fetched here.
//std::cout<<serials_query<<"serial query:"<<std::endl;
TEST_TextMessageError(e_conn->execute(serials_query, &db_res),
"doFetchChildren query failed");
MYSQL_ROW row;
......@@ -91,7 +90,6 @@ std::unique_ptr<OnionMeta>
OnionMeta::deserialize(unsigned int id, const std::string &serial)
{
assert(id != 0);
//std::cout<<"string before unserialize: "<<serial<<std::endl;
const auto vec = unserialize_string(serial);
//OnionMeta序列化的结果有三个.
assert(3 == vec.size());
......@@ -116,7 +114,6 @@ std::string OnionMeta::serialize(const DBObject &parent) const
serialize_string(this->onionname) +
serialize_string(std::to_string(this->uniq_count)) +
serialize_string(TypeText<SECLEVEL>::toText(this->minimum_seclevel));
std::cout<<"onionmeta serialize: "<<serial<<std::endl;
return serial;
}
......@@ -289,12 +286,10 @@ init_onions_layout(const AES_KEY *const m_key, FieldMeta *const fm,
const onionlayout onion_layout = fm->getOnionLayout();
if (fm->getHasSalt() != (static_cast<bool>(m_key)
&& PLAIN_ONION_LAYOUT != onion_layout)) {
std::cout<<"unable to get salt?"<<std::endl;
return false;
}
if (0 != fm->getChildren().size()) {
std::cout<<"already has children"<<std::endl;
return false;
}
......@@ -356,7 +351,6 @@ std::string FieldMeta::serialize(const DBObject &parent) const
serialize_string(std::to_string(counter)) +
serialize_string(bool_to_string(has_default)) +
serialize_string(default_value);
std::cout<<"field serial name: "<<serial<<std::endl<<std::endl;
return serial;
}
......@@ -418,7 +412,6 @@ onionlayout FieldMeta::determineOnionLayout(const AES_KEY *const m_key,
TEST_TextMessageError(m_key,
"Should be using SECURITY_RATING::PLAIN!");
if (false == encryptionSupported(f)) {
std::cout<<"encryption not supported for this field, remain plain"<<std::endl;
//TEST_TextMessageError(SECURITY_RATING::SENSITIVE != sec_rating,
// "A SENSITIVE security rating requires the"
// " field to be supported with cryptography!");
......@@ -509,7 +502,6 @@ std::string TableMeta::serialize(const DBObject &parent) const
serialize_string(bool_to_string(has_salt)) +
serialize_string(salt_name) +
serialize_string(std::to_string(counter));
std::cout<<"serial tablemeta: "<<serial<<std::endl<<std::endl;
return serial;
}
......@@ -609,18 +601,14 @@ SchemaCache::getSchema(const std::unique_ptr<Connect> &conn,
//设置当前id对应的stale的值为true.
TEST_SchemaFailure(initialStaleness(e_conn));
this->no_loads = false;
std::cout<<GREEN_BEGIN<<"no_loads = true"<<COLOR_END<<std::endl;
}else{
std::cout<<GREEN_BEGIN<<"no_loads = false"<<COLOR_END<<std::endl;
}
//查询当前ID对应的Stale的值
if (true == lowLevelGetCurrentStaleness(e_conn, this->id)) {
std::cout<<GREEN_BEGIN<<"stale = true and load"<<COLOR_END<<std::endl;
this->schema =
std::shared_ptr<SchemaInfo>(loadSchemaInfo(conn, e_conn));
}else{
std::cout<<GREEN_BEGIN<<"stale = false and do not load"<<COLOR_END<<std::endl;
}
assert(this->schema);
......@@ -633,7 +621,6 @@ lowLevelAllStale(const std::unique_ptr<Connect> &e_conn)
const std::string &query =
" UPDATE " + MetaData::Table::staleness() +
" SET stale = TRUE;";
std::cout<<"stale query: "<<query<<std::endl;
TEST_SchemaFailure(e_conn->execute(query));
}
......@@ -681,7 +668,6 @@ lowLevelToggleCurrentStaleness(const std::unique_ptr<Connect> &e_conn,
" UPDATE " + MetaData::Table::staleness() +
" SET stale = " + bool_to_string(staleness) +
" WHERE cache_id = " + std::to_string(cache_id) + ";";
std::cout<<query<<std::endl;
RFIF(e_conn->execute(query));
return true;
......
......@@ -317,74 +317,11 @@ struct rawReturnValue{
std::vector<std::string> fieldNames;
std::vector<int> fieldTypes;
};
/*
static
void printrawReturnValue(rawReturnValue & cur) {
int len = cur.fieldTypes.size();
if(len==0){
std::cout<<"zero output"<<std::endl;
return ;
}
if(static_cast<int>(cur.fieldNames.size())!=len||static_cast<int>(cur.rowValues[0].size())!=len){
std::cout<<RED_BEGIN<<"size mismatch in printrawReturnValue"<<COLOR_END<<std::endl;
return ;
}
for(int i=0;i<len;i++){
std::cout<<cur.fieldNames[i]<<":"<<cur.fieldTypes[i]<<"\t";
}
std::cout<<std::endl;
for(auto row:cur.rowValues){
for(auto rowItem:row){
std::cout<<rowItem<<"\t";
}
std::cout<<std::endl;
}
}*/
//printResType for testing purposes
/*static
void parseResType(const ResType &rd) {
std::cout<<RED_BEGIN<<"rd.affected_rows: "<<rd.affected_rows<<COLOR_END<<std::endl;
std::cout<<RED_BEGIN<<"rd.insert_id: "<<rd.insert_id<<COLOR_END<<std::endl;
for(auto name:rd.names){
std::cout<<name<<"\t";
}
std::cout<<std::endl;
for(auto row:rd.rows){
for(auto item:row){
std::cout<<ItemToString(*item)<<"\t";
}
std::cout<<std::endl;
}
}
*/
/*
static
void parseResType2(const ResType &rd) {
std::cout<<RED_BEGIN<<"rd.affected_rows: "<<rd.affected_rows<<COLOR_END<<std::endl;
std::cout<<RED_BEGIN<<"rd.insert_id: "<<rd.insert_id<<COLOR_END<<std::endl;
int len = rd.names.size();
for(int i=0;i<len;i++){
std::cout<<rd.names[i]<<std::endl;
for(auto row:rd.rows){
std::cout<<row[i]<<std::endl;
}
}
}
*/
static ResType
getResTypeFromLuaTable(lua_State *const L, int fields_index,
int rows_index, int affected_rows_index,
int insert_id_index, int status_index) {
//std::cout<<"decide to show luaTable to ResType:"<<std::endl;
const bool status = lua_toboolean(L, status_index);
if (false == status) {
return ResType(false, 0, 0);
......@@ -396,20 +333,16 @@ getResTypeFromLuaTable(lua_State *const L, int fields_index,
std::vector<enum_field_types> types;
/* iterate over the fields argument */
lua_pushnil(L);
//std::cout<<"start to get fields"<<std::endl;
while (lua_next(L, fields_index)) {
std::cout<<"1"<<std::endl;
if (!lua_istable(L, -1))
LOG(warn) << "mismatch";
lua_pushnil(L);
while (lua_next(L, -2)) {
const std::string k = xlua_tolstring(L, -2);
if ("name" == k) {
std::cout<<"field name"<<std::endl;
names.push_back(xlua_tolstring(L, -1));
myRawFromLua.fieldNames.push_back(xlua_tolstring(L, -1));
} else if ("type" == k) {
std::cout<<"field type"<<std::endl;
types.push_back(static_cast<enum_field_types>(luaL_checkint(L, -1)));
myRawFromLua.fieldTypes.push_back(static_cast<enum_field_types>(luaL_checkint(L, -1)) );
} else {
......@@ -441,7 +374,6 @@ getResTypeFromLuaTable(lua_State *const L, int fields_index,
assert(key >= 0 && static_cast<uint>(key) < types.size());
const std::string data = xlua_tolstring(L, -1);
curRow.push_back(data);
// std::cout<<"transform to typed data"<<std::endl;
row[key] = MySQLFieldTypeToItem(types[key], data);
lua_pop(L, 1);
}
......@@ -450,7 +382,6 @@ getResTypeFromLuaTable(lua_State *const L, int fields_index,
lua_pop(L, 1);
}
std::cout<<RED_BEGIN<<"ADD TRANSFORM TEST"<<COLOR_END<<std::endl;
//printrawReturnValue(myRawFromLua);
return ResType(status, lua_tointeger(L, affected_rows_index),
......@@ -468,20 +399,16 @@ nilBuffer(lua_State *const L, size_t count)
return;
}
/*
*return mete for dectypting data.
* */
static void
parseReturnMeta(const ReturnMeta & rtm){
std::cout<<RED_BEGIN<<"parseReturnMeta!!!"<<COLOR_END<<std::endl;
}
static int
next(lua_State *const L) {
// ANON_REGION(__func__, &perf_cg);
scoped_lock l(&big_lock);
assert(0 == mysql_thread_init());
//查找client
......@@ -526,7 +453,6 @@ next(lua_State *const L) {
case AbstractQueryExecutor::ResultType::QUERY_COME_AGAIN: {
// more to do before we have the client's results
xlua_pushlstring(L, "again");
std::cout<<"QUERY_COME_AGAIN:11111111111111111111111"<<std::endl<<std::endl;
const auto &output =
std::get<1>(new_results)->extract<std::pair<bool, std::string> >();
const auto &want_interim = output.first;
......@@ -540,7 +466,6 @@ next(lua_State *const L) {
// the results of executing this query should be send directly
// back to the client
xlua_pushlstring(L, "query-results");
std::cout<<"QUERY_USE_RESULTS:22222222222222222222222222"<<std::endl<<std::endl;
const auto &new_query =
std::get<1>(new_results)->extract<std::string>();
xlua_pushlstring(L, new_query);
......@@ -550,7 +475,6 @@ next(lua_State *const L) {
case AbstractQueryExecutor::ResultType::RESULTS: {
// ready to return results to the client
xlua_pushlstring(L, "results");
std::cout<<"RESULTS:33333333333333333333333333333333333333"<<std::endl<<std::endl;
const auto &res = new_results.second->extract<ResType>();
returnResultSet(L, res); // pushes 4 items on stack
return 5;
......
cd ../..
find . | grep '\.cc$\|\.c$\|\.h$\|\.hh$' | xargs ctags
rm cscope*
find . | grep '\.cc$\|\.c$\|\.h$\|\.hh$' > cscope.files
cscope -R -b -i cscope.files
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