|
pfc_propertypopulateds
|
|
Full name
|
pfc_u_tabpg_dwproperty_srvmultitable.pfc_propertypopulateds
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
event integer pfc_propertypopulateds()
|
Name
|
Datatype
|
lb_key
|
boolean
|
lb_reg_keyinplace
|
boolean
|
lb_update
|
boolean
|
li_cnt
|
integer
|
li_colcnt
|
integer
|
li_columncount
|
integer
|
li_i
|
integer
|
li_index
|
integer
|
li_rc
|
integer
|
li_reg_whereoption
|
integer
|
li_row
|
integer
|
li_tablecnt
|
integer
|
li_upper
|
integer
|
ls_column
|
string
|
ls_columns
|
string[]
|
ls_keyinplace
|
string
|
ls_reg_keycolumns
|
string[]
|
ls_reg_updatablecolumns
|
string[]
|
ls_registered
|
string
|
ls_table
|
string
|
ls_tables
|
string[]
|
event pfc_propertypopulateds;call super::pfc_propertypopulateds;//////////////////////////////////////////////////////////////////////////////
//
// Function: pfc_propertypopulateds
//
// Access: Public
//
// Arguments: None
//
// Returns: Integer
// 1 if it succeeds.
// -1 if an error occurs.
//
// Description:
// Populate the hidden datastore.
//
//////////////////////////////////////////////////////////////////////////////
//
// 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_cnt
integer li_rc
integer li_index
integer li_row
string ls_registered
string ls_keyinplace
boolean lb_key
boolean lb_update
integer li_i
integer li_columncount
integer li_colcnt
integer li_upper
string ls_tables[]
string ls_table
string ls_columns[]
string ls_column
string ls_reg_keycolumns[]
string ls_reg_updatablecolumns[]
boolean lb_reg_keyinplace
integer li_reg_whereoption
// 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
// Clear out the known information.
ids_data.Reset()
// 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
// Get the table.
ls_table = ls_tables[li_cnt]
// Determine if the table is registered.
If idw_requestor.inv_multitable.of_IsRegistered(ls_table) Then
li_rc = idw_requestor.inv_multitable.of_GetRegistered(ls_table, &
ls_reg_keycolumns, ls_reg_updatablecolumns, lb_reg_keyinplace, li_reg_whereoption)
ls_registered = 'Y'
Else
ls_registered = 'N'
End If
// Insert a row to hold the main table information.
li_row = ids_data.InsertRow(0)
If li_row <=0 Then Return -1
If lb_reg_keyinplace Then ls_keyinplace='Y' Else ls_keyinplace='N'
// First goes the first row.
ids_data.object.pfc_sort.primary[li_row] = 1
ids_data.object.pfc_register.primary[li_row] = ls_registered
ids_data.object.pfc_table.primary[li_row] = ls_table
ids_data.object.pfc_keyinplace.primary[li_row] = ls_keyinplace
ids_data.object.pfc_whereoption.primary[li_row] = li_reg_whereoption
// Get the columns associated with this table.
li_rc = idw_requestor.inv_multitable.of_GetRegisterableColumn(ls_table, ls_columns)
// Loop around all the columns.
li_columncount = UpperBound(ls_columns)
For li_colcnt = 1 to li_columncount
// Insert new rows as needed (one for each column).
If li_colcnt > 1 Then
// Skipping the insertion of the first main row.
li_row = ids_data.InsertRow(0)
If li_row <=0 Then Return -1
End If
// Set the table name.
ids_data.object.pfc_table.primary[li_row] = ls_table
// Get / Set the column name.
ls_column = ls_columns[li_colcnt]
ids_data.object.pfc_column.primary[li_row] = Lower(ls_column)
// Provide default for all columns.
ids_data.object.pfc_key.primary[li_row] = 'N'
ids_data.object.pfc_update.primary[li_row] = 'N'
// Set the Sort order.
ids_data.object.pfc_sort.primary[li_row] = li_colcnt
// Determine if this is a key column.
If ls_registered = 'Y' Then
lb_key = False
li_upper = UpperBound(ls_reg_keycolumns)
For li_i = 1 to li_upper
If ls_reg_keycolumns[li_i] = ls_column Then
lb_key = True
Exit
End If
Next
If lb_key Then
ids_data.object.pfc_key.primary[li_row] = 'Y'
End If
End If
// Determine if this is a Update column.
If ls_registered = 'Y' Then
lb_update = False
li_upper = UpperBound(ls_reg_updatablecolumns)
For li_i = 1 to li_upper
If ls_reg_updatablecolumns[li_i] = ls_column Then
lb_update = True
Exit
End If
Next
If lb_update Then
ids_data.object.pfc_update.primary[li_row] = 'Y'
End If
End If
Next
Next
Return 1
end event