| java.lang.Object com.quadcap.sql.tools.XmlDump
XmlDump | public class XmlDump implements Backup(Code) | | Dump an SQL database in an XML representation. The XML document
has an outer tag of <database> . Each child element
then contains one table row, where the tag name specifies the table name;
each child element of this tag contains one column value where the
tag name specifies the column name. Most object are represented in
their standard Java toString style representation, except
binary objects, which are dumped in hexadecimal. (Base-64 would probably
be better...)
author: Stan Bailes |
Inner Class :class DbType | |
Constructor Summary | |
public | XmlDump() No-argument constructor. | public | XmlDump(Connection conn) Construct an XmlDump object bound to the specified connection. | public | XmlDump(Connection conn, int indentLevel) Construct an XmlDump object bound to the specified connection,
and with a specified initial indent level. |
Method Summary | |
public void | backup(java.sql.Connection conn, Writer w) A convenience function that sets the current connection and dumps
the database in one go. | final void | beginTag(Writer w, String tag) | void | dumpIndexDefinitions(Writer w, String tableName) | public void | dumpTable(Writer w, String tableName) Dump the rows of the specified table to the output stream in XML
format. | public void | dumpTableDefinition(Writer w, String tableName) | public void | dumpTableForeignKeys(Writer w, String tableName) | public void | dumpTables(Writer w) Dump all of the tables in the database which is referenced by the
current connection object to the specified output stream. | void | dumpViewDefinitions(Writer w) | final void | endTag(Writer w, String tag) | public Connection | getConnection() | DbType | getType(int type) | Hashtable | getTypes() | public static void | main(String[] args) A main program which allows this function to be run as a command-line
application for doing an off-line dump. | public static Connection | makeConnection() Establish a database connection based on the settings of system
properties.
The following system properties are used to establish the
database connection:
hexBytes | final static char[] hexBytes(Code) | | |
indentLevel | int indentLevel(Code) | | |
wasBegin | boolean wasBegin(Code) | | |
XmlDump | public XmlDump()(Code) | | No-argument constructor. The object so constructed needs a
Connection in order to do anything useful.
|
XmlDump | public XmlDump(Connection conn)(Code) | | Construct an XmlDump object bound to the specified connection.
Parameters: conn - the database connection |
XmlDump | public XmlDump(Connection conn, int indentLevel)(Code) | | Construct an XmlDump object bound to the specified connection,
and with a specified initial indent level.
Parameters: conn - the database connection Parameters: indentLevel - the initial indent level (in units -- currentlyindent units are simple spaces |
dumpTable | public void dumpTable(Writer w, String tableName) throws IOException, SQLException(Code) | | Dump the rows of the specified table to the output stream in XML
format. Each row is dumped as an XML element with the tag name
equal to the table name. Each non-null column is dumped as a
sub-element with the tag name equal to the column name.
Parameters: w - the output stream Parameters: tableName - the name of the database table to dump. exception: IOException - may be thrown exception: SQLException - may be thrown |
dumpTables | public void dumpTables(Writer w) throws IOException, SQLException(Code) | | Dump all of the tables in the database which is referenced by the
current connection object to the specified output stream. This
routine writes a well-formed XML document, with a document element
named <database> . Sub-elements correspond to
indidivual table rows.
This routine first constructs a graph of the foreign table reference
constraints, and attempts to output base tables before dependant
tables, so that the resulting file can be imported without causing
foreign key integrity violations.
Parameters: w - the output stream exception: IOException - may be thrown exception: SQLException - may be thrown |
getConnection | public Connection getConnection()(Code) | | Get the dumper's database connection
the current database connection |
main | public static void main(String[] args)(Code) | | A main program which allows this function to be run as a command-line
application for doing an off-line dump. The name of the output file is
specified as the argument. If the name of the output file
ends with ".gz" , the output is compressed using the
gzip compression mechanism.
See Also: makeConnection See Also: for a description of the System properties used See Also: to establish the database connection. Parameters: args - com.quadcap.sql.tools.XmlDump output file |
makeConnection | public static Connection makeConnection() throws Exception(Code) | | Establish a database connection based on the settings of system
properties.
The following system properties are used to establish the
database connection:
jdbc.driver |
The name of the JDBC driver class (default
com.quadcap.jdbc.JdbcDriver ) |
jdbc.url |
The JDBC URL used to establish the database connection.
|
jdbc.props |
The name of a properties file used to establish the connection.
If this property is specified, jdbc.user and
jdbc.password aren't used.
If this property has the value "system" , then
the system properties are passed to the
DriverManager.getConnection() method.
|
jdbc.user |
The user name used to establish the
database connection. If neither jdbc.props
nor jdbc.user is specified, the
DriverManager.getConnection(String url)
method is used to establish the connection. |
jdbc.password |
The password used to establish the
database connection. |
exception: Exception - may be thrown if there's a problem connectingto the database. |
setConnection | public void setConnection(Connection conn)(Code) | | Set the dumper's database connection
Parameters: conn - the new database connection |
|
|
|