: Class Delete

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 Delete

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

All Implemented Interfaces:
  Query

final class Delete
extends Object
implements Query

Delete will parse and execute an SQL DELETE query.

Author:
  chris.studholme@utoronto.ca

Field Summary
`(package private) TableReader` | `reader` Reader used to fetch rows (set by optimize).
`(package private) DatabaseTable` | `table` Database table to update (set by optimize).
`protected DatabaseManager` | `tablemanager` Table manager used to open tables.
`(package private) String` | `tablename` Name of table.
`(package private) Function` | `where` Where clause used to choose rows.

Constructor Summary
`protected` | `Delete(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` | `ParseDelete(StreamTokenizer tokenizer)` Parse delete query of the form: `DELETE FROM tablename [ WHERE condition ]`
`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

### tablename

    String tablename

  Name of table.

### where

    Function where

  Where clause used to choose rows.

### reader

    TableReader reader

  Reader used to fetch rows (set by optimize).

### table

    DatabaseTable table

  Database table to update (set by optimize).

### tablemanager

    protected transient DatabaseManager tablemanager

  Table manager used to open tables.

Constructor Detail

### Delete

    protected Delete(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

### ParseDelete

    private void ParseDelete(StreamTokenizer tokenizer)
                      throws SQLException,
                             IOException

  Parse delete query of the form:

  > `DELETE FROM tablename [ WHERE condition ]`

  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:
    number of rows deleted
  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