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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

SQL support in local databases<br />

The COLLATE clause following each column name defines a collating sequ<strong>en</strong>ce used for text values in that column.<br />

The default collation sequ<strong>en</strong>ce is the collation sequ<strong>en</strong>ce defined for that column in the CREATE TABLE statem<strong>en</strong>t. If<br />

no collation sequ<strong>en</strong>ce is specified, the BINARY collation sequ<strong>en</strong>ce is used. For a definition of the COLLATE clause<br />

and collation functions see COLLATE.<br />

There are no arbitrary limits on the number of indices that can be attached to a single table. There are also no limits<br />

on the number of columns in an index.<br />

DROP INDEX<br />

The drop index statem<strong>en</strong>t removes an index added with the CREATE INDEX statem<strong>en</strong>t. The specified index is<br />

completely removed from the database file. The only way to recover the index is to re<strong>en</strong>ter the appropriate CREATE<br />

INDEX command.<br />

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

By default the DROP INDEX 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 />

CREATE VIEW<br />

The CREATE VIEW command assigns a name to a pre-defined SELECT statem<strong>en</strong>t. This new name can th<strong>en</strong> be used<br />

in a FROM clause of another SELECT statem<strong>en</strong>t in place of a table name. Views are commonly used to simplify queries<br />

by combining a complex (and frequ<strong>en</strong>tly used) set of data into a structure that can be used in other operations.<br />

sql-statem<strong>en</strong>t ::= CREATE [TEMP | TEMPORARY] VIEW [IF NOT EXISTS] [database-name.] view-name AS<br />

select-statem<strong>en</strong>t<br />

If the TEMP or TEMPORARY keyword occurs in betwe<strong>en</strong> CREATE and VIEW th<strong>en</strong> the view that is created is only<br />

visible to the SQLConnection instance that op<strong>en</strong>ed the database and is automatically deleted wh<strong>en</strong> the database is<br />

closed.<br />

If a [database-name] is specified the view is created in the named database (a database that was connected to the<br />

SQLConnection instance using the attach() method, with the specified name argum<strong>en</strong>t. It is an error to specify both a<br />

[database-name] and the TEMP keyword unless the [database-name] is temp. If no database name is specified, and the<br />

TEMP keyword is not pres<strong>en</strong>t, the view is created in the main database (the database that was connected to the<br />

SQLConnection instance using the op<strong>en</strong>() or op<strong>en</strong>Async() method).<br />

Views are read only. A DELETE, INSERT, or UPDATE statem<strong>en</strong>t cannot be used on a view, unless at least one trigger<br />

of the associated type (INSTEAD OF DELETE, INSTEAD OF INSERT, INSTEAD OF UPDATE) is defined. For<br />

information on creating a trigger for a view, see CREATE TRIGGER.<br />

A view is removed from a database using the DROP VIEW statem<strong>en</strong>t.<br />

DROP VIEW<br />

The DROP VIEW statem<strong>en</strong>t removes a view created by a CREATE VIEW statem<strong>en</strong>t.<br />

sql-statem<strong>en</strong>t ::= DROP VIEW [IF EXISTS] view-name<br />

The specified view-name is the name of the view to drop. It is removed from the database, but no data in the underlying<br />

tables is modified.<br />

CREATE TRIGGER<br />

The create trigger statem<strong>en</strong>t is used to add triggers to the database schema. A trigger is a database operation (the<br />

trigger-action) that is automatically performed wh<strong>en</strong> a specified database ev<strong>en</strong>t (the database-ev<strong>en</strong>t) occurs.<br />

Last updated 6/6/2012<br />

1101

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

Saved successfully!

Ooh no, something went wrong!