struct Table
{
string table_name; //表名
int attr_count; //表中属性的总个数
Attribute attrs[32]; //表的所有属性列表, 最多32个属性
//return primary key id
int getPrimaryKeyId() {
for (int i = 0; i
{
if (attrs[i].attr_key_type == PRIMARY)
{
return i;
}
}
//if no primary key
return -1;
}
int searchAttrId(string att_name) {
for (int i = 0; i
{
if (attrs[i].attr_name == att_name)
{
return i;
}
}
//if no primary key
return -1;
}
int length()
{
int len = 0;
for (int i = 0; i
{
len += attrs[i].attr_len;
}
return len;
}
};
struct Tuple: public Table
{
string attr_values[32];
};