Compile function Copy_TW_USAGE_Record_To_SQL(Connection, Key, Record)

/*****************************************************************************\
	Copies the given TW_USAGE record to the MSSQL database.
	
	History
	-------
	06/29/2010    KRF   Original Programmer
	04/21/2012    KRF   Dropped per David's Request, SQL_MFS Removed so this
	                    won't be called
\*****************************************************************************/

Declare function SQL_Write, SQL_Write_MV, SQL_Format
Ans = ""

// Parse record into a dimensioned array for speed
Dim Rec(10)
MatParse Record into Rec
					    
// List of key names and their values
Keys = "SEQ":@VM:SQL_Format(Key, "INT")

// List of data fields and their values
DataFields  = "REACTOR"    :@VM:SQL_Format(Rec(1), "INT"):@FM
DataFields := "ENTRY_ID"   :@VM:SQL_Format(Rec(4), "STR"):@FM
DataFields := "ENTRY_DATE" :@VM:SQL_Format(Rec(5), "DATE"):@FM
DataFields := "TYPE"       :@VM:SQL_Format(Rec(6), "STR"):@FM
DataFields := "DESC_OF_USE":@VM:SQL_Format(Rec(7), "STR", 1):@FM
DataFields := "ORIENTATION":@VM:SQL_Format(Rec(8), "INT"):@FM
DataFields := "WAFER_SIZE" :@VM:SQL_Format(Rec(9), "STR")

// Write the data to the SQL database
Ans = SQL_Write(Connection, "TW_USAGE", Keys, DataFields)

//-------------------------------------------------------------------------------------------------
// Multi-valued Fields

// SKELETON CODE
If Ans EQ "" AND Rec(2) NE "" then
    
    // List of data fields and their values
    MvFields  = "TW_CNT":@FM:SQL_Format(Rec(2), "INT"):@RM
    MvFields := "TW_CODE_ID":@FM:SQL_Format(Rec(3), "INT")
    
    // Write the data to the SQL database
    Ans = SQL_Write_MV(Connection, "TW_USAGE_CODE", Keys, MvFields);
    
end

Return Ans
