Compile Subroutine Pass_To_SQL(Process, Table, ID)

/*****************************************************************************\
	Passes updated OI data to SQL from the SQL_MFS procedure
	
	History
	-------
	06/10/2010    PCS   Original Programmer
	07/18/2018    dmb   Disable call to SRP_TcpClient/SRP Engine Server since this can't be processed by the
	                    Application Server.
\*****************************************************************************/

$insert SRPMAIL_INSERTS

Common /PASS_TO_SQL/ TCPServerSettings@

Declare Function SRP_TcpClient, DateTime, Get.RecCount, Environment_Services, Database_Services, Ucase
Declare Subroutine SRP_TcpClient

If Assigned(Process) else Process = ""
If Assigned(ID) else ID = ""
If Assigned(Table) else Table = ""

NonCriticalTables = Database_Services('ReadDataRow', 'APP_INFO', 'NONCRITICAL_SQL_TABLES')

If Process AND ID AND Table then

    Open "SQL_BACKLOG" to hSqlBacklog then
        CurrDate = Date()
        // Log the record
        Locate Table in NonCriticalTables using @FM setting Dummy then
            bKey = Table:"*":ID:"*":UCase(Process)
        end else
            CurrTime = Time()
            bKey     = Table:"*":ID:"*":UCase(Process):'*':CurrDate:'*':CurrTime
        end
        Write DateTime() to hSqlBacklog, bKey
        !! Always log it for redudancy. !!
        Open "SQL_LOG" to hSqlLog then 
            Read Log from hSqlLog, CurrDate then
                Log := @FM:bKey:@VM:'QUEUED'
            end else
                Log = bKey:@VM:'QUEUED'
            end
            Write Log to hSqlLog, CurrDate
        end
    end
end

Return


