|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectde.unidu.is.sql.SQLFormatterImplementation
The default implementation of a formatter for SQL statements.
A formatter converts an abstract SQL statement into an SQL string suitable for a specific database. This allows for bridging the subtle differences in the SQL syntax of the different relational database management systems.
This implemenation uses a configuration file, located in the directory
conf/db relatively to the CLASSPATH. The name is the part of
the JDBC URI between the first and the second colon.
| Field Summary | |
protected StreamPropertyMap |
config
Property map for formatting SQL statements. |
protected DB |
db
The DB parameters. |
| Constructor Summary | |
protected |
SQLFormatterImplementation(DB db)
Creates a new formatter. |
| Method Summary | |
void |
addIndex(java.lang.String tableName,
java.lang.String indexName,
java.lang.String[] cols,
boolean[] textCols)
Adds an index to the specified table. |
void |
clear(java.lang.String tableName)
Clear the specified tables, which means deletes all rows. |
void |
close(java.sql.ResultSet rs)
Closes the specified ResultSet. |
void |
create(java.lang.String tableName,
java.lang.String[] cols,
java.lang.String[] types)
Creates a table. |
DB |
getDB()
Returns the DB parameters. |
java.lang.String |
getSelect(SQL sql)
Returns a concrete select statement for this DB, obtained from the specified abstract SQL select statement. |
void |
perform(SQL sql,
java.lang.String resultTableName)
Transforms the specified abstract SQL insert statement into a concrete SQL statement for this DB, and performs it. |
java.sql.ResultSet |
performQuery(SQL sql)
Transforms the specified abstract SQL select statement into a concrete SQL statement for this DB, performs it, and returns a corresponding ResultSet. |
void |
remove(java.lang.String tableName)
Removes the specified table. |
void |
setDB(DB db)
Sets the DB parameters. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected DB db
protected StreamPropertyMap config
| Constructor Detail |
protected SQLFormatterImplementation(DB db)
db - DB parameters| Method Detail |
public void create(java.lang.String tableName,
java.lang.String[] cols,
java.lang.String[] types)
create in interface SQLFormattertableName - name of the tablecols - names of the columnstypes - types of the columns, can be subject to substitutionpublic void clear(java.lang.String tableName)
clear in interface SQLFormattertableName - name of the table
public void perform(SQL sql,
java.lang.String resultTableName)
perform in interface SQLFormattersql - abstract SQL statementresultTableName - name of the result table (if null, the insert
name from the SQL statement will be used)
public java.sql.ResultSet performQuery(SQL sql)
throws java.sql.SQLException
ResultSet.
performQuery in interface SQLFormattersql - abstract SQL statement
java.sql.SQLExceptionpublic void close(java.sql.ResultSet rs)
ResultSet.
close in interface SQLFormatterrs - result setpublic java.lang.String getSelect(SQL sql)
getSelect in interface SQLFormattersql - abstract SQL statement
public void remove(java.lang.String tableName)
remove in interface SQLFormattertableName - name of the table to remove
public void addIndex(java.lang.String tableName,
java.lang.String indexName,
java.lang.String[] cols,
boolean[] textCols)
addIndex in interface SQLFormattertableName - name of the tableindexName - name of the new indexcols - imvolved columnstextCols - flag indicating that the column is a text columnpublic DB getDB()
getDB in interface SQLFormatterpublic void setDB(DB db)
setDB in interface SQLFormatterdb - DB parameters
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||