heap_storage.cpp
RecordID SlottedPage::add(const Dbt* data) throw(DbBlockNoRoomError) {
    if (!has_room((u16)data->get_size()))
        throw DbBlockNoRoomError("not enough room for new record");
    u16 id = ++this->num_records;
    u16 size = (u16) data->get_size();
    this->end_free -= size;
    u16 loc = this->end_free + 1U;
    put_header();
    put_header(id, size, loc);
    memcpy(this->address(loc), data->get_data(), size);
    return id;
}
// Add a new record to the block. Return its id.
// Provided by Professor Lundeen

Add a new record to the block. Return its id.
Provided by Professor Lundeen
Add a new record to the block . Return its id . Provided by Professor Lundeen
RecordID SlottedPage::add(const Dbt* data) throw(DbBlockNoRoomError) {
    if (!has_room((u16)data->get_size()))
        throw DbBlockNoRoomError("not enough room for new record");
    u16 id = ++this->num_records;
    u16 size = (u16) data->get_size();
    this->end_free -= size;
    u16 loc = this->end_free + 1U;
    put_header();
    put_header(id, size, loc);
    memcpy(this->address(loc), data->get_data(), size);
    return id;
}
RecordID SlottedPage :: add ( const Dbt * data ) throw ( DbBlockNoRoomError ) { if ( ! has_room ( ( u16 ) data -> get_size ( ) ) ) throw DbBlockNoRoomError ( " " ) ; u16 id = ++ this -> num_records ; u16 size = ( u16 ) data -> get_size ( ) ; this -> end_free -= size ; u16 loc = this -> end_free + 1U ; put_header ( ) ; put_header ( id , size , loc ) ; memcpy ( this -> address ( loc ) , data -> get_data ( ) , size ) ; return id ; }
Add a new record to the block.
Add a new record to the block .