PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Records read
  • Browsing a data file
  • Memos
  • Locks
  • Various
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
Reads a record in a data file according to a given record number. This read mode is called "Direct access". The record read is loaded in memory. HState is used to find out the record status (active, crossed or deleted).
In most cases, HRead is used to position in the data file in order to perform a read loop by specifying the record number.
Several cases may occur after the call to HRead:
  • the specified record number does not exist (greater than the total number of records or negative): no reading is performed and HOut returns True.
  • the specified record number does not exist anymore (crossed record, deleted record, ...): no read operation is performed and HOut returns False.
    Use HState to find out the record status.
  • the data file is empty: HOut returns True.
  • the function tries to lock a record that is already locked in read-only: HErrorLock returns True and HOut returns True.
    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.
    Java Access by JDBC: The management of locks is not available for the databases accessed by JDBC.
This function can be used with the data files (indexed or not) and with the HFSQL views.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
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
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget 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 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
// Sequential browse to display the name of all customers
i is int
FOR i = 1 _TO_ HNbRec(CUSTOMER, hStateAll)
HRead(CUSTOMER, i)
IF HState() = hStateActive THEN
Info("Customer name: " + CUSTOMER.NAME)
END
END
Syntax
<Result> = HRead([<File Name> [, <Record Number> [, <Options>]]])
<Result>: Boolean
  • True if the record was read,
  • False if an error occurred (lock, end of data file, ...): the record is not read. HError is used to identify the error.
<File Name>: Optional character string (with or without quotes)
Name of HFSQL data file, view or query used.
If this parameter corresponds to an empty string (""), HRead 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 read.
If this parameter is not specified (or if it is equal to 0 or to the hCurrentRecNum constant), HRead handles the current record.
OLE DBNative Accesses HRead reads the current record. You cannot specify a record number other than the current one. To specify the current record number, use the hCurrentRecNum constant.
Java Access by JDBC: HRead reads the current record. You cannot specify a record number other than the current one. To specify the current record, use the hCurrentRecNum constant.
<Options>: Optional constant
Configures the lock performed on the record read by HRead:
hLockNoNo lock (even if HStartLock was called): the record can be read or modified by another application during the reading.
hLockWriteLock in write mode: the record currently read can be read by another application but it cannot be modified by another application.
hLockReadWriteLock in read/write: the record currently read cannot be read or modified by another application.
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.
Hyper File 5.5 The lock options are ignored. Use the lock functions (HLockRecNum) kept for backward compatibility.
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.
Java Access by JDBC: This parameter is ignored.
Remarks
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppJavaAjaxUser code (UMC)External languageHFSQLHFSQL Client/ServerStored proceduresHyper File 5.5

Records read

HRead is the only function that can be used to access a crossed or deleted record. If the record is deleted, the content of the record is not valid anymore.

Browsing a data file

HRead cannot be used to continue a browse started by HReadFirst, HReadNext.

Memos

The memos associated with the record can be automatically read (or not) when reading the record. HSetMemo is used to customize this automatic read operation.
If the memos are supported, the associated text memos are read when the record is read. The binary memos are read only when they are explicitly used (HExtractMemo).
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppAjaxUser code (UMC)External languageHFSQLHFSQL Client/ServerStored proceduresHyper File 5.5OLE DBNative Accesses

Locks

By default (<Options> not specified), no lock operation is performed on the record.
If a lock is requested (hLockWrite or hLockReadWrite constant), the record will be read only if this record is not already locked.
There is no need to specify a lock parameter if the data file is locked by HStartLock: the lock specified by HStartLock is automatically taken into account. To ignore the lock specified by HStartLock, use the hLockNo constant.
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.

Various

The result of HFound must be ignored (HFound must be used for the searches performed by HReadSeekFirst and HReadSeekLast).
The current record number is returned by HRecNum. The first record found in the data file is record #1.
Components
WINDEVWEBDEV - Server codeReports and Queries 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