simpledb.record
Class TableInfo

java.lang.Object
  extended by simpledb.record.TableInfo

public class TableInfo
extends Object

The metadata about a table and its records.

Author:
Edward Sciore

Constructor Summary
TableInfo(String tblname, Schema schema)
          Creates a TableInfo object, given a table name and schema.
TableInfo(String tblname, Schema schema, Map<String,Integer> offsets, int recordlen)
          Creates a TableInfo object from the specified metadata.
 
Method Summary
 String fileName()
          Returns the filename assigned to this table.
 int offset(String fldname)
          Returns the offset of a specified field within a record
 int recordLength()
          Returns the length of a record, in bytes.
 Schema schema()
          Returns the schema of the table's records
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableInfo

public TableInfo(String tblname,
                 Schema schema)
Creates a TableInfo object, given a table name and schema. The constructor calculates the physical offset of each field. This constructor is used when a table is created.

Parameters:
tblname - the name of the table
schema - the schema of the table's records

TableInfo

public TableInfo(String tblname,
                 Schema schema,
                 Map<String,Integer> offsets,
                 int recordlen)
Creates a TableInfo object from the specified metadata. This constructor is used when the metadata is retrieved from the catalog.

Parameters:
tblname - the name of the table
schema - the schema of the table's records
offsets - the already-calculated offsets of the fields within a record
recordlen - the already-calculated length of each record
Method Detail

fileName

public String fileName()
Returns the filename assigned to this table. Currently, the filename is the table name followed by ".tbl".

Returns:
the name of the file assigned to the table

schema

public Schema schema()
Returns the schema of the table's records

Returns:
the table's record schema

offset

public int offset(String fldname)
Returns the offset of a specified field within a record

Parameters:
fldname - the name of the field
Returns:
the offset of that field within a record

recordLength

public int recordLength()
Returns the length of a record, in bytes.

Returns:
the length in bytes of a record


Copyright © 2011. All Rights Reserved.