Skip navigation links


com.thortech.xl.util.adapters
Class tcUtilJDBCOperations

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


public class tcUtilJDBCOperations
extends java.lang.Object

This class that has JDBC Operations and compliments the tcUtilJDBCClass class Authors: Louis Cheng and Jatan Rajvanshi August 1, 2002.


Constructor Summary
tcUtilJDBCOperations()
          Default Constructor
tcUtilJDBCOperations(java.lang.String psDriver, java.lang.String psUrl, java.lang.String psUsername, java.lang.String psPassword)
          Contructor that sets the parameters for connecting to a database

 

Method Summary
 java.lang.String getMaxStringValueFromPatternMatch(java.lang.String psTableName, java.lang.String psColumnName, java.lang.String psBeforeWildCard, java.lang.String psAfterWildCard)
          Retrieves the maximum value within a group of results that match a specified as psBeforeWildCard%psAfterWildCard.
 java.lang.String getRandomRow(java.lang.String psTablename, java.lang.String psColumnname, java.lang.String psConstraint, java.lang.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(java.lang.String[] args)
          Main Method
 java.lang.String selectStatementDoubleConstraints(java.lang.String psTablename, java.lang.String psColumnname, java.lang.String psFirstConstraint, java.lang.String psFirstValue, java.lang.String psSecondConstraint, java.lang.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
 java.lang.String selectStatementSingleConstraint(java.lang.String psTablename, java.lang.String psColumnname, java.lang.String psConstraint, java.lang.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 Detail

tcUtilJDBCOperations

public tcUtilJDBCOperations()
Default Constructor

tcUtilJDBCOperations

public tcUtilJDBCOperations(java.lang.String psDriver,
                            java.lang.String psUrl,
                            java.lang.String psUsername,
                            java.lang.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 Detail

selectStatementSingleConstraint

public java.lang.String selectStatementSingleConstraint(java.lang.String psTablename,
                                                        java.lang.String psColumnname,
                                                        java.lang.String psConstraint,
                                                        java.lang.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 java.lang.String selectStatementDoubleConstraints(java.lang.String psTablename,
                                                         java.lang.String psColumnname,
                                                         java.lang.String psFirstConstraint,
                                                         java.lang.String psFirstValue,
                                                         java.lang.String psSecondConstraint,
                                                         java.lang.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 java.lang.String getRandomRow(java.lang.String psTablename,
                                     java.lang.String psColumnname,
                                     java.lang.String psConstraint,
                                     java.lang.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 java.lang.String getMaxStringValueFromPatternMatch(java.lang.String psTableName,
                                                          java.lang.String psColumnName,
                                                          java.lang.String psBeforeWildCard,
                                                          java.lang.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(java.lang.String[] args)
Main Method
Parameters:
args -

Skip navigation links


Copyright © 2015, Oracle and/or its affiliates. All rights reserved.