added LSL2 stored procedures
This commit is contained in:
85
LSL2/STPROC/COPY_NAMES_RECORD_TO_SQL.txt
Normal file
85
LSL2/STPROC/COPY_NAMES_RECORD_TO_SQL.txt
Normal file
@ -0,0 +1,85 @@
|
||||
Compile function Copy_NAMES_Record_To_SQL(Connection, Key, Record)
|
||||
|
||||
/*****************************************************************************\
|
||||
Copies the given NAMES record to the MSSQL database.
|
||||
|
||||
History
|
||||
-------
|
||||
08/09/2010 KRF Original Programmer
|
||||
04/21/2012 KRF Dropped per David's Request, SQL_MFS Removed so this
|
||||
won't be called
|
||||
\*****************************************************************************/
|
||||
|
||||
$insert NAMES_EQU
|
||||
|
||||
Declare function SQL_Write, SQL_Write_MV, SQL_Format
|
||||
Ans = ""
|
||||
|
||||
// Parse record into a dimensioned array for speed
|
||||
Dim Rec(26)
|
||||
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 = "SALUTATION" :@VM:SQL_Format(Rec(NAMES_SALUTATION$), "STR"):@FM
|
||||
DataFields := "FIRST" :@VM:SQL_Format(Rec(NAMES_FIRST$), "STR"):@FM
|
||||
DataFields := "LAST" :@VM:SQL_Format(Rec(NAMES_LAST$), "STR"):@FM
|
||||
DataFields := "TITLE" :@VM:SQL_Format(Rec(NAMES_TITLE$), "STR"):@FM
|
||||
DataFields := "COMMENTS" :@VM:SQL_Format(Rec(NAMES_COMMENTS$), "STR"):@FM
|
||||
DataFields := "CO_ID" :@VM:SQL_Format(Rec(NAMES_CO_ID$), "INT"):@FM
|
||||
DataFields := "ENTRY_ID" :@VM:SQL_Format(Rec(NAMES_ENTRY_ID$), "STR"):@FM
|
||||
DataFields := "ENTRY_DATE" :@VM:SQL_Format(Rec(NAMES_ENTRY_DATE$), "DATE"):@FM
|
||||
DataFields := "EMAIL" :@VM:SQL_Format(Rec(NAMES_EMAIL$), "STR"):@FM
|
||||
DataFields := "REFERRAL_SOURCE":@VM:SQL_Format(Rec(NAMES_REFERRAL_SOURCE$), "STR"):@FM
|
||||
DataFields := "SLS_MAIL_LIST" :@VM:SQL_Format(Rec(NAMES_SLS_MAIL_LIST$), "BIT"):@FM
|
||||
DataFields := "XMAS_CARD" :@VM:SQL_Format(Rec(NAMES_XMAS_CARD$), "BIT"):@FM
|
||||
DataFields := "MAIL_STOP" :@VM:SQL_Format(Rec(NAMES_MAIL_STOP$), "STR"):@FM
|
||||
DataFields := "STATUS" :@VM:SQL_Format(Rec(NAMES_STATUS$), "STR")
|
||||
|
||||
// Write the data to the SQL database
|
||||
Ans = SQL_Write(Connection, "NAMES", Keys, DataFields)
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Multi-valued Fields
|
||||
|
||||
// NAMES_PHONES
|
||||
If Ans EQ "" AND Rec(NAMES_PHONE$) NE "" then
|
||||
|
||||
// List of data fields and their values
|
||||
MvFields = "PHONE" :@FM:SQL_Format(Rec(NAMES_PHONE$), "STR"):@RM
|
||||
MvFields := "PHONE_TYPES":@FM:SQL_Format(Rec(NAMES_PHONE_TYPES$), "STR"):@RM
|
||||
MvFields := "PHONE_EXT" :@FM:SQL_Format(Rec(NAMES_PHONE_EXT$), "INT")
|
||||
|
||||
// Write the data to the SQL database
|
||||
Ans = SQL_Write_MV(Connection, "NAMES_PHONES", Keys, MvFields);
|
||||
|
||||
end
|
||||
|
||||
// NAMES_INTL_PHONES
|
||||
If Ans EQ "" AND Rec(NAMES_INTL_PHONE$) NE "" then
|
||||
|
||||
// List of data fields and their values
|
||||
MvFields = "INTL_PHONE" :@FM:SQL_Format(Rec(NAMES_INTL_PHONE$), "STR"):@RM
|
||||
MvFields := "INTL_PHONE_TYPES":@FM:SQL_Format(Rec(NAMES_INTL_PHONE_TYPES$), "STR"):@RM
|
||||
MvFields := "INTL_PHONE_EXT" :@FM:SQL_Format(Rec(NAMES_INTL_PHONE_EXT$), "INT")
|
||||
|
||||
// Write the data to the SQL database
|
||||
Ans = SQL_Write_MV(Connection, "NAMES_INTL_PHONES", Keys, MvFields);
|
||||
|
||||
end
|
||||
|
||||
// NAMES_MAILER_DETAILS
|
||||
If Ans EQ "" AND Rec(NAMES_MAILER_DATE$) NE "" then
|
||||
|
||||
// List of data fields and their values
|
||||
MvFields = "MAILER_DATE":@FM:SQL_Format(Rec(NAMES_MAILER_DATE$), "DATE"):@RM
|
||||
MvFields := "MAILER_DESC":@FM:SQL_Format(Rec(NAMES_MAILER_DESC$), "STR")
|
||||
|
||||
// Write the data to the SQL database
|
||||
Ans = SQL_Write_MV(Connection, "NAMES_MAILER_DETAILS", Keys, MvFields);
|
||||
|
||||
end
|
||||
|
||||
Return Ans
|
Reference in New Issue
Block a user