|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.judoscript.util.TableDump
public class TableDump
A dump file stores a part or whole of a database table. Dump files are gzipped. The contents are Java-serialized, which are all of basic data types:
String java.version String java.vm.version String java.class.version String[] column attribute names -- titles for a TableData Object[][] column attributes -- data for a TableData (Object[])+ column values Boolean.FALSEThis class provides methods to read from a dump file.
Its static method dumpTable()
dumps the content of
a relational database table with a WHERE clause into a dump file.
There is also a convenience method, generateLoadScript()
, * that generates JudoScript code to upload the data into a(nother)
database table, based on the meta information of the columns.
Constructor Summary | |
---|---|
TableDump(java.lang.String fileName)
Takes a dump file name, opens it and reads in the meta information. |
Method Summary | |
---|---|
void |
close()
|
static long |
dumpTable(java.sql.Connection con,
java.lang.String tableName,
java.lang.String fileName,
java.lang.String whereClause,
int limit,
int promptSegment)
Dumps whole or part of a database table to a dump file. |
static long |
dumpTable(java.lang.String tableName,
java.lang.String fileName,
java.sql.ResultSet rs,
int limit,
int promptSegment)
|
void |
generateLoadScript(java.io.PrintWriter pw,
java.lang.String dumpFileName,
java.lang.String tableName,
boolean createTable)
Generates a JudoScript program that optionally creates the database table and loads the data into it. |
TableData |
getColumnAttrs()
|
java.lang.String |
getJavaClassVersion()
|
java.lang.String |
getJavaVersion()
|
java.lang.String |
getJavaVmVersion()
|
java.lang.Object[] |
next()
|
void |
reInit(java.lang.String fileName)
Closes the current one if open, opens a new file and reads in the meta information. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TableDump(java.lang.String fileName) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
Method Detail |
---|
public void reInit(java.lang.String fileName) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void close()
public java.lang.String getJavaVersion()
public java.lang.String getJavaVmVersion()
public java.lang.String getJavaClassVersion()
public TableData getColumnAttrs()
public java.lang.Object[] next() throws java.io.IOException
java.io.IOException
public void generateLoadScript(java.io.PrintWriter pw, java.lang.String dumpFileName, java.lang.String tableName, boolean createTable) throws java.io.IOException
The generated code includes "connect.judi", which should have these connection
parameters specified as url
, username
and password
.
You may modify the generated script to put in correct connection parameters,
and also the CREATE TABLE statement for the column types.
pw
- The print writer used for the generated script code.dumpFileName
- the dump file name.
Can be null, where tableName.tdmp
is used.tableName
- the database table name; must not be null.createTable
- flag indicating a CREATE TABLE statement need be generated.
java.io.IOException
public static long dumpTable(java.sql.Connection con, java.lang.String tableName, java.lang.String fileName, java.lang.String whereClause, int limit, int promptSegment) throws java.sql.SQLException, java.io.IOException
con
- the database connection.tableName
- the database table name. Must not be null.fileName
- the dump file name. If null, default use tableName.tdmp
.whereClause
- the where clause for the internal SELECT statement. Can be null.limit
- if > 0, the maximum number of rows to dump.promptSegment
- if > 0, every so many rows written, a count is displayed
to System.out
as a prompt.
java.sql.SQLException
java.io.IOException
public static long dumpTable(java.lang.String tableName, java.lang.String fileName, java.sql.ResultSet rs, int limit, int promptSegment) throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |