int db::Table::create ( Database db,
const NameChar *  table_name,
const FieldDescSet fields,
const IndexDescSet indexes,
CursorMode  cursor_mode = DB_CURSOR_FOR_READ,
TxIsolation  isolation = DB_DEFAULT_ISOLATION 
)

Create and open a new table in the database db named table_name.

Parameters:
db Database in which to create the new table. (required)
table_name Name of the table to create. (required)
fields List of fields. (required)
indexes List of indexes.
cursor_mode Cursor mode.
isolation Isolation level to use in this cursor.
Returns:
  • DB_NOERROR When successful.
  • DB_EFIELD Invalid field name. First character must be a letter.
  • DB_EINVAL Caused by: invalid table_name, invalid fields descriptor, invalid indexes descriptor, invalid cursor_mode, or invalid transaction isolation mode.
  • DB_ENAME table_name is not in a valid format. Valid name is letter(aA-zZ)+zero or more aplhanumeric characters. Underscore is considered a valid character.
  • DB_ERECORDSIZE Record size too large for chosen page size.
  • DB_ESTATE Object state is not compatible with the method called. Storage is already opened.
Note:
After the table is created, it will be opened automatically.

Do not call this function while a transaction is active. If necessary, call Database::tx_commit or Database::tx_abort to finish the current transaction. This function is not atomic.

See also:
Database::create_table


Copyright © 2005-2008 ITTIA®. All rights reserved.