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().

Klicken Sie hier, um die Nutzungsbedingungen für unseren Blog zu lesen.

Leave a Reply

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

Leave the field below empty!

Requests, questions or feedback are welcome:

Terms of use of the comment function in the blog

1. General information

Vectorsoft AG (‘Provider’) provides a public blog for Internet users (‘Users’) on the vectorsoft.de website. The public blog is intended for the exchange of information and ideas. Users who participate with contributions and comments undertake to comply with the blog terms of use and are responsible for the accuracy, appropriateness and freedom from legal infringements of their contributions. By using the comment function in our blog, you accept these terms of use.

2. Netiquette

We ask you to refrain from personal attacks and provocations based on other opinions. Please argue objectively and maintain a constructive discussion culture. Your comment should always be related to the topic in question in order to avoid digressions into other topics. Posting the same comment or several similar comments more than once is not permitted.

3. Prohibition of illegal content

By submitting your comment, you confirm that you are not violating any copyrights or other rights of third parties. Inciting, racist statements, instructions for criminal offences and their glorification, depictions of violence, pornographic content and statements that violate personal rights are prohibited.

4. No advertising

The use of the comment function is not permitted for commercial or party-political purposes. Advertising contributions of any kind will be deleted immediately.

5. Details of the name

When entering your name, pay attention to the principles mentioned above.

6. Source references

If you intend to publish quotes or contributions from third parties, please indicate the respective sources and explain how they relate to the blog post.

7. Violation of the terms of use

Posts that violate this policy will be deleted immediately. If you notice any violations yourself, please send us the link to the comment in question by e-mail to . We expressly point out that we will exclude individual users in the event of repeated or serious violations of these terms of use.

As of: Sept. 2024

Get your Trial Version now!

Test yeet free of charge

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