diff --git a/LSL2/STPROC/COPY_TEST_WAFER_PROD_RECORD_TO_SQL.txt b/LSL2/STPROC/COPY_TEST_WAFER_PROD_RECORD_TO_SQL.txt new file mode 100644 index 0000000..fa9e6c0 --- /dev/null +++ b/LSL2/STPROC/COPY_TEST_WAFER_PROD_RECORD_TO_SQL.txt @@ -0,0 +1,37 @@ +Compile function Copy_Test_Wafer_Prod_Record_To_SQL(Connection, Key, Record) + +/*****************************************************************************\ + Copies the given TEST_WAFER_PROD (to be renamed) PRODUCT record to the MSSQL database. + + History + ------- + 09/10/2025 DJS Original Programmer +\*****************************************************************************/ + +$insert TEST_WAFER_PROD_EQUATES + +Declare function SQL_Write, SQL_Write_MV, SQL_Format +Ans = "" + +// Parse record into a dimensioned array for speed +Dim Rec(5) +MatParse Record into Rec + +// List of key names and their values +Keys = "PRODUCT_ID":@VM:SQL_Format(Key, "STR") + +// List of data fields and their values +DataFields = "PART_NAME" :@VM:SQL_Format(Rec(TEST_WAFER_PROD_PART_NAME$), "STR"):@FM +DataFields := "USAGE" :@VM:SQL_Format(Rec(TEST_WAFER_PROD_USAGE$), "INT"):@FM +DataFields := "SORT_ORDER" :@VM:SQL_Format(Rec(TEST_WAFER_PROD_SORT_ORDER$), "INT") + +// Symbolics + +// Write the data to the SQL database +Ans = SQL_Write(Connection, "PRODUCT", Keys, DataFields); + +//------------------------------------------------------------------------------------------------- +// Multi-valued Fields + +Return Ans + diff --git a/LSL2/STPROC/DELETE_TEST_WAFER_PROD_RECORD_FROM_SQL.txt b/LSL2/STPROC/DELETE_TEST_WAFER_PROD_RECORD_FROM_SQL.txt new file mode 100644 index 0000000..166838a --- /dev/null +++ b/LSL2/STPROC/DELETE_TEST_WAFER_PROD_RECORD_FROM_SQL.txt @@ -0,0 +1,30 @@ +Compile function Delete_Test_Wafer_Prod_Record_From_SQL(Connection, Key, Record) + +/*****************************************************************************\ + Deletes the given TEST_WAFER_PROD (to be renamed PRODUCT) record from the MSSQL database. + + History + ------- + 09/10/2025 DJS Original Programmer +\*****************************************************************************/ + +Declare function SQL_Delete, SQL_Format +Ans = "" + +// List of key names and their values +Keys = "PRODUCT_ID":@VM:SQL_Format(Key, "STR") + +//------------------------------------------------------------------------------------------------- +// Multi-valued Fields + +!! Delete records from MV tables first !! + +// Currently no multi-value (child) tables + +// OPERATION +If Ans EQ "" then + Ans = SQL_Delete(Connection, "PRODUCT", Keys) +end + +Return Ans +