public int doCopyRecordsCommand(Script recScript, Map<String,Object> properties)
    {
        int iErrorCode = DBConstants.NORMAL_RETURN;
        Record record = recScript.getTargetRecord(properties, DBParams.RECORD);
        if (record == null)
            return DBConstants.ERROR_RETURN;
        if (properties.get(PARENT_RECORD) != null)
        {
            Record recParent = recScript.getTargetRecord(properties, PARENT_RECORD);
            if (recParent != null)
                record.addListener(new SubFileFilter(recParent));
        }
        Record recDestination = recScript.getTargetRecord(properties, Script.DESTINATION_RECORD);
        try {
            record.close();
            while (record.hasNext())
            {
                record.next();
                recDestination.addNew();
                recDestination.setAutoSequence(false);
                iErrorCode = this.doSubScriptCommands(recScript, properties);
                if (iErrorCode != DBConstants.NORMAL_RETURN)
                    return iErrorCode;
                if (recDestination.getCounterField().isNull())
                    recDestination.setAutoSequence(true);
                try {
                    recDestination.add();
                } catch (DBException ex) {
                    // Ignore duplicate records
                }
            }
        } catch (DBException ex) {
            ex.printStackTrace();
        }
        return DONT_READ_SUB_SCRIPT;
    }
public int doCopyRecordsCommand ( Script recScript , Map < String , Object > properties ) { int iErrorCode = DBConstants . NORMAL_RETURN ; Record record = recScript . getTargetRecord ( properties , DBParams . RECORD ) ; if ( record == null ) return DBConstants . ERROR_RETURN ; if ( properties . get ( PARENT_RECORD ) != null ) { Record recParent = recScript . getTargetRecord ( properties , PARENT_RECORD ) ; if ( recParent != null ) record . addListener ( new SubFileFilter ( recParent ) ) ; } Record recDestination = recScript . getTargetRecord ( properties , Script . DESTINATION_RECORD ) ; try { record . close ( ) ; while ( record . hasNext ( ) ) { record . next ( ) ; recDestination . addNew ( ) ; recDestination . setAutoSequence ( false ) ; iErrorCode = this . doSubScriptCommands ( recScript , properties ) ; if ( iErrorCode != DBConstants . NORMAL_RETURN ) return iErrorCode ; if ( recDestination . getCounterField ( ) . isNull ( ) ) recDestination . setAutoSequence ( true ) ; try { recDestination . add ( ) ; } catch ( DBException ex ) { } } } catch ( DBException ex ) { ex . printStackTrace ( ) ; } return DONT_READ_SUB_SCRIPT ; }
DoCopyRecordsCommand Method.