|
pfc_propertyapply
|
|
Full name
|
pfc_u_tabpg_dwproperty_srvmultitable.pfc_propertyapply
|
Access
|
public
|
Extend of
|
|
Return value
|
|
Prototype
|
event pfc_propertyapply()
|
Name
|
Datatype
|
lb_keyinplace
|
boolean
|
lb_registrationerror
|
boolean
|
li_cnt
|
integer
|
li_index
|
integer
|
li_newupper
|
integer
|
li_rc
|
integer
|
li_row
|
integer
|
li_rowcount
|
integer
|
li_stylecurrent
|
integer
|
li_styledesired
|
integer
|
li_tablecnt
|
integer
|
li_whereoption
|
integer
|
ls_column
|
string
|
ls_empty
|
string[]
|
ls_keycolumns
|
string[]
|
ls_msg
|
string
|
ls_table
|
string
|
ls_tables
|
string[]
|
ls_updatecolumns
|
string[]
|
event pfc_propertyapply;call super::pfc_propertyapply;//////////////////////////////////////////////////////////////////////////////
//
// Function: pfc_PropertyApply
//
// Access: Public
//
// Arguments: None
//
// Returns: Integer
// 1 if it succeeds.
// -1 if an error occurs.
//
// Description:
// Apply the requested changes.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
integer li_tablecnt
integer li_newupper
integer li_cnt
integer li_rc
integer li_stylecurrent, li_styledesired
integer li_index
string ls_tables[]
string ls_table
integer li_row
integer li_rowcount
boolean lb_registrationerror = False
boolean lb_keyinplace
integer li_whereoption
string ls_column
string ls_msg
string ls_keycolumns[]
string ls_updatecolumns[]
string ls_empty[]
// Validate references.
If IsNull(idw_requestor) or Not IsValid(idw_requestor) Then
Return -1
End If
If IsNull(idw_requestor.inv_multitable) or Not IsValid(idw_requestor.inv_multitable) Then
Return -1
End If
// -- Make sure there any changes pending.
If Not ib_changespending Then
Return 1
End IF
// -- Unregister all. --
li_rc = idw_requestor.inv_multitable.of_Unregister()
// Get all the Tables.
li_rc = idw_requestor.inv_multitable.of_GetRegisterableTable(ls_tables)
// Loop around all tables.
li_tablecnt = UpperBound(ls_tables)
For li_cnt = 1 to li_tablecnt
// Initialize.
ls_keycolumns = ls_empty
ls_updatecolumns = ls_empty
// Get one table.
ls_table = ls_tables[li_cnt]
// Set the internal data to the table.
li_rowcount = of_SetData(ls_table)
If li_rowcount <= 0 Then Continue
// Determine if this table needs to be registered.
If Upper(ids_data.object.pfc_register.primary[1]) = 'N' Then
// Table will not be registered.
Continue
End If
// Get the data from the main row.
lb_keyinplace = (Upper(ids_data.object.pfc_keyinplace.primary[1]) = 'Y')
li_whereoption = ids_data.object.pfc_whereoption.primary[1]
// Loop around all the columns.
For li_row = 1 to li_rowcount
// Get the column name.
ls_column = ids_data.object.pfc_column.primary[li_row]
// Determine if this is a key column.
If Upper(ids_data.object.pfc_key.primary[li_row]) = 'Y' Then
li_newupper = UpperBound(ls_keycolumns) + 1
ls_keycolumns[li_newupper] = ls_column
End If
// Determine if this is a Update column.
If Upper(ids_data.object.pfc_update.primary[li_row]) = 'Y' Then
li_newupper = UpperBound(ls_updatecolumns) + 1
ls_updatecolumns[li_newupper] = ls_column
End If
Next
// Register the table.
li_rc = idw_requestor.inv_multitable.of_Register(ls_table, ls_keycolumns, &
ls_updatecolumns, lb_keyinplace, li_whereoption)
If li_rc <= 0 Then
lb_registrationerror = True
If Len(ls_msg) >0 Then ls_msg += ', '
ls_msg += ls_table
End If
Next
// Report any problems.
If lb_registrationerror Then
of_MessageBox('pfc_dwproperty_multitable_regfailed',is_msgtitle , &
'Registration of the following table(s) failed:~r~n'+ls_msg, StopSign!, OK!, 1)
End If
Return 1
end event