Version 5.8 / Part 2: Implicit type conversion

Integrierte Typkonvertierung

As already indicated in the first part of the blog article on the release of version 5.8, changes were also made to the conzept 16 command set for the processing of 64-bit dataset IDs. This second part describes why this is necessary.

Introduction

The following example 1 demonstrates the problem.

main

  local
  {
    tPrime : int;
  }

{
  tPrime # RecInfo(MyTable,_RecGetPrime);

  // Processing tPrime
  // ...
}

If MyTable is a table with 64-bit data set IDs, the RecInfo() command must also be able to return 64-bit values in principle. The command has therefore been adapted and now has a 64-bit return value (example 2).

main

  local
  {
    tPrime : bigint;
  }

{
  tPrime # RecInfo(MyTable,_RecGetPrime);

  // tPrime as a 64-bit value.
  // ...
}

By changing the local variable tPrime from int to bigint, the 64-bit prime counter can now also be read. However, when switching to version 5.8, all procedures that call RecInfo() would have to be adapted and recompiled. So that this is not necessary and the existing procedure code remains compatible, implicit type conversion is introduced with version 5.8. This allows the assignment of a bigint value to an int value (and vice versa) without calling a conversion function (example 3).

main

  local
  {
    tVal32 : int;
    tVal64 : bigint;
  }

{
  tVal64 # 4711;
  tVal32 # tVal64;
}

Before version 5.8, it would have been necessary to call the conversion function CnvIB() in order to translate the procedure without errors. With implicit type conversion, this is no longer necessary, as the variable tVal64 is implicitly converted to int during assignment. If tVal64 exceeds the value range of tVal32, the runtime error “Value too high” is generated. As the type conversion includes constants, the assignment of the value 4711 to tVal64 also works without the specification of \b. The same applies to the data types byte and word. These are also implicitly converted to and from bigint. The conversion from byte and word to int and back was already possible before version 5.8 without a conversion function.

The implicit type conversion means that the code from example 1 can be executed unchanged and without recompilation in version 5.8. Only when the 64-bit data record IDs of the relevant table are activated does the procedure text have to be adapted in order to avoid runtime errors when assigning RecInfo().

A detailed description of implicit type conversion can be found in the online help.

Commands, events and properties

Not only the RecInfo() command is affected by 64-bit IDs. Other commands, events and properties have also been adapted.

Commands for data record processing

  • RecInfo : The return value and the 3rd argument have been changed to bigint
  • RecRead : The type of the 4th argument, which is used to specify the dataset ID, among other things, has been changed to bigint.

Multiple selection commands for RecList and DataList

The multiple selection for the RecList object is based on a Cte list. The dataset ID is stored here in the spID property.

  • spID : The property type has been changed to bigint.
  • CteInsertItem : The 2nd argument for specifying the ID property has been changed to bigint.
  • CteInsertNode : The 2nd argument for specifying the ID property has been changed to bigint.
  • WinMsdInsert : The 2nd argument for specifying the new element to be included has been changed to bigint.
  • WinMsdDelete : The 2nd argument for specifying the element to be removed has been changed to bigint.
  • WinMsdRead : The 2nd argument for specifying the element to be read has been changed to bigint.

Events

Some events of interface objects receive a dataset ID in the aID or aRecID argument when called. It is now possible to define the argument as bigint. The following code snippet shows this using the EvtLstSelect event as an example.

sub EvtLstSelect
(
  aEvt                 : event;    // Event
  aID                  : bigint;   // Dataset ID of the data record or line number
)
: logic;                           // Will not be evaluated
{
  // aID can be declared as int or bigint.
  return(true);
}

If the arguments of the relevant events are declared as int, a runtime error is triggered if the dataset ID passed is outside the value range of int. This is only the case if the 64-bit dataset IDs are activated in the table and datasets with a dataset ID >= 0x80000000\b actually exist. The following events have been adjusted:

  • EvtHelpTip
  • EvtKeyItem
  • EvtLstDataInit
  • EvtLstEditFinished
  • EvtLstRecControl
  • EvtLstSelect
  • EvtLstSelectRange
  • EvtMenuContext
  • EvtMouseItem
API client and DLL interface

The API client interface and the DLL interface (DllCall()) have been expanded to include functions C16_RecInfo64() and C16_RecRead64().

Leave a Reply

Your email address will not be published. Required fields are marked *

Leave the field below empty!

IHRE EVALUIERUNGSLIZENZ - JETZT ANFORDERN!

TESTEN SIE DIE CONZEPT 16 VOLLVERSION - UNVERBINDLICH und KOSTENFREI

Subscribe to our newsletter

[cleverreach_signup]
WordPress Cookie Notice by Real Cookie Banner