Accessing Pervasive.SQL With Perl

Page Last Modified: 17/03/14

Home Links ODBC (DBI) Contact

Win32::API - BTRCALL (1 of 3)

The BTRCALL function prototype is documented as follows for calling via C (from the Pervasive.SQL BTRAPI.H header file):

BTI_API BTRCALL(
BTI_WORD operation,
BTI_VOID_PTR posBlock,
BTI_VOID_PTR dataBuffer,
BTI_ULONG_PTR dataLength,
BTI_VOID_PTR keyBuffer,
BTI_BYTE keyLength,
BTI_CHAR ckeynum
);

For 32-bit Windows, replacing the Pervasive.SQL/Btrieve typedefs with basic C types (as described in BTITYPES.H), we get:

extern short int WINAPI BTRCALL(
unsigned short operation,
void *posBlock,
void *dataBuffer,
unsigned long *dataLength,
void *keyBuffer,
unsigned char keyLength,
char ckeynum
);

operation specifies the type of database operation (insert, get-equal, etc.);
posBlock points to a block of memory supplied to the database engine to use as the position block for tracking the current position in the file/table (like an SQL cursor); your application should not modify this directly;
dataBuffer points to a block of memory usually used to receiving the contents of a located record, or for holding the contents of a record that is to be inserted/updated;
dataLength is for specifying the size of dataBuffer;
keyBuffer points to a block of memory that specifies the key used to locate a record, or is to receive a key once a record is located;
keyLength is for specifying the size of keyBuffer;
ckeynum is for specifying which key is being used.

So that's the function...now we have to call it from Win32::API.

Home Links ODBC (DBI) Contact

All content on this site is copyright
Neil Hughes 2010 - 2018