MYSQL.add_column (tablename, column, type, default_val, allow_null)
This method of the MYSQL class adds a new column to an existing table. If the default value is non-nil, then it will be used as the default value for the column. If allow_null is non-nil, then NULL will be allowed in this column.
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");.
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); mysql.add_column ("pets", "species", "VARCHAR(20)", nil, nil); mysql.add_column ("pets", "sex", "CHAR(1)", nil, nil); mysql.add_column ("pets", "birth", "DATE", nil, t); mysql.add_column ("pets", "death", "DATE", nil, t); ...
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.