psdi.app.asset.topology.cron

Class SQLRunner

  • java.lang.Object
    • psdi.app.asset.topology.cron.SQLRunner
  • All Implemented Interfaces:
    FixedLoggerNames, FixedLoggers


    public class SQLRunner
    extends java.lang.Object
    implements FixedLoggers
    Run SQL directly in case the mboset API is not applicable, eg, very large database. Make sure the SQL is safe and presents no conflicts against business logic.
    • Constructor Detail

      • SQLRunner

        public SQLRunner()
    • Method Detail

      • executeSql

        public static int executeSql(java.lang.String sql,
                                     UserInfo userInfo)
                              throws MXException,
                                     java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • executeSqlReturnFirstResult

        public static java.lang.Object executeSqlReturnFirstResult(UserInfo userInfo,
                                                                   java.lang.String sql,
                                                                   java.lang.Object[] args)
                                                            throws MXException,
                                                                   java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • ensureSequenceIsGreaterThanLargestValue

        public static long ensureSequenceIsGreaterThanLargestValue(java.lang.String tablename,
                                                                   java.lang.String fieldName,
                                                                   UserInfo userInfo)
                                                            throws MXException,
                                                                   java.rmi.RemoteException
        This process reads the next sequence value for tableName.columnName and compares it to the current max(tableName.sequenceName). If the max() is greater than the current sequence, then we keep generating sequences until we are past the max() value.
        Parameters:
        tablename -
        fieldName -
        userInfo -
        Returns:
        the current value in sequence.
        Throws:
        MXException
        java.rmi.RemoteException
      • nextSequenceValue

        public static long nextSequenceValue(UserInfo userInfo,
                                             java.lang.String tableName,
                                             java.lang.String fieldName)
                                      throws java.rmi.RemoteException,
                                             MXException
        Return the next sequence value for a table.column
        Parameters:
        userInfo -
        tableName -
        fieldName -
        Returns:
        Throws:
        java.rmi.RemoteException
        MXException