: Class Drop

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ModSQL
Class Drop

    java.lang.Object
      |
      +--ModSQL.Drop

All Implemented Interfaces:
  Query

final class Drop
extends Object
implements Query

Drop will parse a DROP sql statement. Currently, DROP TABLE and DROP INDEX are supported.

Author:
  chris.studholme@utoronto.ca

Field Summary
`(package private) String` | `indexed_column` Index to drop indexes this column.
`(package private) String` | `indexed_table` Index to drop indexes this table.
`protected DatabaseManager` | `tablemanager` Table manager used to open tables.
`(package private) String` | `tablename` Name of table to drop.

Constructor Summary
`protected` | `Drop(StreamTokenizer tokenizer, DatabaseManager manager)` Contructor to parse query.

Method Summary
`void` | `close()` Close query and free resources in use.
`int` | `execute()` Execute the query.
`void` | `optimize()` Optimize query.
`private void` | `ParseDrop(StreamTokenizer tokenizer)` Parse drop query of the form: `DROP INDEX tablename.column; DROP TABLE tablename;`
`private void` | `ParseDropIndex(StreamTokenizer tokenizer)` Parse drop index query of the form: `DROP INDEX tablename.column;`
`private void` | `ParseDropTable(StreamTokenizer tokenizer)` Parse drop table query of the form: `DROP TABLE tablename;`
`String` | `toString()` Returns human-readable string version of query (with surrounding brackets).
`String` | `toString(boolean with_brackets)` Returns human-readable string version of query.

Methods inherited from class java.lang.Object
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait`

Field Detail

### indexed_table

    String indexed_table

  Index to drop indexes this table.

### indexed_column

    String indexed_column

  Index to drop indexes this column.

### tablename

    String tablename

  Name of table to drop.

### tablemanager

    protected transient DatabaseManager tablemanager

  Table manager used to open tables.

Constructor Detail

### Drop

    protected Drop(StreamTokenizer tokenizer,
                   DatabaseManager manager)
            throws SQLException,
                   IOException

  Contructor to parse query.
  Parameters:
    `tokenizer` - StreamTokenizer that SQL tokens should be read from
    `manager` - manager to use when looking up tables
  Throws:
    `SQLException` - if an error occurs
    `IOException` - if there is a problem reading the query

Method Detail

### close

    public void close()

  Close query and free resources in use.
  Specified by:
    `close` in interface `Query`
  Following copied from interface: `ModSQL.Query`
  Throws:
    `SQLException` - if an error occurs

### toString

    public String toString()

  Returns human-readable string version of query (with surrounding brackets).
  Overrides:
    `toString` in class `Object`
  Returns:
    String representation of query

### toString

    public String toString(boolean with_brackets)

  Returns human-readable string version of query.
  Specified by:
    `toString` in interface `Query`
  Parameters:
    `with_brackets` - true to include surrounding brackets
  Returns:
    String representation of query

### ParseDrop

    private void ParseDrop(StreamTokenizer tokenizer)
                    throws SQLException,
                           IOException

  Parse drop query of the form:

  > `DROP INDEX tablename.column;
  > DROP TABLE tablename;`

  Parameters:
    `tokenizer` - StreamTokenizer that SQL tokens should be read from
  Throws:
    `SQLException` - if an error occurs
    `IOException` - if there is a problem reading the query

### ParseDropTable

    private void ParseDropTable(StreamTokenizer tokenizer)
                         throws SQLException,
                                IOException

  Parse drop table query of the form:

  > `DROP TABLE tablename;`

  Parameters:
    `tokenizer` - StreamTokenizer that SQL tokens should be read from
  Throws:
    `SQLException` - if an error occurs
    `IOException` - if there is a problem reading the query

### ParseDropIndex

    private void ParseDropIndex(StreamTokenizer tokenizer)
                         throws SQLException,
                                IOException

  Parse drop index query of the form:

  > `DROP INDEX tablename.column;
  > `

  Parameters:
    `tokenizer` - StreamTokenizer that SQL tokens should be read from
  Throws:
    `SQLException` - if an error occurs
    `IOException` - if there is a problem reading the query

### optimize

    public void optimize()
                  throws SQLException

  Optimize query.
  Specified by:
    `optimize` in interface `Query`
  Throws:
    `SQLException` - if an error occurs

### execute

    public int execute()
                throws SQLException

  Execute the query.
  Specified by:
    `execute` in interface `Query`
  Returns:
    1 if successful
  Throws:
    `SQLException` - if an error occurs

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD