com.ibm.commerce.marketingcenter.events.util
Class DBSql

java.lang.Object
  |
  +--com.ibm.commerce.marketingcenter.events.util.DBSql

public class DBSql
extends java.lang.Object

This class is used to transfer data from the database to an XML file and vice versa. This class handles these two operations:

  1. Extract the data from a database table and write them into an XML file.
  2. Read the data from an XML file and insert them into a database table.


Field Summary
static java.lang.String COPYRIGHT
           
static java.lang.String ENCODING
          Encoding used for the XML file.
static java.lang.String VERSION
          Version for the XML file.
static char XML_ESCAPE_AMP
          Ampersand character.
static java.lang.String XML_ESCAPE_AMP_RP
          XML representation of the ampersand character.
static char XML_ESCAPE_APOS
          Single quote character.
static java.lang.String XML_ESCAPE_APOS_RP
          XML representation of the single quote character.
static char XML_ESCAPE_GT
          Greater character.
static java.lang.String XML_ESCAPE_GT_RP
          XML representation of the greater character.
static char XML_ESCAPE_LT
          Smaller character.
static java.lang.String XML_ESCAPE_LT_RP
          XML representation of the smaller character.
static char XML_ESCAPE_QUOT
          Double quote character.
static java.lang.String XML_ESCAPE_QUOT_RP
          XML representation of the double quote character.
 
Constructor Summary
DBSql()
          Construct a DBSql object.
 
Method Summary
 void extract(java.lang.String table, DBConnection dBCon, java.io.OutputStreamWriter xml)
          This method do a "select *" on a table and write the result in a XML file.
 void insert(java.io.InputStreamReader xmlStream, DBConnection dBCon)
          This method inserts into the database the data contains into an XML file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT

ENCODING

public static final java.lang.String ENCODING
Encoding used for the XML file. Set to UTF-8.

VERSION

public static final java.lang.String VERSION
Version for the XML file. Set to 1.0.

XML_ESCAPE_AMP

public static final char XML_ESCAPE_AMP
Ampersand character.

XML_ESCAPE_AMP_RP

public static final java.lang.String XML_ESCAPE_AMP_RP
XML representation of the ampersand character.

XML_ESCAPE_APOS

public static final char XML_ESCAPE_APOS
Single quote character.

XML_ESCAPE_APOS_RP

public static final java.lang.String XML_ESCAPE_APOS_RP
XML representation of the single quote character.

XML_ESCAPE_GT

public static final char XML_ESCAPE_GT
Greater character.

XML_ESCAPE_GT_RP

public static final java.lang.String XML_ESCAPE_GT_RP
XML representation of the greater character.

XML_ESCAPE_LT

public static final char XML_ESCAPE_LT
Smaller character.

XML_ESCAPE_LT_RP

public static final java.lang.String XML_ESCAPE_LT_RP
XML representation of the smaller character.

XML_ESCAPE_QUOT

public static final char XML_ESCAPE_QUOT
Double quote character.

XML_ESCAPE_QUOT_RP

public static final java.lang.String XML_ESCAPE_QUOT_RP
XML representation of the double quote character.
Constructor Detail

DBSql

public DBSql()
Construct a DBSql object.
Method Detail

extract

public void extract(java.lang.String table,
                    DBConnection dBCon,
                    java.io.OutputStreamWriter xml)
This method do a "select *" on a table and write the result in a XML file.
Parameters:
table - The table name from which we extract the data.
dBCon - The database connection.
xml - The XML file to which we write the data.
Throws:
java.sql.SQLException -  
java.io.IOException -  

insert

public void insert(java.io.InputStreamReader xmlStream,
                   DBConnection dBCon)
This method inserts into the database the data contains into an XML file. The table name is specified into the XML file. If the table already exists and contains data then the method will delete the content of the table first. If the table does not exist then the method will create it.
Parameters:
xmlStream - The XML file from which we read the data.
dBCon - The database connection.
Throws:
EOFException -  
SaxException -  
java.sql.SQLException -  
java.io.IOException -