Namespace: Consultingwerk.Util
Class 
DatabaseHelper Copy to Clipboard
Parent classes:
Inherits: Progress.Lang.Object

File:DatabaseHelper
Purpose:Provides helper routines working with the database
Syntax:Static methods only, private constructor to disallow
instance creation
Author(s):Mike Fechner / Consultingwerk Ltd.
Created:Tue Jan 18 20:36:21 CET 2011
Purpose: Constructor for the DatabaseHelper class
Notes: Disallow instance creation



Top Method Summary
Options Name Purpose
+ ConnectDatabase (character, character) Connects a database with error handling
+ CreateDatabaseAliases (character) Creates database aliases based on a configuration string
+ Consultingwerk.Util.Enum.DatabaseLicenseTypeEnum DatabaseLicense (character) Returns the license (Workgroup or Enterprise) for the database with the given name
+ INTEGER DatabaseNumber (character) Returns the sequence number of a database the ABL session is connected to. This sequence number can be used for functions like LDBNAME or the return-value of the GetRecordsReads() method in this class
+ HANDLE GetDbClient (character) Gets the DB-CLIENT
+ CHARACTER GetDbNameSignature () Returns a comma-delimited list of the logical database names of all connected database names, all alias names and the logical name of the DICTDB
+ RECID GetDictDbRecid () Returns the RECID of the _DB record
+ Consultingwerk.Util.DatabaseStatsRangeSize.RangeSize GetRangeSizes () Returns an array of RangeSize objects indicating the suggested values for -basetable, -baseindex, -tablerangesize, -indexrangesize
+ INT64 GetRecordReads () Returns an int64 array containing the _ActSummary._Summary-RecReads for every connected database
+ INT64 GetRecordReads (int64[]) Returns an int64 array containing the _ActSummary._Summary-RecReads for every connected database subtracted by the values in a start array.
+ SetDbClient (handle, character) Sets the DB-CLIENT
+ CHARACTER UnabbreviatedFieldName (character, character) Returns the unabbreviated field name based on an abbreviated field name
+ CHARACTER UnabbreviatedTableName (character) Returns the unabbreviated table name based on an abbreviated table name
+ CHARACTER UnabbreviatedTableName (character, character) Returns the unabbreviated table name based on an abbreviated table name

Top Constructor Summary
Options Name Purpose
# DatabaseHelper () Constructor for the DatabaseHelper class


Method Detail
Top

PUBLIC ConnectDatabase (character, character)

Purpose: Connects a database with error handling
Notes:

Parameters:
pcDatabaseName CHARACTER
A databasename, used for error messages only
pcConnectParameter CHARACTER
The database connection parameters
Top

PUBLIC CreateDatabaseAliases (character)

Purpose: Creates database aliases based on a configuration string
Notes: The configuration string is a pipe delimited list of
LDBNAME:ALIASNAME ALIASNAME or LDBNAME:ALIASNAME1&ALIASNAME2&...&ALIASNAMEn
sports2000:appdb&dictdb|icfdb:afdb appdb&dictdb|icfdb:afdb

Parameters:
pcAliases CHARACTER
The definition of the aliases to create
Top

PUBLIC Consultingwerk.Util.Enum.DatabaseLicenseTypeEnum DatabaseLicense (character)

Purpose: Returns the license (Workgroup or Enterprise) for the database with the given name
Notes:

Parameters:
pcDatabaseName CHARACTER
Name of the database whose license type is requested
Returns Consultingwerk.Util.Enum.DatabaseLicenseTypeEnum
The license type of the database with the name in pcDatabaseName
Top

PUBLIC INTEGER DatabaseNumber (character)

Purpose: Returns the sequence number of a database the ABL session is connected
to. This sequence number can be used for functions like LDBNAME or
the return-value of the GetRecordsReads() method in this class
Notes:

Parameters:
pcDatabaseName CHARACTER
The logical database name to return the connect sequence number for
Returns INTEGER
The sequence number of a database the ABL session is connected to or ? when the DB is not connected
Top

PUBLIC HANDLE GetDbClient (character)

Purpose: Gets the DB-CLIENT
Notes: Wrapper to GET-DB-CLIENT with better error reporting

Parameters:
pcLogicalDatabaseName CHARACTER
The logical database name
Returns HANDLE
The handle of the client-principal
Top

PUBLIC CHARACTER GetDbNameSignature ()

Purpose: Returns a comma-delimited list of the logical database
names of all connected database names, all alias names
and the logical name of the DICTDB
Notes:

Returns CHARACTER
The comma-delimited signature of the connected database
Top

PUBLIC RECID GetDictDbRecid ()

Purpose: Returns the RECID of the _DB record
Notes: Required for invoking some of the data dictionary, data admin API's

Returns RECID
The RECID of the DICTDB _DB record
Top

PUBLIC Consultingwerk.Util.DatabaseStatsRangeSize.RangeSize GetRangeSizes ()

Purpose: Returns an array of RangeSize objects indicating the
suggested values for -basetable, -baseindex, -tablerangesize,
-indexrangesize
Notes:

Returns Consultingwerk.Util.DatabaseStatsRangeSize.RangeSize
The array of RangeSize instances, 1 per database
Top

PUBLIC INT64 GetRecordReads ()

Purpose: Returns an int64 array containing the _ActSummary._Summary-RecReads
for every connected database
Notes:

Returns INT64
The INT64[] containing the _ActSummary._Summary-RecReads per connected DB
Top

PUBLIC INT64 GetRecordReads (int64[])

Purpose: Returns an int64 array containing the _ActSummary._Summary-RecReads
for every connected database subtracted by the values in a start
array.
Notes: This function is useful for computing the actual number of records
read since the GetRecordsReads() (no parameter) methods was called

Parameters:
iStart INT64
An INT64[] containing the start offset for the records read
Returns INT64
The INT64[] containing the _ActSummary._Summary-RecReads per connected DB since the offset was taken
Top

PUBLIC SetDbClient (handle, character)

Purpose: Sets the DB-CLIENT
Notes: Wrapper to SET-DB-CLIENT with better error reporting

Parameters:
phClientPrincipal HANDLE
The handle of the client-principal
pcLogicalDatabaseName CHARACTER
The logical database name
Top

PUBLIC CHARACTER UnabbreviatedFieldName (character, character)

Purpose: Returns the unabbreviated field name based on an abbreviated field
name
Notes:

Parameters:
pcTableName CHARACTER
The table name (possibly abbreviated)
pcFieldName CHARACTER
The field name (possibly abbreviated)
Returns CHARACTER
The unabbreviated field name
Top

PUBLIC CHARACTER UnabbreviatedTableName (character)

Purpose: Returns the unabbreviated table name based on an abbreviated table
name
Notes:

Parameters:
pcTableName CHARACTER
The abbreviated table name, optionally with DB prefix
Returns CHARACTER
The unabbreviated buffer name (including database name)
Top

PUBLIC CHARACTER UnabbreviatedTableName (character, character)

Purpose: Returns the unabbreviated table name based on an abbreviated table
name
Notes:

Parameters:
pcDatabaseName CHARACTER
The database name
pcTableName CHARACTER
The abbreviated table name
Returns CHARACTER
The unabbreviated buffer name (including database name)


Constructor Detail
Top

PROTECTED DatabaseHelper ()

Purpose: Constructor for the DatabaseHelper class
Notes: Disallow instance creation



©2006-2023 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       15.04.2024 06:16:32