Class tcUtilJDBCOperations

java.lang.Object
com.thortech.xl.util.adapters.tcUtilJDBCOperations

public class tcUtilJDBCOperations extends Object
This class that has JDBC Operations and compliments the tcUtilJDBCClass class Authors: Louis Cheng and Jatan Rajvanshi August 1, 2002.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default Constructor
    tcUtilJDBCOperations(String psDriver, String psUrl, String psUsername, String psPassword)
    Contructor that sets the parameters for connecting to a database
  • Method Summary

    Modifier and Type
    Method
    Description
    getMaxStringValueFromPatternMatch(String psTableName, String psColumnName, String psBeforeWildCard, String psAfterWildCard)
    Retrieves the maximum value within a group of results that match a specified as psBeforeWildCard%psAfterWildCard.
    getRandomRow(String psTablename, String psColumnname, String psConstraint, String psValue)
    Executes a simple select statement to get back a single column from a single table for a double constraint-value pair If more than one record is returned, this method returns any one of the records at random.Hence the name The following query is executed: SELECT columnname FROM tablename WHERE firstConstraint=firstValue
    static void
    main(String[] args)
    Main Method
    selectStatementDoubleConstraints(String psTablename, String psColumnname, String psFirstConstraint, String psFirstValue, String psSecondConstraint, String psSecondValue)
    Executes a simple select statement to get back a single column from a single table for a double constraint-value pair If more than one record is returned, this method returns the first record.The following query is executed: SELECT columnname FROM tablename WHERE firstConstraint=firstValue AND secondConstraint=secondValue
    selectStatementSingleConstraint(String psTablename, String psColumnname, String psConstraint, String psValue)
    Executes a simple select statement to get back a single column from a single table for a single constraint-value pair If more than one record is returned, this method returns the first record.The following query is executed: SELECT columnname FROM tablename WHERE constraint=value

    Methods inherited from class java.lang.Object

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

    • tcUtilJDBCOperations

      public tcUtilJDBCOperations()
      Default Constructor
    • tcUtilJDBCOperations

      public tcUtilJDBCOperations(String psDriver, String psUrl, String psUsername, String psPassword)
      Contructor that sets the parameters for connecting to a database
      Parameters:
      psDriver - The class name of the jdbc driver
      psUrl - The URL of the database
      psUsername - The username required to access the database
      psPassword - The password for the above username
  • Method Details

    • selectStatementSingleConstraint

      public String selectStatementSingleConstraint(String psTablename, String psColumnname, String psConstraint, String psValue)
      Executes a simple select statement to get back a single column from a single table for a single constraint-value pair If more than one record is returned, this method returns the first record.The following query is executed: SELECT columnname FROM tablename WHERE constraint=value
      Parameters:
      psTablename - The name of the table on which the query is made
      psColumnname - The column which is returned
      psConstraint - The constraint column name
      psValue - The value of the constraint which is to be matched
      Returns:
      the first record as string. "norecordfound" if the query returns no records
    • selectStatementDoubleConstraints

      public String selectStatementDoubleConstraints(String psTablename, String psColumnname, String psFirstConstraint, String psFirstValue, String psSecondConstraint, String psSecondValue)
      Executes a simple select statement to get back a single column from a single table for a double constraint-value pair If more than one record is returned, this method returns the first record.The following query is executed: SELECT columnname FROM tablename WHERE firstConstraint=firstValue AND secondConstraint=secondValue
      Parameters:
      psTablename - The name of the table on which the query is made
      psColumnname - The column which is returned
      psFirstConstraint - The first constraint column name
      psFirstValue - The value of the first constraint which is to be matched
      psSecondConstraint - The second constraint column name
      psSecondValue - The value of the second constraint which is to be matched
      Returns:
      the first record as string. "norecordfound" if the query returns no records
    • getRandomRow

      public String getRandomRow(String psTablename, String psColumnname, String psConstraint, String psValue)
      Executes a simple select statement to get back a single column from a single table for a double constraint-value pair If more than one record is returned, this method returns any one of the records at random.Hence the name The following query is executed: SELECT columnname FROM tablename WHERE firstConstraint=firstValue
      Parameters:
      psTablename - The name of the table on which the query is made
      psColumnname - The column which is returned
      psConstraint - The constraint column name
      psValue - The value of the constraint which is to be matched
      Returns:
      any random record as string. "norecordfound" if the query returns no records
    • getMaxStringValueFromPatternMatch

      public String getMaxStringValueFromPatternMatch(String psTableName, String psColumnName, String psBeforeWildCard, String psAfterWildCard)
      Retrieves the maximum value within a group of results that match a specified as psBeforeWildCard%psAfterWildCard.
      Parameters:
      psTableName - table name
      psColumnName - name of the column being checked
      psBeforeWildCard - pattern before wildcard(%)
      psAfterWildCard - patter after wildcard(%)
      Returns:
      string representation of the maximum value
    • main

      public static void main(String[] args)
      Main Method
      Parameters:
      args -