// BDE - (C) Copyright 1994 by Borland International #include "address.h" // Global data HINSTANCE hInst; HWND hMainWnd; HWND hErrorWnd; BOOL NewRecMode = FALSE; BOOL RangeSet = FALSE; BOOL bIsServer = FALSE; WNDPROC _wpOrigWndProc; FARHOOK lpfnFileHook; UINT16 iMSGFileOK; char far szTblDirectory[DBIMAXPATHLEN+1]; char far szPrivDirectory[DBIMAXPATHLEN+1]; const char far szTblName[DBIMAXTBLNAMELEN] = "address"; const char far szTblType[DBIMAXNAMELEN] = szDBASE; // Field Descriptor - an array of fields associated with the table. FLDDesc ABFAR fldDesc[] = { { // Field 1 - First Name 1, // Field Number "FirstName", // Field Name fldZSTRING, // Field Type fldUNKNOWN, // Field Subtype NAMELEN, // Field Size ( 1 or 0, except // BLOb or CHAR field ) 0, // Decimal places ( 0 ) // computed 0, // Offset in record ( 0 ) 0, // Length in Bytes ( 0 ) 0, // For Null Bits ( 0 ) fldvNOCHECKS, // Validiy checks ( 0 ) fldrREADWRITE // Rights }, { // Field 2 - Last Name 2, "LastName", fldZSTRING, fldUNKNOWN, NAMELEN, 0, 0, 0, 0, fldvNOCHECKS, fldrREADWRITE }, { // Field 3 - Company/Spouse 3, "Spouse", fldZSTRING, fldUNKNOWN, ADDRESSLEN, 0, 0, 0, 0, fldvNOCHECKS, fldrREADWRITE }, { // Field 4 - Address #1 4, "Address1", fldZSTRING, fldUNKNOWN, ADDRESSLEN, 0, 0, 0, 0, fldvNOCHECKS, fldrREADWRITE }, { // Field 5 - Address #2 5, "Address2", fldZSTRING, fldUNKNOWN, ADDRESSLEN, 0, 0, 0, 0, fldvNOCHECKS, fldrREADWRITE }, { // Field 6 - City 6, "City", fldZSTRING, fldUNKNOWN, CITYLEN, 0, 0, 0, 0, fldvNOCHECKS, fldrREADWRITE }, { // Field 7 - State 7, "State", fldZSTRING, fldUNKNOWN, STATELEN, 0, 0, 0, 0, fldvNOCHECKS, fldrREADWRITE }, { // Field 8 - Zip 8, "Zip", fldZSTRING, fldUNKNOWN, ZIPLEN, 0, 0, 0, 0, fldvNOCHECKS, fldrREADWRITE }, { // Field 9 - Phone number #1 9, "Phone1", fldZSTRING, fldUNKNOWN, PHONELEN, 0, 0, 0, 0, fldvNOCHECKS, fldrREADWRITE }, { // Field 10 - Fax/Phone number #2 10, "Phone2", fldZSTRING, fldUNKNOWN, PHONELEN, 0, 0, 0, 0, fldvNOCHECKS, fldrREADWRITE }, { // Field 11 - Date of last contact 11, "LastContct", fldDATE, fldUNKNOWN, 0, 0, 0, 0, 0, fldvNOCHECKS, fldrREADWRITE }, { // Field 12 - Comments blob. Size of blob in // table is 0 as the whole blob is put in the // table. 12, "Comments", fldBLOB, fldstMEMO, 1, 0, 0, 0, 0, fldvNOCHECKS, fldrREADWRITE } }; // Array of field descriptors // The number of fields in the table - note that fldDesc is defined // globally. const unsigned uNumFields = sizeof(fldDesc) / sizeof(fldDesc[0]); // Index Descriptor - an array of indexes associated with the // table. This index array descriptor is going to be added to the // table when the table is created. This is the index descriptor for // the dBASE table. IDXDesc ABFAR idxDBDesc[] = { { // Index #1 - Full Name - Multi Field "", // Name 1, // Number {"FullName"}, // Tag Name ( for dBase ) { NULL }, // Optional Format ( BTREE, // HASH, etc ) FALSE, // Primary? FALSE, // Unique? FALSE, // Descending? TRUE, // Maintained? FALSE, // SubSet? TRUE, // Expression index? NULL, // for QBE only 1, // Fields in key 1, // Length in bytes FALSE, // Index out of date? 0, // Key Type of Expression { NULL }, // Array of field numbers {"FirstName + LastName"},// Key expression { 0 }, // Key Condition FALSE, // Case insensitive 0, // Block size in bytes 0 // Restructure number }, { // Index #2 - Single-Field "", 2, {"LastName"}, { NULL }, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, NULL, 1, 1, FALSE, 0, { 2 }, { 0 }, { 0 }, FALSE, 0, 0 }, { // Index #3 - Single-Field "", 3, {"Address1"}, { NULL }, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, NULL, 1, 1, FALSE, 0, { 4 }, { 0 }, { 0 }, FALSE, 0, 0 }, { // Index #4 - Single Field "", 4, {"Zip"}, { NULL }, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, NULL, 1, 1, FALSE, 0, { 8 }, { 0 }, { 0 }, FALSE, 0, 0 }, { // Index #5 - Single Field "", 5, {"Phone1"}, { NULL }, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, NULL, 1, 1, FALSE, 0, { 9 }, { 0 }, { 0 }, FALSE, 0, 0 } }; // Index Descriptor - an array of indexes associated with the // table. This index array descriptor is going to be added to the // table when the table is created. This is the index descriptor for // both the Paradox and Interbase tables. However, there is no such thing // as a primary index to Interbase so we will need to detect it is an // Interbase table and change the bPrimary field to FALSE. IDXDesc ABFAR idxIBPDDesc[] = { { // Primary Index - Full Name "FullName", // Name 1, // Number { NULL }, // Tag Name ( for dBase ) { NULL }, // Optional Format ( BTREE, // HASH, etc ) TRUE, // Primary? TRUE, // Unique? FALSE, // Descending? TRUE, // Maintained? FALSE, // SubSet? FALSE, // Expression index? NULL, // for QBE only 2, // Fields in key 1, // Length in bytes FALSE, // Index out of date? 0, // Key Type of Expression { 1,2 }, // Array of field numbers { 0 }, // Key expression { 0 }, // Key Condition FALSE, // Case insensitive 0, // Block size in bytes 0 // Restructure number }, { // Case sensitive {"LastName"}, 2, { NULL }, { NULL }, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, NULL, 1, 1, FALSE, 0, { 2 }, { 0 }, { 0 }, FALSE, 0, 0 }, { {"Address1"}, 3, { NULL }, { NULL }, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, NULL, 1, 1, FALSE, 0, { 4 }, { 0 }, { 0 }, FALSE, 0, 0 }, { // Index #4 - Single Field {"Zip"}, 4, { NULL }, { NULL }, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, NULL, 1, 1, FALSE, 0, { 8 }, { 0 }, { 0 }, FALSE, 0, 0 }, { // Index #5 - Single Field {"Phone1"}, 5, { NULL }, { NULL }, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, NULL, 1, 1, FALSE, 0, { 9 }, { 0 }, { 0 }, FALSE, 0, 0 } }; // Number of indexes to be created when the table is created const UINT16 uNumIndexes = sizeof(idxIBPDDesc) / sizeof(idxIBPDDesc[0]); // Number of records to insert from the RC file. const UINT16 uNumRecs = 6;