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

File:DataTypeHelper
Syntax:Static methods only, private constructor to disallow
instance creation
Author(s):Mike Fechner / Consultingwerk Ltd.
Created:Wed Dec 01 16:49:22 CET 2010
Notes:This file is intended for GUI for .NET only



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 Charcater 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 strign
+ 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
+ LOGICAL FromDefaultableBoolean (DefaultableBoolean) Converts a Infragistics DefaultableBoolean to a Progress LOGICAL
+ 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 IsValidInitial (character, character) Verifies if the initial value expression is valid for the given datatype
+ 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 (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
+ 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/?)
+ System.Object ToSystemObject (character, character) Convers 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 Charcater 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 strign
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 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 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 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 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)
Orignal 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 (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 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, vrais
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 System.Object ToSystemObject (character, character)

Purpose: Convers 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-2019 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       08.08.2019 23:57:02