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

/* Variable to control error-handling behavior in FormatDate(date,...). It
allows FormatDateTime() and FormatDateTimeTz() to use the session's default
DATE-FORMAT to be used in cases of error



Top Method Summary
Options Name Purpose
+ CHARACTER ByteArrayToCharacter (Byte[]) Converts a .NET System.Byte[] into an ABL Character value
+ MEMPTR ByteArrayToMemptr (Byte[]) Converts a .NET Byte[] to an ABL MEMPTR
+ System.Byte[] CharacterToByteArray (character) Converts an ABL Character value into a .NET System.Byte[]
+ System.Byte[] CharacterToByteArray (longchar) Converts an ABL Longchar value into a .NET System.Byte[]
+ DATETIME-TZ DateTimeFromDateAndTimeString (date, character) Returns a DateTime-Tz value based on a date and a time string
+ CHARACTER DefaultFormat (character) Returns the ABL Default Format for the given data type
+ CHARACTER DefaultXmlSchemaType (character) Returns the XML default data-type for the given ABL data type
+ DATETIME-TZ EpochToDateTimeTz (int64) Returns a DATETIME-TZ for the given Unit Time stamp (Epoch)
+ CHARACTER FormatDate (date, DateFormat) Produces a string version of a date, formatted per the input date format.
+ CHARACTER FormatDateTime (datetime, DateFormat) Produces a string version of a datetime, with the date formatted per the input date format.
+ CHARACTER FormatDateTimeTz (datetime-tz, DateFormat) Produces a string version of a datetime-tz, with the date formatted per the input date format.
+ LOGICAL FromDefaultableBoolean (DefaultableBoolean) Converts a Infragistics DefaultableBoolean to a Progress LOGICAL
+ DATE FromMdyDateString (character) Returns a date value from an MDY based date string
+ DATETIME FromMdyDateTimeString (character) Returns a date value from an MDY based datetime string
+ DATETIME-TZ FromMdyDateTimeTzString (character) Returns a date value from an MDY based datetime string
+ CHARACTER GetStringFromWideMptr (memptr, integer) Returns an ABL Character value from a double by MEMPTR value
+ CHARACTER HumanReadableInterval (datetime-tz, datetime-tz) Returns a human readable version of an interval
+ LOGICAL IsAblDataType (character) Returns true when the passed in data type name is an ABL primitive type
+ LOGICAL IsDigit (character) Returns TRUE when the passed in character string is a single digit
+ LOGICAL IsValidInitial (character, character) Verifies if the initial value expression is valid for the given datatype
+ CHARACTER LongcharToCharacter (longchar) Returns the CHARACTER representation of a LONGCHAR
+ System.Byte[] MemptrToByteArray (memptr) Converts (copies) a Progress MEMPTR to a .NET System.Byte[]
+ System.Drawing.Image MemPtrToImage (memptr) Converts a Progress MEMPTR (or a BLOB Image to a System.Drawing.Image)
+ ROWID RecidToRowid (int64) Converts a RECID value into an ROWID value
+ ROWID RecidToRowid (recid) Converts a RECID value into an ROWID value
+ INT64 RowidToRecid (rowid) Converts a ROWID value into an RECID value
+ CHARACTER ToAblDataType (DataType) Converts a Progress.Data.DataType Enum member to the corresponding ABL DataType in a Character representation
+ CHARACTER ToAblDataType (DataType) Converts a Progress.Reflect.DataType Enum member to the corresponding ABL DataType in a Character representation
+ CHARACTER ToAblDataType (Type) Converts a System.Type to the corresponding ABL DataType in a Character representation
+ DATE ToDate (character) Returns an DATE value from a CHARACTER value
+ DATETIME ToDateTime (character) Returns an DATETIME value from a CHARACTER value
+ DATETIME-TZ ToDateTimeTz (character) Returns an DATETIME value from a CHARACTER value
+ DECIMAL ToDecimal (character) Returns an DECIMAL value from a CHARACTER value
+ Infragistics.Win.DefaultableBoolean ToDefaultableBoolean (logical) Converts a Progress LOGICAL into an Infragistics DefaultableBoolean
+ Progress.Data.DataType ToEnum (character) Returns the Progress.Data.DataType Enum member matching a Progress DATA-TYPE
+ HANDLE ToHandle (character) Returns a HANDLE value from a CHARACTER value
+ INT64 ToInt64 (character) Returns an INT64 value from a CHARACTER value
+ INTEGER ToInteger (character) Returns an INTEGER value from a CHARACTER value
+ LOGICAL ToLogical (character) Converts common string representations to a logical value (true/false/?)
+ CHARACTER ToMdyDateString (date) Converts the given DATE value to an MDY based string
+ CHARACTER ToMdyDateString (datetime) Converts the given DATETIME value to an MDY based string
+ CHARACTER ToMdyDateString (datetime-tz) Converts the given DATETIME value to an MDY based string
+ System.Object ToSystemObject (character, character) Convert an primitive value (in an ABL Character) into a .NET System.Object
+ System.Type ToSystemType (character) Returns the System.Type matching a Progress DATA-TYPE
+ CHARACTER UnabbreviateDataTypeName (character) Returns the unabbreviated ABL Data Type Name

Top Constructor Summary
Options Name Purpose
# DataTypeHelper () Disallow instance creation


Method Detail
Top

PUBLIC CHARACTER ByteArrayToCharacter (Byte[])

Purpose: Converts a .NET System.Byte[] into an ABL Character value
Notes:

Parameters:
poBytes System.Byte[]
The System.Bytes[] to convert
Returns CHARACTER
The resulting ABL Character value
Top

PUBLIC MEMPTR ByteArrayToMemptr (Byte[])

Purpose: Converts a .NET Byte[] to an ABL MEMPTR
Notes:

Parameters:
poBytes System.Byte[]
The System.Byte[] to convert to a MEMPTR
Returns MEMPTR
The new MEMPTR with the data from the Byte[]
Top

PUBLIC System.Byte[] CharacterToByteArray (character)

Purpose: Converts an ABL Character value into a .NET System.Byte[]
Notes:

Parameters:
pcValue CHARACTER
The Character value to convert
Returns System.Byte[]
The resulting System.Byte[]
Top

PUBLIC System.Byte[] CharacterToByteArray (longchar)

Purpose: Converts an ABL Longchar value into a .NET System.Byte[]
Notes:

Parameters:
pcValue LONGCHAR
The Character value to convert
Returns System.Byte[]
The resulting System.Byte[]
Top

PUBLIC DATETIME-TZ DateTimeFromDateAndTimeString (date, character)

Purpose: Returns a DateTime-Tz value based on a date and a time string
Notes: Supports Time Strings in the Form of hh:mm:ss or hh:mm

Parameters:
pdDay DATE
The day value
pcTime CHARACTER
The time value either as hh:mm:ss or hh:mm
Returns DATETIME-TZ
The resulting DateTime-Tz value
Top

PUBLIC CHARACTER DefaultFormat (character)

Purpose: Returns the ABL Default Format for the given data type
Notes: Creates a single field temp-table and returns the format of the field

Parameters:
pcDataType CHARACTER
The ABL DataType
Returns CHARACTER
The default format for the data type
Top

PUBLIC CHARACTER DefaultXmlSchemaType (character)

Purpose: Returns the XML default data-type for the given ABL data type
Notes: Creates a single field temp-table and returns the XML-DATA-TYPE of the field

Parameters:
pcDataType CHARACTER
The ABL DataType
Returns CHARACTER
The default XML data type for the data type
Top

PUBLIC DATETIME-TZ EpochToDateTimeTz (int64)

Purpose: Returns a DATETIME-TZ for the given Unit Time stamp (Epoch)
Notes:

Parameters:
piEpochValue INT64
The UNIT Time Value
Returns DATETIME-TZ
DATETIME-TZ
Top

PUBLIC CHARACTER FormatDate (date, DateFormat)

Purpose: Produces a string version of a date, formatted per the
input date format.
Notes: If an error is raised, the date is returned formatted per the
session's DATE-FORMAT

Parameters:
pdaDate DATE
The date to format
poDateFormat Consultingwerk.DateFormat
The date format
Returns CHARACTER
A string version of the date, per the date format
Top

PUBLIC CHARACTER FormatDateTime (datetime, DateFormat)

Purpose: Produces a string version of a datetime, with the date formatted
per the input date format.
Notes: If an error is raised, the date is returned formatted per the
session's DATE-FORMAT

Parameters:
pdtDateTime DATETIME
The datetime to format
poDateFormat Consultingwerk.DateFormat
The date format
Returns CHARACTER
A string version of the datetime, per the date format
Top

PUBLIC CHARACTER FormatDateTimeTz (datetime-tz, DateFormat)

Purpose: Produces a string version of a datetime-tz, with the date formatted
per the input date format.
Notes: If an error is raised, the date is formatted per the
session's DATE-FORMAT

Parameters:
pdtzDateTimeTz DATETIME-TZ
The datetime-tz to format
poDateFormat Consultingwerk.DateFormat
The date format
Returns CHARACTER
A string version of the datetime-tz, per the date format
Top

PUBLIC LOGICAL FromDefaultableBoolean (DefaultableBoolean)

Purpose: Converts a Infragistics DefaultableBoolean to a Progress LOGICAL
Notes: Maps DefaultableBoolean:Default to ?

Parameters:
poValue Infragistics.Win.DefaultableBoolean
The DefaultableBoolean value to convert to LOGICAL
Returns LOGICAL
The equivalent LOGICAL value
Top

PUBLIC DATE FromMdyDateString (character)

Purpose: Returns a date value from an MDY based date string
Notes:

Parameters:
pcString CHARACTER
The MDY based date string
Returns DATE
The date value
Top

PUBLIC DATETIME FromMdyDateTimeString (character)

Purpose: Returns a date value from an MDY based datetime string
Notes:

Parameters:
pcString CHARACTER
The MDY based date string
Returns DATETIME
The date value
Top

PUBLIC DATETIME-TZ FromMdyDateTimeTzString (character)

Purpose: Returns a date value from an MDY based datetime string
Notes:

Parameters:
pcString CHARACTER
The MDY based date string
Returns DATETIME-TZ
The date value
Top

PUBLIC CHARACTER GetStringFromWideMptr (memptr, integer)

Purpose: Returns an ABL Character value from a double by MEMPTR
value
Notes: Use only with CPINTERNAL UTF-8 or UTF-16

Parameters:
pmPtr MEMPTR
The MEMPTR retrieved by a Windows API W method
piLength INTEGER
The number of character to retrieve
Returns CHARACTER
The ABL Character value
Top

PUBLIC CHARACTER HumanReadableInterval (datetime-tz, datetime-tz)

Purpose: Returns a human readable version of an interval
Notes: e.g. 2 days 4 hours 10 minutes 6.134 seconds

Parameters:
pdtDateTime1 DATETIME-TZ
The first datetime-tz value
pdtDateTime2 DATETIME-TZ
The second datetime-tz value
Returns CHARACTER
The interval as a human readable version
Top

PUBLIC LOGICAL IsAblDataType (character)

Purpose: Returns true when the passed in data type name is an ABL primitive type
Notes:

Parameters:
pcDataType CHARACTER
An Character value that should be tested for a valid ABL data type
Returns LOGICAL
True when the passed in data type name is an ABL primitive type
Top

PUBLIC LOGICAL IsDigit (character)

Purpose: Returns TRUE when the passed in character string is a single
digit
Notes:

Parameters:
pcChar CHARACTER
The character string
Returns LOGICAL
Logical value indicating if the string is a single digit character
Top

PUBLIC LOGICAL IsValidInitial (character, character)

Purpose: Verifies if the initial value expression is valid for the given datatype
Notes: Supports strings such as TODAY or NOW for DATE and DATETIME

Parameters:
pcDataType CHARACTER
The data type
pcInitial CHARACTER
The initial value expression to validate
Returns LOGICAL
Top

PUBLIC CHARACTER LongcharToCharacter (longchar)

Purpose: Returns the CHARACTER representation of a LONGCHAR
Notes: Returns the first 31991 characters

Parameters:
plLongchar LONGCHAR
The input longchar value
Returns CHARACTER
The CHARACTER value
Top

PUBLIC System.Byte[] MemptrToByteArray (memptr)

Purpose: Converts (copies) a Progress MEMPTR to a .NET System.Byte[]
Notes:

Parameters:
pmptr MEMPTR
The ABL MEMPTR containing the source data
Returns System.Byte[]
A .NET System.Byte[] containing the same data
Top

PUBLIC System.Drawing.Image MemPtrToImage (memptr)

Purpose: Converts a Progress MEMPTR (or a BLOB Image to a System.Drawing.Image)
Notes: The caller is responsible for cleaning up the MEMPTR (SET-SIZE () = 0)
Original source code from http://knowledgebase.progress.com/articles/Article/P145740

Parameters:
pmPtr MEMPTR
The data to be converted to the Image
Returns System.Drawing.Image
The System.Drawing.Image from the data in the MEMPTR
Top

PUBLIC ROWID RecidToRowid (int64)

Purpose: Converts a RECID value into an ROWID value
Notes:

Parameters:
piRecid INT64
The recid value to convert
Returns ROWID
The converted ROWID value
Top

PUBLIC ROWID RecidToRowid (recid)

Purpose: Converts a RECID value into an ROWID value
Notes:

Parameters:
piRecid RECID
The recid value to convert
Returns ROWID
The converted ROWID value
Top

PUBLIC INT64 RowidToRecid (rowid)

Purpose: Converts a ROWID value into an RECID value
Notes:

Parameters:
poRowid ROWID
The rowid value to convert
Returns INT64
The converted RECID value
Top

PUBLIC CHARACTER ToAblDataType (DataType)

Purpose: Converts a Progress.Data.DataType Enum member to the corresponding
ABL DataType in a Character representation
Notes:

Parameters:
poType Progress.Data.DataType
The Progress.Data.DataType to convert into an ABL DataType
Returns CHARACTER
The ABL DataType as a CHARACTER Value
Top

PUBLIC CHARACTER ToAblDataType (DataType)

Purpose: Converts a Progress.Reflect.DataType Enum member to the corresponding
ABL DataType in a Character representation
Notes:

Parameters:
poType Progress.Reflect.DataType
The Progress.Reflect.DataType to convert into an ABL DataType
Returns CHARACTER
The ABL DataType as a CHARACTER Value
Top

PUBLIC CHARACTER ToAblDataType (Type)

Purpose: Converts a System.Type to the corresponding ABL DataType in a Character
representation
Notes: Assumes CHARACTER for System.String, not LONGCHAR or BLOB
Returns BLOB for System.Byte[]

Parameters:
poType System.Type
The System.Type to convert into an ABL DataType
Returns CHARACTER
The ABL DataType as a CHARACTER Value
Top

PUBLIC DATE ToDate (character)

Purpose: Returns an DATE value from a CHARACTER value
Notes: Does return ? on invalid value

Parameters:
pcString CHARACTER
The string value
Returns DATE
The date time value
Top

PUBLIC DATETIME ToDateTime (character)

Purpose: Returns an DATETIME value from a CHARACTER value
Notes: Does return ? on invalid value

Parameters:
pcString CHARACTER
The string value
Returns DATETIME
The date time value
Top

PUBLIC DATETIME-TZ ToDateTimeTz (character)

Purpose: Returns an DATETIME value from a CHARACTER value
Notes: Does return ? on invalid value

Parameters:
pcString CHARACTER
The string value
Returns DATETIME-TZ
The date time tz value
Top

PUBLIC DECIMAL ToDecimal (character)

Purpose: Returns an DECIMAL value from a CHARACTER value
Notes: Does return ? on invalid value

Parameters:
pcString CHARACTER
The string value
Returns DECIMAL
The integer value
Top

PUBLIC Infragistics.Win.DefaultableBoolean ToDefaultableBoolean (logical)

Purpose: Converts a Progress LOGICAL into an Infragistics DefaultableBoolean
Notes: Maps ? to DefaultableBoolean:Default

Parameters:
plValue LOGICAL
The LOGICAL value to convert to DefaultableBoolean
Returns Infragistics.Win.DefaultableBoolean
The equivalent Infragistics.Win.DefaultableBoolean enum value
Top

PUBLIC Progress.Data.DataType ToEnum (character)

Purpose: Returns the Progress.Data.DataType Enum member matching a Progress
DATA-TYPE
Notes:

Parameters:
pcDataType CHARACTER
The ABL DataType to convert from
Returns Progress.Data.DataType
The Progress.Data.DataType Value
Top

PUBLIC HANDLE ToHandle (character)

Purpose: Returns a HANDLE value from a CHARACTER value
Notes: Does return ? on invalid value

Parameters:
pcString CHARACTER
The string value
Returns HANDLE
The handle value
Top

PUBLIC INT64 ToInt64 (character)

Purpose: Returns an INT64 value from a CHARACTER value
Notes: Does return ? on invalid value

Parameters:
pcString CHARACTER
The string value
Returns INT64
The int64 value
Top

PUBLIC INTEGER ToInteger (character)

Purpose: Returns an INTEGER value from a CHARACTER value
Notes: Does return ? on invalid value

Parameters:
pcString CHARACTER
The string value
Returns INTEGER
The integer value
Top

PUBLIC LOGICAL ToLogical (character)

Purpose: Converts common string representations to a logical value (true/false/?)
Notes: Supported input values for TRUE: TRUE, YES, 1, JA, WAHR, +, Oui, vrai
Supported input values for FALSE: FALSE, NO, 0, NEIN, FALSCH, -, nee, non, fault

Parameters:
pcValue CHARACTER
The CHARACTER expression to parse
Returns LOGICAL
The equivalent LOGICAL value
Top

PUBLIC CHARACTER ToMdyDateString (date)

Purpose: Converts the given DATE value to an MDY based string
Notes:

Parameters:
pdaDate DATE
The date value
Returns CHARACTER
The MDY string value
Top

PUBLIC CHARACTER ToMdyDateString (datetime)

Purpose: Converts the given DATETIME value to an MDY based string
Notes:

Parameters:
pdtDateTime DATETIME
The date value
Returns CHARACTER
The MDY string value
Top

PUBLIC CHARACTER ToMdyDateString (datetime-tz)

Purpose: Converts the given DATETIME value to an MDY based string
Notes:

Parameters:
pdtDateTime DATETIME-TZ
The date value
Returns CHARACTER
The MDY string value
Top

PUBLIC System.Object ToSystemObject (character, character)

Purpose: Convert an primitive value (in an ABL Character) into a .NET
System.Object
Notes: Supports CHARACTER, DATE, DECIMAL, INTEGER, INT64, LOGICAL

Parameters:
pcValue CHARACTER
The ABL Value to convert
pcDataType CHARACTER
The ABL Primitive Data Type
Returns System.Object
The .NET System.Object
Top

PUBLIC System.Type ToSystemType (character)

Purpose: Returns the System.Type matching a Progress DATA-TYPE
Notes:

Parameters:
pcDataType CHARACTER
The ABL DataType to convert from
Returns System.Type
The System.Type reference
Top

PUBLIC CHARACTER UnabbreviateDataTypeName (character)

Purpose: Returns the unabbreviated ABL Data Type Name
Notes: Returns ? when the data type name is not an unabbreviated ABL data
type name

Parameters:
pcDataType CHARACTER
The potentially abbreviated data type name
Returns CHARACTER
The unabbreviated data type name or ? when the data type is not a valid abbreviation of an ABL data type name


Constructor Detail
Top

PROTECTED DataTypeHelper ()

Purpose: Disallow instance creation
Notes:



©2006-2023 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       08.12.2024 13:23:37