AdventNet Web NMS 4 API Specification

This class is for internal purpose only and is subjected to change. Developers are recommended not to use this API


com.adventnet.nms.db
Class SQLUtility

java.lang.Object
  |
  +--com.adventnet.nms.db.SQLUtility

public abstract class SQLUtility
extends java.lang.Object


Constructor Summary
SQLUtility(java.sql.Connection conn)
           
 
Method Summary
 boolean doesThisColumnExist(java.lang.String tableName, java.lang.String column)
           
 java.util.Vector executeQuery(java.lang.String sql, boolean isSingleColumn, boolean isSingleRow)
           
 java.util.Vector executeQuery(java.lang.String sql, boolean isSingleColumn, boolean isSingleRow, int fromIndex, int viewLength)
           
 java.util.Vector executeQuery(java.lang.String sqlstring, java.lang.String delimiter)
          Executes the given sqlString seperated by string delimiter,add the datas of each resultset into Vector of properties & from that resultant Vector is formed.
 int executeUpdate(java.lang.String sql)
          Executes an SQL INSERT, UPDATE or DELETE statement
 java.lang.String getAlias(java.lang.String columnName)
           
 java.lang.String getAntiAlias(java.lang.String alias)
          METHODS USING JdbcAPI...
 java.sql.Connection getConnection()
           
 java.util.Vector getIntersectionOfPropertyVectors(java.util.Vector v1, java.util.Vector v2)
          As the method name says will return the intersection of two Property Vectors.
 java.util.Vector getNumericColumnsOfTable(java.lang.String tableName)
           
abstract  java.lang.String getOrderByColumn()
          Returns the default order by column name for this module.
abstract  java.lang.String[] getPrimaryKeys()
          This method returns primary properties for this module that would be used in the user property table
 java.util.Vector getPrimaryKeysOfTable(java.lang.String tableName)
           
abstract  java.util.Vector getSpecialKeys()
          This method returns properties that should be returned from the method getTheDataForCustomView.
 java.util.Vector getTablesBelongingToThisModule()
           
 void init(java.lang.String module, java.lang.String basetableClassName, java.lang.String userPropTable)
           
 boolean isNumericField(java.lang.String column)
           
 boolean isNumericField(java.lang.String tableName, java.lang.String column)
           
 java.sql.Statement query(java.lang.String sqlstring)
          Executes the sqlstring, returns the java.sql.Statement if SQL string represents a select query,otherwise null.
 java.util.Vector query(java.lang.String sqlString, java.lang.String delimiter)
          This method returns an Vector containing statements of executed SQL Strings the given multiple sqlstring separated by delimiter string.Given the the delimiter seperated sqlstring and the delimiter itself as args this method tokenizes the string executes each sqlstring and returns the Statements in an Vector form.
 void setConnection(java.sql.Connection conn)
          Sets connection
 void setJdbcAPI(JdbcAPI jdbcApi)
          Sets JdbcAPI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLUtility

public SQLUtility(java.sql.Connection conn)
Method Detail

init

public void init(java.lang.String module,
                 java.lang.String basetableClassName,
                 java.lang.String userPropTable)
Parameters:
module - :String module name
basetableClassName - :String basetable classname
userPropTable - :String User property tablename
Throws:
NmsStorageException - :

setConnection

public void setConnection(java.sql.Connection conn)
Sets connection
Parameters:
conn - : Connection to the database

setJdbcAPI

public void setJdbcAPI(JdbcAPI jdbcApi)
Sets JdbcAPI
Parameters:
jdbcAPI - : Handle to the JdbcAPI

getConnection

public java.sql.Connection getConnection()

getSpecialKeys

public abstract java.util.Vector getSpecialKeys()
This method returns properties that should be returned from the method getTheDataForCustomView.
Returns:
a Vector value

getPrimaryKeys

public abstract java.lang.String[] getPrimaryKeys()
This method returns primary properties for this module that would be used in the user property table
Returns:
a Vector value

getOrderByColumn

public abstract java.lang.String getOrderByColumn()
Returns the default order by column name for this module.
Returns:
'String' default order by column name.

executeQuery

public java.util.Vector executeQuery(java.lang.String sqlstring,
                                     java.lang.String delimiter)
                              throws java.sql.SQLException
Executes the given sqlString seperated by string delimiter,add the datas of each resultset into Vector of properties & from that resultant Vector is formed.
Parameters:
sqlstring - :set of sqlString to be executed which are seperated by delimiter.
delimiter - String delimiter.
Returns:
'Vector'of resultset properties.
Throws:
java.sql.SQLException - :

getIntersectionOfPropertyVectors

public java.util.Vector getIntersectionOfPropertyVectors(java.util.Vector v1,
                                                         java.util.Vector v2)
As the method name says will return the intersection of two Property Vectors. if either of them is null,then the method returns the another Vector. If either of them is empty it will return a empty vector
Parameters:
one - :Vector of Properties
two - :Vector of Properties
Returns:
'Vector' containing the intersection of two Property Vectors

executeQuery

public java.util.Vector executeQuery(java.lang.String sql,
                                     boolean isSingleColumn,
                                     boolean isSingleRow)
                              throws java.sql.SQLException

executeQuery

public java.util.Vector executeQuery(java.lang.String sql,
                                     boolean isSingleColumn,
                                     boolean isSingleRow,
                                     int fromIndex,
                                     int viewLength)
                              throws java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String sql)
                  throws java.sql.SQLException
Executes an SQL INSERT, UPDATE or DELETE statement
Parameters:
sql - :a SQL INSERT, UPDATE or DELETE statement
Returns:
'int' the rows affected by INSERT, UPDATE or DELETE SQL statement
Throws:
java.sql.SQLException - :if a database access error occurs

query

public java.util.Vector query(java.lang.String sqlString,
                              java.lang.String delimiter)
                       throws java.sql.SQLException
This method returns an Vector containing statements of executed SQL Strings the given multiple sqlstring separated by delimiter string.Given the the delimiter seperated sqlstring and the delimiter itself as args this method tokenizes the string executes each sqlstring and returns the Statements in an Vector form.
Parameters:
sqlString - Select queries delimited by the given delimiter
delimiter - delimiter used
Returns:
Vector containing statements of executed SQL Strings
Throws:
java.sql.SQLException - if not able to query

query

public java.sql.Statement query(java.lang.String sqlstring)
                         throws java.sql.SQLException
Executes the sqlstring, returns the java.sql.Statement if SQL string represents a select query,otherwise null. To get the ResultSet from the returned Statement object, use the method java.sql.Statement.getResultSet(). After completing operations in ResultSet, please ensure that you close both the ResultSet and Statement objects. Note Please set the variable "kodi" to true always
Parameters:
sqlstring - the sql query to be executed
kode - should be set to true always
Returns:
an SQL statement
Throws:
java.sql.SQLException - if not able to make the query

getAntiAlias

public java.lang.String getAntiAlias(java.lang.String alias)
METHODS USING JdbcAPI...

getAlias

public java.lang.String getAlias(java.lang.String columnName)

getTablesBelongingToThisModule

public java.util.Vector getTablesBelongingToThisModule()

doesThisColumnExist

public boolean doesThisColumnExist(java.lang.String tableName,
                                   java.lang.String column)

isNumericField

public boolean isNumericField(java.lang.String column)

isNumericField

public boolean isNumericField(java.lang.String tableName,
                              java.lang.String column)

getNumericColumnsOfTable

public java.util.Vector getNumericColumnsOfTable(java.lang.String tableName)

getPrimaryKeysOfTable

public java.util.Vector getPrimaryKeysOfTable(java.lang.String tableName)

AdventNet Web NMS 4 API Specification