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

