|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--ModSQL.Update
Update will parse and execute an SQL UPDATE query.
| Field Summary | |
private int[] |
column_index
Array of indices of columns to update (set by optimize). |
private int[] |
column_type
Array of column types (set by optimize). |
private TableReader |
reader
Reader used to fetch rows (set by optimize). |
private String[] |
set_column
Array of column names to update. |
private Function[] |
set_value
New values for columns. |
private DatabaseTable |
table
Database table to update (set by optimize). |
protected DatabaseManager |
tablemanager
Table manager used to open tables. |
private String |
tablename
Name of table. |
private Function |
where
Where clause used to choose rows. |
| Constructor Summary | |
protected |
Update(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 |
ParseUpdate(StreamTokenizer tokenizer)
Parse update query of the form:
UPDATE tablename SET columns [ 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 |
|
| Field Detail |
private String tablename
private String[] set_column
private Function[] set_value
private Function where
private TableReader reader
private DatabaseTable table
private int[] column_index
private int[] column_type
protected transient DatabaseManager tablemanager
| Constructor Detail |
protected Update(StreamTokenizer tokenizer,
DatabaseManager manager)
throws SQLException,
IOException
tokenizer - StreamTokenizer that SQL tokens should be read frommanager - manager to use when looking up tablesSQLException - if an error occursIOException - if there is a problem reading the query| Method Detail |
public void close()
close in interface QueryModSQL.QuerySQLException - if an error occurspublic String toString()
toString in class Objectpublic String toString(boolean with_brackets)
toString in interface Querywith_brackets - true to include surrounding brackets
private void ParseUpdate(StreamTokenizer tokenizer)
throws SQLException,
IOException
UPDATE tablename SET columns [ WHERE condition ]
tokenizer - StreamTokenizer that SQL tokens should be read fromSQLException - if an error occursIOException - if there is a problem reading the query
public void optimize()
throws SQLException
optimize in interface QuerySQLException - if an error occurs
public int execute()
throws SQLException
execute in interface QuerySQLException - if an error occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||