Package com.nt.udc.db

Class SqlCmdSet

java.lang.Object
com.nt.udc.db.SqlCmdSet
All Implemented Interfaces:
Serializable

public class SqlCmdSet extends Object implements Serializable
Title: SQL Command Set Description: This class is for holding sets of SQL commands necessary to complete a single SQL transaction. As an example, to completely insert a single object into a relational database, it may actually require inserts into multiple tables before the "transaction" is complete. The methods for putting SQL commands into this object do no checking to verify that the Strings contain valid SQL. Copyright: Copyright (c) 2001 Company: Nortel Networks
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Empty constructor, will initialize a zero length set of commands.
    SqlCmdSet(int len)
    This constructor will initialize the command set to be a specific size.
    This constructor will create a command set with a single SQL statement.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(String cmd)
    This method allows you to add a single command to the command set.
    This method will return the complete command set as an array of strings.
    int
    Method will give the actual number of commands in the command set.
    void
    set(String[] cmds)
    This method allows you to set the entire command set at once as an array of individual SQL commands.
    int
    Method will give the size of the command set (not necessarily the number of commands included in it).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SqlCmdSet

      public SqlCmdSet()
      Empty constructor, will initialize a zero length set of commands.
    • SqlCmdSet

      public SqlCmdSet(String cmd)
      This constructor will create a command set with a single SQL statement.
      Parameters:
      cmd - A single SQL statement.
    • SqlCmdSet

      public SqlCmdSet(int len)
      This constructor will initialize the command set to be a specific size.
      Parameters:
      len - The length the command set should be initialized to.
  • Method Details

    • add

      public void add(String cmd)
      This method allows you to add a single command to the command set. The method will check sequentially to see if there is already a vacancy. If there is not, it will grow the command set by one and then append the command.
      Parameters:
      cmd - A single SQL command that should be added to the set.
    • set

      public void set(String[] cmds)
      This method allows you to set the entire command set at once as an array of individual SQL commands. This will overwrite anything already added to the command set.
      Parameters:
      cmds - A String array of commands.
    • getCommandSet

      public String[] getCommandSet()
      This method will return the complete command set as an array of strings. Each String should represent a single SQL command. The commands will be ordered the same as they were entered. This should represent the order the transaction should be.
      Returns:
      This represents the entire command set as an array of String
    • size

      public int size()
      Method will give the size of the command set (not necessarily the number of commands included in it).
      Returns:
      The absolute size of the command set.
    • numberOfCommands

      public int numberOfCommands()
      Method will give the actual number of commands in the command set.
      Returns:
      The number of commands in the command set.