PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Managing automatic identifiers
  • Writing deleted or crossed records
  • Version of the data file after a write operation
  • Managing the binary memos
  • If you are using HWrite with a database in Hyper File 5.5 format
  • Browsing and writing a record
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
HWrite (Function)
In French: HEcrit
ODBCNot available with this kind of connection
Writes a record into a data file without updating the indexes corresponding to all keys used in the data file. The memos are added if necessary (if the management of memos is enabled, HSetMemo).
After the call to HWrite:
  • the integrity errors and the duplicate errors are not checked.
  • if a lock problem occurs (attempt to modify a locked record), HErrorLock returns True and the record is not modified.
    Windows Mobile The management of locks is performed on the HFSQL Client/Server data files and on the data files handled by native access. A HFSQL Mobile record cannot be locked. Indeed, the operating system of Pocket PC does not allow you to lock records.
  • the number of the current record is modified: the current record corresponds to the record written.
Notes:
  • To update the indexes during a write operation, use HAdd or HModify.
    OLE DBNative Accesses HWrite is equivalent to HModify. The indexes on the database are updated.
  • If a key value is modified with HWrite, the index will no longer be consistent. It must be re-indexed (HIndex).
  • This function can be used to write a record into a selection performed by a query (query run with the hWithFilter constant).
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
Versions 19 and later
Android This function is now available for the Android applications.
Android Widget This function is now available in Android Widget mode.
WINDEVJava This function is now available for the Java applications.
New in version 19
Android This function is now available for the Android applications.
Android Widget This function is now available in Android Widget mode.
WINDEVJava This function is now available for the Java applications.
Android This function is now available for the Android applications.
Android Widget This function is now available in Android Widget mode.
WINDEVJava This function is now available for the Java applications.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
// Write a record at the end of file
HWrite(Customer, HNbRec() + 1)
Syntax
<Result> = HWrite([<File Name> [, <Record Number> [, <Options>]]])
<Result>: Boolean
  • True if the writing was performed in the data file,
  • False if an error occurred (lock, ...): the record is not modified. HError is used to identify the error.
<File Name>: Optional character string (with or without quotes)
Name of data file used. If this name is not specified, HWrite handles the last data file used by the last function for HFSQL management (starting with the letter H).
<Record Number>: Optional integer
Number of the record to write. The record loaded in memory is re-written on the specified record.
If this number is greater than the total number of records found in the data file, intermediate deleted records will be created in order for the sequential reading of data file (HRead) to be consistent.
If this parameter is not specified (equal to 0 or to the hCurrentRecNum constant), HWrite modifies the current record found in the data file.
OLE DBNative Accesses HWrite modifies the current record only. You cannot specify a record number other than the current one (to specify the current record number, use the hCurrentRecNum constant).
<Options>: Combination of optional constants
Configures:
  • the mode for calculating the automatic identifier: See Managing the automatic identifier during an addition for more details.
    hWriteDefault
    (Default value)
    If the written record is not a deleted record, the automatic identifier (if it exists) of the record in the data file is re-used.
    If the written record is a deleted record, a new automatic identifier is calculated for the record.
    The hWriteDefault constant is ignored if hWriteDefault is specified with one of the other constants.
    hSetIdAutoThe automatic identifier is not calculated during the write operation: The value of the identifier is the one stored during the write operation.
    The next value of the identifier calculated by the HFSQL engine will correspond to the greatest value of the identifier in the file +1.
    hForceIdAutoThe automatic identifier is not calculated during the write operation: The value of the identifier is the one stored during the write operation.
    hRecalculateIdAutoThe automatic identifier of the record will be re-calculated during the write operation. This constant has priority over hForceIdAuto and hSetIdAuto.

    A WLanguage error is generated if the three constants (hForceIdAuto, hSetIdAuto and hRecalculateIdAuto) are used at the same time.
  • the lock mode applied to the record.
    If no lock constant is specified, the record is not locked.
    hLockWriteLock in write mode: the written 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.
    hLockReadWriteLock in read/write: the written record will be locked in read/write. This record cannot be read or modified by another application. Only the current application can modify it, read it or unlock it.
    hLockNo
    (Default value)
    No lock (even if HStartLock was used): the written record is not locked.

Windows Mobile The management of locks is performed on the HFSQL Client/Server data files and on the data files handled by native access. A HFSQL Mobile record cannot be locked. Indeed, the operating system of Pocket PC does not allow you to lock records.

OLE DBNative Accesses The lock options will have no effect if the locks are not supported by the OLE DB provider or by the Native Access.

Hyper File 5.5 <Options> is ignored.
Remarks

Managing automatic identifiers

By default, the "automatic identifier" item is automatically updated when a record is added into a data file.
The hForceIdAuto and hSetIdAuto constants are used to modify the default behavior of the automatic identifier.
See Managing the automatic identifier for more details.
OLE DBNative Accesses

Special cases
  • If the database generates an automatic identifier, the HFSQL engine keeps this value. If the hForceIdAuto or hSetIdAuto constant is specified, the HFSQL engine replaces the generated value by the requested value.

    Note: the hForceIdAuto constant is equivalent to hSetIdAuto: the automatic identifier calculated by the HFSQL engine during the next addition will be unique in the data file.
  • If no automatic identifier is generated by the database, the HFSQL engine generates the value and assigns it to the automatic identifier.
WINDEVWEBDEV - Server codeiPhone/iPadWindows MobileUniversal Windows 10 AppAjaxExternal languageHFSQLHFSQL Client/ServerHyper File 5.5

Writing deleted or crossed records

If the record number corresponds to a crossed record or to a deleted record, this record is re-enabled.
WINDEVWEBDEV - Server codeiPhone/iPadWindows MobileUniversal Windows 10 AppAjaxExternal languageHFSQLHFSQL Client/ServerHyper File 5.5

Version of the data file after a write operation

If the record was written (no lock problem, etc.), the version number of the data file is modified. To find out the version number, use HVersion.

Managing the binary memos

When a record is modified, the memos are modified if necessary (if the management of memos is enabled by HSetMemo).
Reminder: to initialize a binary memo item, use HLinkMemo.
WINDEVWEBDEV - Server codeAjaxExternal languageHyper File 5.5

If you are using HWrite with a database in Hyper File 5.5 format

The TEXT items are automatically filled with space characters.
WINDEVWEBDEV - Server codeWindows MobileNative Accesses

Browsing and writing a record

If the write operation is performed during a browse, the record written will be visible in the current browse only. If other browse operations have been defined on this database, the record written will only be visible once these browse operations have been re-initialized.
Components
WINDEVWEBDEV - Server code wd230hf.dll
Windows Mobile wp230hf.dll
Java wd230java.jar
Linux wd230hf.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment