|
|
|
|
|
- Managing automatic identifiers
- Reusing the deleted or freed records
- Version of data file after an addition
- Adding a record into a query
- Adding records into a view
- Browsing and adding records
- Slowness when adding or deleting a record for the first time in an HFSQL data file
- Addition into a database in Hyper File 5.5 format
HDuplicateRecord (Function) In french: HDupliqueEnregistrement
Not available with this kind of connection
Duplicates the record read in a data file: the record found in memory is added into the data file (query or view). The indexes corresponding to all the keys used in the data file are automatically updated. The possible memos are added if the management of memos is enabled ( HSetMemo). After the call to HDuplicateRecord: - Automatic error handling is available for several types of error: Duplicate error, Integrity error, Password error, Modification conflict and status error during modification conflict, Blocking error, etc. For more details, see HFSQL error handling help.
- If the management of duplicates is enabled and if the data file contains a unique key, HErrorDuplicates returns True if the value of added key is not unique. The record is not added.
- The added record becomes the current record. The automatic identifier is automatically filled. By default, the current iteration is not affected.
Note The entire record in memory (the content of the previously read record) is written to the data file. Remarks: - This function can also be used on a view or on a query.
- HDuplicateRecord and HAdd are equivalent.
Syntax
<Result> = HDuplicateRecord([<Data file> [, <Options>]])
<Result>: Boolean - True if the record was added,
- False if a problem occurred (integrity error, duplicate error, ...). HError is used to identify the error.
<Data file>: Optional character string Name of the data file, view or query used. If this name is not specified, HDuplicateRecord will use the last data file used by the last HFSQL function (function starting with "H"). <Options>: Optional constant Used to configure:- the effect of addition on the current browse.
- the mode for calculating the automatic identifier. For more details, see Managing the automatic identifier during an addition.
- the lock mode applied to the added record.
JDBC access: lock management is not supported for databases that are accessed through JDBC.
- the management of duplicates.
- the management of integrity.
| | hAffectBrowse | Influence of addition on route: Addition assigns route. For example, HReadNext used after HDuplicateRecord positions on the record found after the added record. The hAffectBrowse constant has priority over the hWriteDefault constant. | hCheckDuplicates | Duplicate management mode: Controls duplicates for this operation, even if duplicate control is switched off (function HSetDuplicates).. A WLanguage error occurs if the hIgnoreDuplicates and hCheckDuplicates constants are used at the same time.
| hCheckIntegrity | Integrity management mode: Checks operation integrity, even if automatic integrity check is disconnected (function HSetIntegrity). A WLanguage error occurs if the hIgnoreIntegrity and hCheckIntegrity constants are used at the same time.
| hForceIDAuto | Automatic identifier calculation mode: The automatic identifier is not calculated when the automation is added.. The identifier corresponds to:- the value assigned to the item through programming (CUSTOMERID = 7 for example)
- the default identifier value specified in the data model editor (if the data file was just opened, with no record read)
- the identifier value found in memory (identifier value for the last record read in the data file).
Once the record is added, the next automatic identifier calculated by the HFSQL engine will be calculated while ignoring the value added by hForceIDAuto. A WLanguage error occurs if the hSetIDAuto and hForceIDAuto constants are used at the same time.
| hIgnoreDuplicates | Duplicate management mode: Ignores duplicate control for this operation, even if automatic duplicate control is connected (function HSetDuplicates).. A WLanguage error occurs if the hIgnoreDuplicates and hCheckDuplicates constants are used at the same time.
| hIgnoreIntegrity | Integrity management mode: Ignores the integrity check on this add operation, even if the automatic integrity check is connected (function HSetIntegrity).. A WLanguage error occurs if the hIgnoreIntegrity and hCheckIntegrity constants are used at the same time.
| hLockNo (default value) | Added record blocking mode No blocking: the added record will not be blocked.
| hLockReadWrite | Blocking mode for added record Lock in read/write mode: the added record will be locked in read and write mode. This record cannot be read or modified by another application. Only the current application can modify it, read it or unlock it. | hLockWrite | Lock mode for added record Lock in write mode: the added record will be locked in write mode. This record can be read by another application but it cannot be modified by another application. Only the current application can modify it or unlock it. | hSetIDAuto | Automatic ID calculation mode The automatic identifier is not calculated at the time of addition: the identifier value will be that memorized at the time of addition. The next identifier value calculated by the HFSQL engine will correspond to the largest identifier value in the data file +1. A WLanguage error occurs if the hSetIDAuto and hForceIDAuto constants are used at the same time. | hWriteDefault (default value) | Influence of addition on route: Addition does not assign current route. For example, HReadNext used after HDuplicateRecord positions on the record found after the current record before the addition. The hAffectBrowse constant has priority over the hWriteDefault constant. |
Remarks Managing automatic identifiers By default, the "automatic identifier" item is automatically updated when a record is added into a data file. There is no need to read the record again to find out the value of the automatic identifier. Simply use the syntax <Nom fichier de données>.<Nom rubrique Identifiant automatique>. The hForceIDAuto and hSetIDAuto constants are used to modify the default behavior of the automatic identifier. Adding a record into a query Adding a record into a query can be performed: - in the query result.
- in the data files handled by the query (hModifyFile constant used in HExecuteQuery or HExecuteSQLQuery). In this case, the hWithFilter constant is automatically selected.
Regardless of how the query is executed (with or without the constant hWithFilterconstant), adding records to a query is only possible for single-file queries. The calculated items specified during the addition are ignored. They are automatically calculated. Caution: - No addition is allowed in a query that uses groups or aggregates.
- Integrity and duplicates are not managed by operations on multi-file queries: it is advisable to use transactions to avoid any problems.
Browsing and adding records You can configure the effect of adding a record during the browse of a data file ( hWriteDefault and hAffectBrowse constants). The operating mode of the earlier versions can be kept by using the hAffectBrowse constant.
Slowness when adding or deleting a record for the first time in an HFSQL data file Accessing a record in an HFSQL data file for the first time may take long. To fix this problem: - Disable the antivirus for .FIC,.NDX,.MMO and.REP files.
- Disable the "Restore the system" option in Windows XP.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|