home *** CD-ROM | disk | FTP | other *** search
- // BDE - (C) Copyright 1994 by Borland International
-
- #include "inventry.h"
-
- // Global data
- HINSTANCE hInst;
- HWND hMainWnd;
- HWND hErrorWnd;
- BOOL NewRecMode = FALSE;
- BOOL RangeSet = FALSE;
- WNDPROC _wpOrigWndProc;
- char szNoneOnOrder[] = "None on Order";
- char far szTblDirectory[DBIMAXPATHLEN+1];
- char far szPrivDirectory[DBIMAXPATHLEN+1];
-
- const char far szTblName[] = "Inventry" ;
- const char far szTblType[] = szPARADOX;
-
- // Fields for the table
- FLDDesc fldDesc[] = {
- {
- 1, // Field Number
- "Item_ID", // Field Name
- fldINT16, // Field Type
- fldUNKNOWN, // Field Subype
- 1, // Field Size
- 0, // Decimal places
- 0, // Offset in record
- 0, // Length in Bytes
- 0, // For Null Bits
- fldvHASCHECKS,// Validiy checks
- fldrREADWRITE // Rights
- }, {
- 2, "Building", fldZSTRING, fldUNKNOWN,
- FLDLENGTH, 0, 0, 0, 0,
- fldvNOCHECKS, fldrREADWRITE
- }, {
- 3, "Item", fldZSTRING, fldUNKNOWN,
- FLDLENGTH, 0, 0, 0, 0,
- fldvNOCHECKS, fldrREADWRITE
- }, {
- 4, "In Stock", fldFLOAT, fldUNKNOWN,
- 0, 0, 0, 0, 0,
- fldvNOCHECKS, fldrREADWRITE
- }, {
- 5, "Cost", fldFLOAT, fldstMONEY,
- 0, 0, 0, 0, 0,
- fldvNOCHECKS, fldrREADWRITE
- }, {
- 6, "Date Ordered", fldDATE, fldUNKNOWN,
- 0, 0, 0, 0, 0,
- fldvNOCHECKS, fldrREADWRITE
- }, {
- 7, "Comment", fldBLOB, fldstMEMO,
- 20, 0, 0, 0, 0,
- fldvNOCHECKS, fldrREADWRITE
- }
- }; // Array of field descriptors
-
- // Validity Check Descriptor - Describes the validity checks. This index
- // is going to be added to the table when the table is created.
- // Note: Beacuse the max value is saved in a string while our example fields
- // are numbers - we need to save the values as the ascii value of our
- // string. In other words the value 3000 needs to fit into the first two
- // bytes of the string (as it is an INT16).
- // To do this we need to use a function called movemem() (you could do it
- // other ways but this is a nice looking workaround). Therefore, we will
- // set the values in the structure as a string and convert it before using
- // it in a function.
- VCHKDesc VchkDesc[] = {
- { // First field validity check - Required field.
- 1, // Field number, this belongs to
- TRUE, // Is a required field
- TRUE, // If True, has min value
- TRUE, // If True, has max value
- FALSE, // If True, has default value
- { "0" }, // Min Value
- { "32767" },// Max Value
- { NULL }, // Default value
- { NULL }, // Picture string
- lkupNONE, // Lookup/Fill type
- { NULL }, // Lookup Table name
- }
- };
-
- // Indexes used by the table
- IDXDesc idxDesc[] = {
- {
- "Item ID", // Name
- 1, // Number
- { NULL }, // Tag Name ( for dBase only)
- { NULL }, // Optional Format
- 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
- },
- {
- "In Stock", 2, { NULL }, { NULL }, FALSE, FALSE,
- FALSE, TRUE, FALSE, FALSE, NULL, 2, 1, FALSE, 0,
- { 4, 1 }, { 0 }, { 0 }, TRUE, 0, 0
- },
- {
- "Item", 3, { NULL }, { NULL }, FALSE, FALSE,
- FALSE, TRUE, FALSE, FALSE, NULL, 1, 1, FALSE,
- 0, { 3 }, { 0 }, { 0 }, FALSE, 0, 0 }
- };
-
- // This is the array of index descrpitions used for the Index listbox
- const pCHAR IndexList[] = {"Item ID - Primary Index", "In Stock - In stock"
- " and ItemId", "Item - Item Name"};
-
- const unsigned uNumFields = sizeof( fldDesc ) / sizeof ( fldDesc[0] ) ;
-
- // Number of indexes to be created when the table is created - note
- // that idxDesc is defined globally.
- const unsigned uNumIndexes = sizeof(idxDesc) / sizeof(idxDesc[0]);
-
- // The number of validity checks.
- const UINT16 uNumVchks = sizeof(VchkDesc) / sizeof(VchkDesc[0]);
-
- const UINT16 uNumRecs = 5; // Number of records to insert
-
-