PFX C-lib Functions

available in PFX C-lib Version 5.0

aResult PCLENTRY PclAdd (aDHandle fdh);
The file buffer for the specified file is written to disk as a new record. All on-line indexes are updated by inserting new keys.

aDHandle PCLENTRY PclAllocFile (anInt filno);
Creates a database file handle.

aResult PCLENTRY PclCalcOffset (aDHandle fdh, aLong rno, aLong *offset);
Calculate offset of record in a data file.

aResult PCLENTRY PclChange (aDHandle fdh);
Changes a record in a database file.

aResult PCLENTRY PclCheckConfig (anInt cfgitem, anInt *type, anInt *len);
Returns the type and length of the argument required for a PclSetConfig or PclGetConfig call.

aResult PCLENTRY PclClear (aDHandle fdh);
Clears the file buffer associated with a handle.

aResult PCLENTRY PclClose (aDHandle fdh);
Closes a database file.

aResult PCLENTRY PclCreateFile (aString name, anInt filver, anInt nfield, anInt reclen, aPointer comptable);
Creates a new empty database file.

aResult PCLENTRY PclDelete (aDHandle fdh);
Deletes a record from a database file.

void PCLENTRY PclEncrypt (aString source, aString key, aString dest);
Encrypt a block of data in place using a key.

void PCLENTRY PclExit (void);
Releases all resources held by PFX C-lib.

aResult PCLENTRY PclFieldDef (aDHandle fdh, anInt eno, anInt *typ, anInt *len, anInt *pos, anInt *dpl, anInt *idx, anInt *rfil, anInt *rele);
Retrieves the definition of a field in a file.

aResult PCLENTRY PclFieldSet (aDHandle fdh, anInt eno, anInt typ, anInt len, anInt pos, anInt dpl, anInt idx, anInt rfil, anInt rele);
Changes the definition of a field in a file.

aResult PCLENTRY PclFileDef (aDHandle fdh, anInt *filver, aLong *cursiz, aLong *maxsiz, anInt *nfld, anInt *reclen, aFlag *flags, aPointer comptable);
Retrieves definition information about a database file.

aResult PCLENTRY PclFileSet (aDHandle fdh, aLong size, anInt nfld, aFlag flags);
Set the file size, flags and number of fields for a database file.

aResult PCLENTRY PclFind (aDHandle fdh, aRelop relop, aKeyNo kno);
Find a record in a database file.

aResult PCLENTRY PclFlush (aDHandle fdh);
Forces writing of data in buffer to its data file.

aResult PCLENTRY PclFreeFile (aDHandle fdh);
Releases and invalidates a handle.

aResult PCLENTRY PclFreeHandle (void);
Releases an Operating System file handle.

aResult PCLENTRY PclGetConfig (anInt cfgitem, aPointer data);
Retrieves the value of a specified configuration item.

aResult PCLENTRY PclGetField (aDHandle fdh, anInt eno, aString data);
Retrieves the formatted value of a field from a file buffer.

aResult PCLENTRY PclGetFieldLen (aDHandle fdh, anInt eno, anInt *length);
Gets the length of a field.

aResult PCLENTRY PclGetFieldName (aDHandle fdh, anInt eno, aChar *name);
Gets the name of a field in the database file.

aResult PCLENTRY PclGetFieldRaw (aDHandle fdh, anInt eno, anInt offset, anInt length, aPointer data);
Retrieves the raw binary value of a field from a file buffer.

anInt PCLENTRY PclGetFileHandle (aDHandle fdh);
Retrieves the system file handle for an opened file.

aResult PCLENTRY PclGetInfo (aDHandle fdh, anInt item, aPointer data);
Gets a specific data item from a file.

aFileMode PCLENTRY PclGetMode (aDHandle fdh);
Returns the file mode.

aPointer PCLENTRY PclGetRecPtr (aDHandle fdh);
Returns a pointer to the record buffer containing raw data.

aResult PCLENTRY PclIndexDef (aDHandle fdh, aKeyNo kno, aFlag *bat, anInt *nseg, anInt segs[], anInt flags[] );
Retrieve the definition for an index.

aResult PCLENTRY PclIndexSet (aDHandle fdh, aKeyNo kno, aFlag bat, aFlag update, anInt nseg, anInt segs[], anInt flags[] );
Change the definition for an index.

void PCLENTRY PclInit (void);
Initialise PFX C-lib.

aFlag PCLENTRY PclIsChanged (aDHandle fdh);
Test whether a file buffer has changed.

aFlag PCLENTRY PclIsFound (aDHandle fdh);
Test whether the file buffer contains a found record.

aFlag PCLENTRY PclIsOpen (aDHandle fdh);
Test whether a file is open.

aResult PCLENTRY PclLock (aDHandle fdh);
Lock a file against access by another user.

aResult PCLENTRY PclOpen (aDHandle fdh, aString name, anInt indx);
Opens a database file.

aResult PCLENTRY PclOpenPseudo (aDHandle fdh, anInt reclen, aFlag flags);
Opens an in-memory table.

aResult PCLENTRY PclPathAccess (aChar *name, anInt mode, aChar *fullpath);
Determines whether a particular file is accessible in a given mode.

void PCLENTRY PclPathPack (aChar *dir, aChar *file, aChar *ext, aChar *path);
Construct a path name from a directory, file name and extension.

anInt PCLENTRY PclPathUnpack (aChar *path, aChar *dir, aChar *file, aChar *ext);
Splits a combined path into its separate components.

aResult PCLENTRY PclPurge (aDHandle fdh);
Remove all data records from a database file.

aResult PCLENTRY PclPtrGetField (aDHandle fdh, aPointer recbuf, anInt eno, aString data);
Returns formatted field data extracted from a record pointer.

aResult PCLENTRY PclPtrGetFieldLen (aDHandle fdh, aPointer recbuf, anInt eno, anInt *length);
Gets the length of a field pointer.

aResult PCLENTRY PclPtrGetFieldRaw (aDHandle fdh, aPointer recbuf, anInt eno, anInt offset, anInt length, aPointer data);
Returns a raw field value from a pointer to a record buffer.

aResult PCLENTRY PclPutField (aDHandle fdh, anInt eno, aString data);
Put a formatted value into a field in a file buffer.

aResult PCLENTRY PclPutFieldRaw (aDHandle fdh, anInt eno, anInt offset, anInt length, aPointer data);
Put a raw binary value into a field in a file buffer.

aResult PCLENTRY PclReadIni (aChar *configname, aChar *section);
Read selected sections and information from PFX.INI file.

aResult PCLENTRY PclRegister (aChar *regname, aChar *regcode);
Communicates a registered name and code to the library.

aResult PCLENTRY PclReread (aDHandle fdh);
Rereads the data from a record.

aResult PCLENTRY PclReindex (aDHandle fdh, aLong kmask, aReindexCallback callback);
Rebuild one or more indexes for a database file.

aResult PCLENTRY PclSetChanged (aDHandle fdh);
Sets the changed flag on the file buffer.

aResult PCLENTRY PclSetConfig (anInt cfgitem, aPointer data);
Sets the value of a specified configuration item.

aResult PCLENTRY PclSetFieldName (aDHandle fdh, anInt eno, aChar *name);
Sets the field name for a file.

aResult PCLENTRY PclSetFound (aDHandle fdh);
Sets the found flag on the file buffer.

aResult PCLENTRY PclSetInfo (aDHandle fdh, anInt item, aPointer data);
Sets a specific data item in a file.

aResult PCLENTRY PclSetMode (aDHandle fdh, aFileMode mode);
Set the access more for a database file.

aResult PCLENTRY PclSetSize (aDHandle fdh, aLong size, aFlag flags);
Set the maximum file size and flags for a database file.

aResult PCLENTRY PclSetTransState (anInt state);
Sets or clears transaction state.

aResult PCLENTRY PclSortAddKey (aDHandle fdh, aKeyNo kno);
Adds a key value to an in-memory sort during the build phase.

aResult PCLENTRY PclSortBuild (aDHandle fdh, aKeyNo kno, aReindexCallback callback);
Builds an in-memory sort on a data file.

aResult PCLENTRY PclSortExit (aDHandle fdh, aKeyNo kno);
Closes and releases a sort.

aResult PCLENTRY PclSortInit (aDHandle fdh, aKeyNo kno, aLong maxmem);
Creates and initialises an in-memory sort.

aResult PCLENTRY PclUnlock (aDHandle fdh);
Releases a lock applied to a database file.

anInt PCLENTRY PclTruncate (aDHandle fdh, aLong pos);
Truncates a data file at a specified position.

/* Btrieve support - Mark 4 - not supported in all versions */

aResult PCLENTRY PclGetExtErr (void);
Returns Btrieve extended error.

aResult PCLENTRY PclBtrieve (aDHandle fdh, anInt opcode, aChar *posblk, aChar *databuff, anInt *datalen, aChar *keybuff, anInt keylen, anInt keynum);
Execute a Btrieve specific operation

/* SQL support - Mark 5 - not supported in all versions */

aResult PCLENTRY PclSqlExec (aChar *buff);
Submits a command string for execution as an SQL statement.

aResult PCLENTRY PclSqlOpen (aDHandle fdh, aChar *buff);
Executes an SQL query and returns the result set, one row at a time, in the record buffer of an in-memory table.

aResult PCLENTRY PclSqlFetch (aDHandle fdh);
Fills the table record buffer with the result from a single row of the result set returned by PclSqlOpen.

aResult PCLENTRY PclSqlClose (aDHandle fdh);
Closes the result set returned by PclSqlOpen, and frees SQL resources.

/* Constraint support - not supported in all versions */

aResult PCLENTRY PclSetConstraint (aDHandle fdh, anInt opcode, anInt eno, aRelop relop, aString data);
Sets a constraint for controlling future finds on the file.

/* Advanced data/key management calls */

aResult PCLENTRY PclBuildKey (aDHandle fdh, aKeyNo kno, anInt *klen, aPointer kdata);
Returns the value of a key constructed from the current record buffer at kdata and the length into klen.

aResult PCLENTRY PclFieldClear (aDHandle fdh, anInt eno, anInt sw);
Sets the nominated field value to a high, clear or low value.