|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.cafesoft.core.jdbc.SqlCommandIterator
SqlCommandIterator parses semicolon-terminated SQL commands
from a file and returns them one by one via an iterator API. The parser
does not check SQL commands contained in the file for syntactic correctness,
but behaves as follows:
#
#--- DROP the USERS table if it exists, then create it
#
DROP TABLE USERS IF EXISTS;
CREATE TABLE USERS (
USERNAME VARCHAR(20) DEFAULT '' NOT NULL,
BALANCE INTEGER DEFAULT 0 NOT NULL,
PRIMARY KEY (USERNAME),
UNIQUE (USERNAME)
);
#
#--- INSERT sample data
#
INSERT INTO USERS VALUES ('User1',101);
INSERT INTO USERS VALUES ('User2',102);
INSERT INTO USERS VALUES ('User3',103);
INSERT INTO USERS VALUES ('User4',104);
| Constructor Summary | |
SqlCommandIterator(String filePath)
Create a new SqlCommandIterator. |
|
SqlCommandIterator(String filePath,
Logger logger)
Create a new SqlCommandIterator with the specified Logger. |
|
| Method Summary | |
int |
getLineNumber()
Get the line number of the current SQL command. |
boolean |
hasNext()
Check for a next SQL command. |
String |
next()
Get the next SQL command. |
boolean |
setDebug(boolean enable)
Enable or disable debugging. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SqlCommandIterator(String filePath)
throws FileNotFoundException,
IOException
filePath - the path to the SQL command file.
FileNotFoundException - if the file does not exist.
IOException - if unable to read from the file.
public SqlCommandIterator(String filePath,
Logger logger)
throws FileNotFoundException,
IOException
filePath - the path to the SQL command file.
FileNotFoundException - if the file does not exist.
IOException - if unable to read from the file.| Method Detail |
public boolean setDebug(boolean enable)
setDebug in interface Debuggableenable - if true, enable debugging, else disable debugging.
public boolean hasNext()
public String next()
public int getLineNumber()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||