|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--ModSQL.Insert
Insert parses and executes an SQL INSERT query.
| Field Summary | |
private int[] |
column_index
Array of indices of columns to insert (set by optimize). |
private int[] |
column_type
Array of column types (set by optimize). |
private String[] |
columns
Array of column names to insert. |
private DatabaseManager |
manager
Table manager used to open tables. |
private Table |
source
Rows of data to insert. |
private DatabaseTable |
table
Database table to insert rows into (set by optimize). |
private String |
tablename
Name of table. |
| Constructor Summary | |
Insert(StreamTokenizer tokenizer,
DatabaseManager manager)
Contructor to parse query. |
|
| Method Summary | |
void |
close()
Close query and free resources in use. |
int |
execute()
Execute the query. |
static Object |
getCompatibleType(Object x,
int type)
Convert the supplied object to an object compatible with the specified SQL type. |
void |
optimize()
Optimize query. |
private void |
ParseInsert(StreamTokenizer tokenizer)
Parse update query of the form:
INSERT INTO tablename (columns,...) VALUES (values,...); |
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[] columns
private Table source
private DatabaseTable table
private int[] column_index
private int[] column_type
private transient DatabaseManager manager
| Constructor Detail |
public Insert(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 ParseInsert(StreamTokenizer tokenizer)
throws SQLException,
IOException
INSERT INTO tablename (columns,...) VALUES (values,...);
INSERT INTO tablename (columns,...) SELECT ...;
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
public static Object getCompatibleType(Object x,
int type)
throws SQLException
x - object to converttype - SQL type to convert toSQLException - if a type mismatch occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||