home *** CD-ROM | disk | FTP | other *** search
/ Total C++ 2 / TOTALCTWO.iso / borland / 32addres.pak / ADR_DATA.C < prev    next >
C/C++ Source or Header  |  1997-05-06  |  11KB  |  216 lines

  1. // BDE32 3.x - (C) Copyright 1996 by Borland International
  2.  
  3. #include "address.h"
  4.  
  5. // Global data
  6. HINSTANCE   hInst;
  7. HWND        hMainWnd;
  8. HWND        hErrorWnd;
  9. BOOL        NewRecMode = FALSE;
  10. BOOL        RangeSet = FALSE;
  11. BOOL        bIsServer = FALSE;
  12. WNDPROC     _wpOrigWndProc;
  13. FARHOOK     lpfnFileHook;
  14. UINT        iMSGFileOK;
  15.  
  16. char far szTblDirectory[DBIMAXPATHLEN+1];
  17. char far szPrivDirectory[DBIMAXPATHLEN+1];
  18.  
  19. const char far szTblName[DBIMAXTBLNAMELEN] = "address";
  20. const char far szTblType[DBIMAXNAMELEN] = szDBASE;
  21.  
  22. // Field Descriptor - an array of fields associated with the table.
  23. FLDDesc ABFAR fldDesc[] = {
  24.                           { // Field 1 - First Name
  25.                             1,            // Field Number
  26.                             "FirstName",  // Field Name
  27.                             fldZSTRING,   // Field Type
  28.                             fldUNKNOWN,   // Field Subtype
  29.                             NAMELEN,      // Field Size ( 1 or 0, except
  30.                                           // BLOb or CHAR field )
  31.                             0,            // Decimal places ( 0 )
  32.                                           // computed
  33.                             0,            // Offset in record ( 0 )
  34.                             0,            // Length in Bytes  ( 0 )
  35.                             0,            // For Null Bits    ( 0 )
  36.                             fldvNOCHECKS, // Validiy checks   ( 0 )
  37.                             fldrREADWRITE // Rights
  38.                           },
  39.                           { // Field 2 - Last Name
  40.                             2, "LastName", fldZSTRING, fldUNKNOWN,
  41.                             NAMELEN, 0, 0, 0, 0,
  42.                             fldvNOCHECKS, fldrREADWRITE
  43.                           },
  44.                           { // Field 3 - Company/Spouse
  45.                             3, "Spouse", fldZSTRING, fldUNKNOWN,
  46.                             ADDRESSLEN, 0, 0, 0, 0,
  47.                             fldvNOCHECKS, fldrREADWRITE
  48.                           },
  49.                           { // Field 4 - Address #1
  50.                             4, "Address1", fldZSTRING, fldUNKNOWN,
  51.                             ADDRESSLEN, 0, 0, 0, 0,
  52.                             fldvNOCHECKS, fldrREADWRITE
  53.                           },
  54.                           { // Field 5 - Address #2
  55.                             5, "Address2", fldZSTRING, fldUNKNOWN,
  56.                             ADDRESSLEN, 0, 0, 0, 0,
  57.                             fldvNOCHECKS, fldrREADWRITE
  58.                                   },
  59.                           { // Field 6 - City
  60.                             6, "City", fldZSTRING, fldUNKNOWN,
  61.                             CITYLEN, 0, 0, 0, 0,
  62.                             fldvNOCHECKS, fldrREADWRITE
  63.                           },
  64.                           { // Field 7 - State
  65.                             7, "State", fldZSTRING, fldUNKNOWN,
  66.                             STATELEN, 0, 0, 0, 0,
  67.                             fldvNOCHECKS, fldrREADWRITE
  68.                           },
  69.                           { // Field 8 - Zip
  70.                             8, "Zip", fldZSTRING, fldUNKNOWN,
  71.                             ZIPLEN, 0, 0, 0, 0,
  72.                             fldvNOCHECKS, fldrREADWRITE
  73.                           },
  74.                           { // Field 9 - Phone number #1
  75.                             9, "Phone1", fldZSTRING, fldUNKNOWN,
  76.                             PHONELEN, 0, 0, 0, 0,
  77.                             fldvNOCHECKS, fldrREADWRITE
  78.                           },
  79.                           { // Field 10 - Fax/Phone number #2
  80.                             10, "Phone2", fldZSTRING, fldUNKNOWN,
  81.                             PHONELEN, 0, 0, 0, 0,
  82.                             fldvNOCHECKS, fldrREADWRITE
  83.                           },
  84.                           { // Field 11 - Date of last contact
  85.                             11, "LastContct", fldDATE, fldUNKNOWN,
  86.                             0, 0, 0, 0, 0,
  87.                             fldvNOCHECKS, fldrREADWRITE
  88.                           },
  89.                           { // Field 12 - Comments blob. Size of blob in
  90.                             // table is 0 as the whole blob is put in the
  91.                             // table.
  92.                             12, "Comments", fldBLOB, fldstMEMO,
  93.                             1, 0, 0, 0, 0,
  94.                             fldvNOCHECKS, fldrREADWRITE
  95.                           }
  96.                      };  // Array of field descriptors
  97.  
  98. // The number of fields in the table - note that fldDesc is defined
  99. // globally.
  100. const UINT16 uNumFields = sizeof(fldDesc) / sizeof(fldDesc[0]);
  101.  
  102. // Index Descriptor - an array of indexes associated with the
  103. // table. This index array descriptor is going to be added to the
  104. // table when the table is created.  This is the index descriptor for
  105. // the dBASE table.
  106. IDXDesc ABFAR idxDBDesc[] = {
  107.                             {   // Index #1 - Full Name - Multi Field
  108.                                 "",     // Name
  109.                                 1,      // Number
  110.                                 {"FullName"},    // Tag Name ( for dBase )
  111.                                 { NULL },     // Optional Format ( BTREE,
  112.                                               // HASH, etc )
  113.                                 FALSE,        // Primary?
  114.                                 FALSE,        // Unique?
  115.                                 FALSE,        // Descending?
  116.                                 TRUE,         // Maintained?
  117.                                 FALSE,        // SubSet?
  118.                                 TRUE,         // Expression index?
  119.                                 NULL,         // for QBE only
  120.                                 1,            // Fields in key
  121.                                 1,            // Length in bytes
  122.                                 FALSE,        // Index out of date?
  123.                                 0,            // Key Type of Expression
  124.                                 { NULL },     // Array of field numbers
  125.                                 {"FirstName + LastName"},// Key expression
  126.                                 { 0 },        // Key Condition
  127.                                 FALSE,         // Case insensitive
  128.                                 0,            // Block size in bytes
  129.                                 0             // Restructure number
  130.                             },
  131.                             {   // Index #2 - Single-Field
  132.                                 "", 2, {"LastName"}, { NULL }, FALSE,
  133.                                 FALSE, FALSE, TRUE, FALSE, FALSE, NULL, 1,
  134.                                 1, FALSE, 0, { 2 }, { 0 }, { 0 }, FALSE, 0,
  135.                                 0
  136.                             },
  137.                             {   // Index #3 - Single-Field
  138.                                 "", 3, {"Address1"}, { NULL }, FALSE, FALSE,
  139.                                 FALSE, TRUE, FALSE, FALSE, NULL, 1, 1,
  140.                                 FALSE, 0, { 4 }, { 0 }, { 0 }, FALSE, 0, 0
  141.                             },
  142.                             {   // Index #4 - Single Field
  143.                                 "", 4, {"Zip"}, { NULL }, FALSE, FALSE,
  144.                                 FALSE, TRUE, FALSE, FALSE, NULL, 1, 1,
  145.                                 FALSE, 0, { 8 }, { 0 }, { 0 }, FALSE, 0, 0
  146.                             },
  147.                             {   // Index #5 - Single Field
  148.                                 "", 5, {"Phone1"}, { NULL }, FALSE, FALSE,
  149.                                 FALSE, TRUE, FALSE, FALSE, NULL, 1, 1,
  150.                                 FALSE, 0, { 9 }, { 0 }, { 0 }, FALSE, 0, 0
  151.                             }
  152.                         };
  153.  
  154. // Index Descriptor - an array of indexes associated with the
  155. // table. This index array descriptor is going to be added to the
  156. // table when the table is created.  This is the index descriptor for
  157. // both the Paradox and Interbase tables.  However, there is no such thing
  158. // as a primary index to Interbase so we will need to detect it is an
  159. // Interbase table and change the bPrimary field to FALSE.
  160. IDXDesc ABFAR idxIBPDDesc[] = {
  161.                             { // Primary Index - Full Name
  162.                                 "FullName",   // Name
  163.                                 1,            // Number
  164.                                 { NULL },     // Tag Name ( for dBase )
  165.                                 { NULL },     // Optional Format ( BTREE,
  166.                                               // HASH, etc )
  167.                                 TRUE,         // Primary?
  168.                                 TRUE,         // Unique?
  169.                                 FALSE,        // Descending?
  170.                                 TRUE,         // Maintained?
  171.                                 FALSE,        // SubSet?
  172.                                 FALSE,        // Expression index?
  173.                                 NULL,         // for QBE only
  174.                                 2,            // Fields in key
  175.                                 1,            // Length in bytes
  176.                                 FALSE,        // Index out of date?
  177.                                 0,            // Key Type of Expression
  178.                                 { 1,2 },      // Array of field numbers
  179.                                 { 0 },        // Key expression
  180.                                 { 0 },        // Key Condition
  181.                                 FALSE,        // Case insensitive
  182.                                 0,            // Block size in bytes
  183.                                 0             // Restructure number
  184.                             },
  185.                             {   // Case sensitive
  186.                                 {"LastName"}, 2, { NULL }, { NULL }, FALSE,
  187.                                 FALSE, FALSE, TRUE, FALSE, FALSE, NULL, 1,
  188.                                 1, FALSE, 0, { 2 }, { 0 }, { 0 }, FALSE, 0,
  189.                                 0
  190.                             },
  191.                             {   {"Address1"}, 3, { NULL }, { NULL }, FALSE,
  192.                                 FALSE, FALSE, TRUE, FALSE, FALSE, NULL, 1,
  193.                                 1, FALSE, 0, { 4 }, { 0 }, { 0 }, FALSE, 0,
  194.                                 0
  195.                             },
  196.                             {   // Index #4 - Single Field
  197.                                 {"Zip"}, 4, { NULL }, { NULL }, FALSE,
  198.                                 FALSE, FALSE, TRUE, FALSE, FALSE, NULL, 1,
  199.                                 1, FALSE, 0, { 8 }, { 0 }, { 0 }, FALSE, 0,
  200.                                 0
  201.                             },
  202.                             {   // Index #5 - Single Field
  203.                                 {"Phone1"}, 5, { NULL }, { NULL }, FALSE,
  204.                                 FALSE, FALSE, TRUE, FALSE, FALSE, NULL, 1,
  205.                                 1, FALSE, 0, { 9 }, { 0 }, { 0 }, FALSE, 0,
  206.                                 0
  207.                             }
  208.                         };
  209.  
  210. // Number of indexes to be created when the table is created
  211. const UINT16 uNumIndexes = sizeof(idxIBPDDesc) / sizeof(idxIBPDDesc[0]);
  212.  
  213. // Number of records to insert from the RC file.
  214. const UINT16 uNumRecs = 6;
  215.  
  216.