open-insight/LSL2/STPROC/COPY_CALIBRATION_RECORD_TO_SQL.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

32 lines
1014 B
Plaintext

Compile function Copy_CALIBRATION_Record_To_SQL(Connection, Key, Record)
/*****************************************************************************\
Copies the given CALIBRATION record to the MSSQL database.
History
-------
04/05/2010 KRF Original Programmer
\*****************************************************************************/
$insert CALIBRATION_EQUATES
Declare function SQL_Write, SQL_Format
Ans = ""
// Parse record into a dimensioned array for speed
Dim Rec(3)
MatParse Record into Rec
// List of key names and their values
Keys = "CL_NO" :@VM:SQL_Format(Field(Key, "*", 1), "INT"):@FM
Keys := "CAL_DT":@VM:SQL_Format(Field(Key, "*", 2), "DATE")
// List of data fields and their values
DataFields = "CAL_BY":@VM:SQL_Format(Rec(CALIBRATION_CAL_BY$), "STR"):@FM
DataFields := "NOTES" :@VM:SQL_Format(Rec(CALIBRATION_NOTES$), "STR")
// Write the data to the SQL database
Ans = SQL_Write(Connection, "CALIBRATION", Keys, DataFields);
Return Ans