void xyzsql_process_insert(insert_stmt *s ) { if ( s == NULL ) s = dynamic_cast<insert_stmt *>(stmt_queue.front().second); auto t = catm.exist_relation(s->table_name)->cols; if (verify_validation(s->values, t) == false) throw invalid_argument("Uncapatable values"); auto table_info = catm.exist_relation(s->table_name); Record r(*(s->values), table_info->cols); for(auto x : *(r.table_info)) { if(x->flag & (table_column::unique_attr | table_column::primary_attr)) { string filename; indexIterator cursor; int asdf = IndexManager.selectNode(cursor, s->table_name + "/index_" + x->name + ".db", condition::EQUALTO, r.get_value(x).to_str(x->data_type)); if (asdf == 0) throw invalid_argument("Unique Key already exists."); } } int blockNum, offset; RecordManager.insertRecord(s->table_name, r, blockNum, offset); table_info->inc_size(); for(auto x : *(r.table_info)) { if(x->flag & (table_column::unique_attr | table_column::primary_attr)) { IndexManager.insertNode(s->table_name + "/index_" + x->name + ".db", r.get_value(x->name).to_str(x->data_type) , blockNum, offset); } } }