|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.torque.engine.database.transform.SQLToAppData
A Class that converts an sql input file to an AppData structure. The class makes use of SQL Scanner to get sql tokens and the parses these to create the AppData class. SQLToAppData is in effect a simplified sql parser.
Field Summary | |
private AppData |
appData
|
private Database |
appDataDB
|
private java.lang.String |
basePropsFilePath
|
private int |
count
|
private java.lang.String |
databaseType
|
private java.lang.String |
sqlFile
|
private Token |
token
|
private java.util.List |
tokens
|
Constructor Summary | |
SQLToAppData(java.lang.String sqlFile)
Create a new class with an input Reader |
|
SQLToAppData(java.lang.String sqlFile,
java.lang.String databaseType,
java.lang.String basePropsFilePath)
Create a new class with an input Reader. |
Method Summary | |
private void |
create_Table_Column_Data(Table tbl)
Parse the data definition of the column statement. |
private void |
create_Table_Column_Foreign(Table tbl)
Parses FOREIGN KEY (BAR) REFERENCES TABLE (BAR) statement |
private void |
create_Table_Column_Primary(Table tbl)
Parses PRIMARY KEY (FOO,BAR) statement |
private void |
create_Table_Column_Unique(Table tbl)
Parses UNIQUE (NAME,FOO,BAR) statement |
private void |
create_Table_Column(Table tbl)
Parses column information between the braces of a CREATE TABLE () sql statement. |
private void |
create_Table()
Parses a CREATE TABLE sql command |
private void |
create()
Parses a CREATE TABLE FOO command. |
private void |
err(java.lang.String name)
Creates an error condition and adds the line and column number of the current token to the error message. |
AppData |
execute()
Execute the parser. |
java.lang.String |
getSqlFile()
Get the current input sql file |
private boolean |
hasTokens()
Check if there is more tokens available for parsing. |
static void |
main(java.lang.String[] args)
Just 4 testing. |
private void |
next()
Move to the next token. |
void |
setSqlFile(java.lang.String sqlFile)
Set the current input sql file |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.lang.String sqlFile
private java.util.List tokens
private Token token
private AppData appData
private Database appDataDB
private int count
private java.lang.String databaseType
private java.lang.String basePropsFilePath
Constructor Detail |
public SQLToAppData(java.lang.String sqlFile)
sqlFile
- the sql filepublic SQLToAppData(java.lang.String sqlFile, java.lang.String databaseType, java.lang.String basePropsFilePath)
sqlFile
- the sql filedatabaseType
- basePropsFilePath
- Method Detail |
public java.lang.String getSqlFile()
public void setSqlFile(java.lang.String sqlFile)
sqlFile
- the sql fileprivate void next() throws ParseException
ParseException
private void err(java.lang.String name) throws ParseException
name
- name of the error
ParseException
private boolean hasTokens()
private void create() throws ParseException
ParseException
private void create_Table() throws ParseException
ParseException
- error parsing the input fileprivate void create_Table_Column(Table tbl) throws ParseException
ParseException
- error parsing the input fileprivate void create_Table_Column_Primary(Table tbl) throws ParseException
ParseException
- error parsing the input fileprivate void create_Table_Column_Unique(Table tbl) throws ParseException
ParseException
- error parsing the input fileprivate void create_Table_Column_Foreign(Table tbl) throws ParseException
ParseException
- error parsing the input fileprivate void create_Table_Column_Data(Table tbl) throws ParseException
ParseException
- error parsing the input filepublic AppData execute() throws java.io.IOException, ParseException
java.io.IOException
- If an I/O error occurs
ParseException
- error parsing the input filepublic static void main(java.lang.String[] args) throws java.lang.Exception
args
- commandline args
java.lang.Exception
- an exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |