MYSQL.create_table

MYSQL.create_table — creates a new, single-column table.

Syntax

MYSQL.create_table (tablename)

Arguments

tablename

A string to use as the table name.

Returns

On success, nil, or an error on failure.

Description

This method of the MYSQL class creates a new table with a single column, named "id" as an auto-incrementing integer primary key. To add more columns to the table, use the MYSQL.add_column method.

This method is defined in the Gamma library /usr/cogent/require/MySQLSupport.g. It is made available to a Gamma program with the statement: require("MySQLSupport");.

Example

This example is taken from Section 2.2, “Tutorial 2: create_pets.g”

...

  /* Create the "pets" table, and add columns to it. */
  mysql.create_table("pets");
  mysql.add_column ("pets", "name", "VARCHAR(20)", nil, nil);
  mysql.add_column ("pets", "owner", "VARCHAR(20)", nil, nil);

...