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

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
      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

      Constructors 
      Constructor and Description
      DBSql()
      Construct a DBSql object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      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

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
      • ENCODING

        public static final java.lang.String ENCODING
        Encoding used for the XML file. Set to UTF-8.
        See Also:
        Constant Field Values
      • VERSION

        public static final java.lang.String VERSION
        Version for the XML file. Set to 1.0.
        See Also:
        Constant Field Values
      • XML_ESCAPE_AMP

        public static final char XML_ESCAPE_AMP
        Ampersand character.
        See Also:
        Constant Field Values
      • XML_ESCAPE_AMP_RP

        public static final java.lang.String XML_ESCAPE_AMP_RP
        XML representation of the ampersand character.
        See Also:
        Constant Field Values
      • XML_ESCAPE_APOS

        public static final char XML_ESCAPE_APOS
        Single quote character.
        See Also:
        Constant Field Values
      • XML_ESCAPE_APOS_RP

        public static final java.lang.String XML_ESCAPE_APOS_RP
        XML representation of the single quote character.
        See Also:
        Constant Field Values
      • XML_ESCAPE_GT

        public static final char XML_ESCAPE_GT
        Greater character.
        See Also:
        Constant Field Values
      • XML_ESCAPE_GT_RP

        public static final java.lang.String XML_ESCAPE_GT_RP
        XML representation of the greater character.
        See Also:
        Constant Field Values
      • XML_ESCAPE_LT

        public static final char XML_ESCAPE_LT
        Smaller character.
        See Also:
        Constant Field Values
      • XML_ESCAPE_LT_RP

        public static final java.lang.String XML_ESCAPE_LT_RP
        XML representation of the smaller character.
        See Also:
        Constant Field Values
      • XML_ESCAPE_QUOT

        public static final char XML_ESCAPE_QUOT
        Double quote character.
        See Also:
        Constant Field Values
      • XML_ESCAPE_QUOT_RP

        public static final java.lang.String XML_ESCAPE_QUOT_RP
        XML representation of the double quote character.
        See Also:
        Constant Field Values
    • 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.
      • 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.