13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

SQL support in local databases<br />

ALTER TABLE<br />

The ALTER TABLE command allows the user to r<strong>en</strong>ame or add a new column to an existing table. It is not possible<br />

to remove a column from a table.<br />

sql-statem<strong>en</strong>t ::= ALTER TABLE [database-name.] table-name alteration<br />

alteration ::= RENAME TO new-table-name<br />

alteration ::= ADD [COLUMN] column-def<br />

The RENAME TO syntax is used to r<strong>en</strong>ame the table id<strong>en</strong>tified by [database-name.] table-name to new-table-name.<br />

This command cannot be used to move a table betwe<strong>en</strong> attached databases, only to r<strong>en</strong>ame a table within the same<br />

database.<br />

If the table being r<strong>en</strong>amed has triggers or indices, th<strong>en</strong> they remain attached to the table after it has be<strong>en</strong> r<strong>en</strong>amed.<br />

However, if there are any view definitions or statem<strong>en</strong>ts executed by triggers that refer to the table being r<strong>en</strong>amed, they<br />

are not automatically modified to use the new table name. If a r<strong>en</strong>amed table has associated views or triggers, you must<br />

manually drop and recreate the triggers or view definitions using the new table name.<br />

The ADD [COLUMN] syntax is used to add a new column to an existing table. The new column is always app<strong>en</strong>ded<br />

to the <strong>en</strong>d of the list of existing columns. The column-def clause may take any of the forms permissible in a CREATE<br />

TABLE statem<strong>en</strong>t, with the following restrictions:<br />

The column may not have a PRIMARY KEY or UNIQUE constraint.<br />

The column may not have a default value of CURRENT_TIME, CURRENT_DATE or CURRENT_TIMESTAMP.<br />

If a NOT NULL constraint is specified, the column must have a default value other than NULL.<br />

The execution time of the ALTER TABLE statem<strong>en</strong>t is not affected by the amount of data in the table.<br />

DROP TABLE<br />

The DROP TABLE statem<strong>en</strong>t removes a table added with a CREATE TABLE statem<strong>en</strong>t. The table with the specified<br />

table-name is the table that's dropped. It is completely removed from the database and the disk file. The table cannot<br />

be recovered. All indices associated with the table are also deleted.<br />

sql-statem<strong>en</strong>t ::= DROP TABLE [IF EXISTS] [database-name.] table-name<br />

By default the DROP TABLE statem<strong>en</strong>t does not reduce the size of the database file. Empty space in the database is<br />

retained and used in subsequ<strong>en</strong>t INSERT operations. To remove free space in the database use the<br />

SQLConnection.clean() method. If the autoClean parameter is set to true wh<strong>en</strong> the database is initially created, the<br />

space is freed automatically.<br />

The optional IF EXISTS clause suppresses the error that would normally result if the table does not exist.<br />

CREATE INDEX<br />

The CREATE INDEX command consists of the keywords CREATE INDEX followed by the name of the new index,<br />

the keyword ON, the name of a previously created table that is to be indexed, and a par<strong>en</strong>thesized list of names of<br />

columns in the table whose values are used for the index key.<br />

sql-statem<strong>en</strong>t ::= CREATE [UNIQUE] INDEX [IF NOT EXISTS] [database-name.] index-name<br />

ON table-name ( column-name [, column-name]* )<br />

column-name ::= name [COLLATE collation-name] [ASC | DESC]<br />

Each column name can be followed by ASC or DESC keywords to indicate sort order, but the sort order designation<br />

is ignored by the runtime. Sorting is always done in asc<strong>en</strong>ding order.<br />

Last updated 6/6/2012<br />

1100

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!