|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.clazzes.jdbc2xml.sax.JDBCToSAXWriter
public class JDBCToSAXWriter
This class writes a series of JDBC select queries to an XML document using a SAX ContentHandler instance.
Constructor Summary | |
---|---|
JDBCToSAXWriter()
Create an uninitialized instance. |
|
JDBCToSAXWriter(java.sql.Connection connection,
java.util.TimeZone timeZone,
org.xml.sax.ContentHandler contentHandler)
|
|
JDBCToSAXWriter(SchemaEngine schemaEngine,
org.xml.sax.ContentHandler contentHandler)
|
Method Summary | |
---|---|
void |
addQueries(java.util.Collection<java.lang.String> queries)
Add the given list of queries to the data being dumped. |
void |
addQuery(java.lang.String sql)
Add the given SQL select query to the data being dumped. |
void |
addRestrictedTable(java.lang.String table,
java.lang.String sql)
Add the given database table and a query, which selects a subset of the table data to the data being dumped. |
void |
addTable(java.lang.String table)
Add the given database table to the data being dumped. |
void |
addTable(TableInfo tableInfo)
Add the given database table to the data being dumped. |
void |
addTables(java.util.Collection<java.lang.String> tables)
Add the given list of database tables to the data being dumped. |
protected void |
doPrettyParagraph()
|
java.sql.Connection |
getConnection()
|
org.xml.sax.ContentHandler |
getContentHandler()
|
ProcessRestrictionFilter |
getProcessRestrictionFilter()
|
java.lang.String |
getSchema()
|
java.util.TimeZone |
getTimeZone()
|
protected void |
initPrettyParams()
|
void |
processData()
Proceed by executing all SQL statement and writing the resulting data to the ContentHandler. |
void |
setConnection(java.sql.Connection connection)
|
void |
setContentHandler(org.xml.sax.ContentHandler contentHandler)
|
void |
setProcessRestrictionFilter(ProcessRestrictionFilter processFilter)
|
void |
setSchema(java.lang.String schema)
|
void |
setTimeZone(java.util.TimeZone timeZone)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JDBCToSAXWriter()
setConnection(Connection)
, setContentHandler(ContentHandler)
and
setTimeZone(TimeZone)
in order to initialize this instance.
public JDBCToSAXWriter(java.sql.Connection connection, java.util.TimeZone timeZone, org.xml.sax.ContentHandler contentHandler) throws java.sql.SQLException
connection
- The database connection to use.timeZone
- The time zone used to process date values.contentHandler
- The SAX content handler which drives the XML output.
java.sql.SQLException
- Upon errors when inspecting the database.public JDBCToSAXWriter(SchemaEngine schemaEngine, org.xml.sax.ContentHandler contentHandler) throws java.sql.SQLException
schemaEngine
- The initialized SchemaEngine carrying the database connection
and default time zone.contentHandler
- The SAX content handler which drives the XML output.
java.sql.SQLException
- Upon errors when inspecting the database.Method Detail |
---|
protected void initPrettyParams()
protected void doPrettyParagraph() throws org.xml.sax.SAXException
org.xml.sax.SAXException
public java.sql.Connection getConnection()
public void setConnection(java.sql.Connection connection) throws java.sql.SQLException
connection
- the connection to set
java.sql.SQLException
public org.xml.sax.ContentHandler getContentHandler()
public void setContentHandler(org.xml.sax.ContentHandler contentHandler)
contentHandler
- the contentHandler to setpublic java.util.TimeZone getTimeZone()
public void setTimeZone(java.util.TimeZone timeZone)
timeZone
- the timeZone to setpublic java.lang.String getSchema()
public void setSchema(java.lang.String schema)
schema
- The schema to which the written tables belong to set.public void addTables(java.util.Collection<java.lang.String> tables) throws java.sql.SQLException
tables
- A list of database table names.
java.sql.SQLException
public void addTable(java.lang.String table) throws java.sql.SQLException
table
- A database table name.
java.sql.SQLException
public void addTable(TableInfo tableInfo) throws java.sql.SQLException
tableInfo
- A database table description.
java.sql.SQLException
public void addRestrictedTable(java.lang.String table, java.lang.String sql) throws java.sql.SQLException
table
- A database table name.sql
- A query that selects data from this table, but restrict the
returned row to a subset of the whole table. Typically, such
a query looks like
select a.* from account a, person p where a.person_id=p.id and person.name='Me';assuming that table account has a foreign key to table person.
java.sql.SQLException
public void addQueries(java.util.Collection<java.lang.String> queries)
queries
- A list of SQL queries.public void addQuery(java.lang.String sql)
sql
- An SQL query statement.public void processData() throws java.sql.SQLException, org.xml.sax.SAXException
java.sql.SQLException
org.xml.sax.SAXException
public ProcessRestrictionFilter getProcessRestrictionFilter()
public void setProcessRestrictionFilter(ProcessRestrictionFilter processFilter)
processFilter
- The processRestrictionFilter to set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |