// StBDE32.CC
// Last modified on 11/26/1999
// Copyright (C) 1994, 1998 Jim Sare. All rights reserved.
// Email: jimsare@worldnet.att.net
//
// Add class sFLDType - M.Kay, dBI Inc. - 11/11/2004

#define DBIREADWRITE					0
#define DBIREADONLY					1

#define DBIOPENSHARED				0
#define DBIOPENEXCL					1

#define XLTNONE						0
#define XLTRECORD						1
#define XLTFIELD						2

#define PRVNONE						0
#define PRVREADONLY					1
#define PRVMODIFY						3
#define PRVINSERT						7
#define PRVINSDEL						15
#define PRVFULL						31
#define PRVUNKNOWN					255

CLASS sCURProps Of BaseStruct(427) From :coreShared:StBase.CC

	FUNCTION szName

		RETURN this.GetSBCSString(0, 261, False, True)

	FUNCTION iFNameSize

		RETURN this.GetU16(261)

	FUNCTION szTableType

		RETURN this.GetSBCSString(263, 32, False, True)

	FUNCTION iFields

		RETURN this.GetU16(295)

	FUNCTION iRecSize

		RETURN this.GetU16(297)

	FUNCTION iRecBufSize

		RETURN this.GetU16(299)

	FUNCTION iKeySize

		RETURN this.GetU16(301)

	FUNCTION iIndexes

		RETURN this.GetU16(303)

	FUNCTION iValChecks

		RETURN this.GetU16(305)

	FUNCTION iRefIntChecks

		RETURN this.GetU16(307)

	FUNCTION iBookMarkSize

		RETURN this.GetU16(309)

	FUNCTION bBookMarkStable

		RETURN this.GetU16(311) # 0

	FUNCTION DBIOpenMode

		RETURN this.GetU16(313)

	FUNCTION DBIShareMode

		RETURN this.GetU16(317)

	FUNCTION bIndexed

		RETURN this.GetU16(321) # 0

	FUNCTION iSeqNums

		RETURN this.Get16(323)

	FUNCTION bSoftDeletes

		RETURN this.GetU16(325) # 0

	FUNCTION bDeletedOn

		RETURN this.GetU16(327) # 0

	FUNCTION iRefRange

		RETURN this.GetU16(329)

	FUNCTION exltMode

		RETURN this.GetU16(331)

	FUNCTION iRestrVersion

		RETURN this.GetU16(335)

	FUNCTION bUniDirectional

		RETURN this.GetU16(337) # 0

	FUNCTION eprvRights

		RETURN this.GetU16(339)

	FUNCTION Dummy4

		RETURN this.GetU16(341)

	FUNCTION iFmlRights

		RETURN this.GetU16(343)

	FUNCTION iPasswords

		RETURN this.GetU16(345)

	FUNCTION iCodePage

		RETURN this.GetU16(347)

	FUNCTION bProtected

		RETURN this.GetU16(349) # 0

	FUNCTION iTblLevel

		RETURN this.GetU16(351)

	FUNCTION szLangDriver

		RETURN this.GetSBCSString(353, 32, False, True)

	FUNCTION bFieldMap

		RETURN this.GetU16(385) # 0

	FUNCTION iBlockSize

		RETURN this.GetU16(387)

	FUNCTION bStrictRefInt

		RETURN this.GetU16(389) # 0

	FUNCTION iFilters

		RETURN this.GetU16(391)

	FUNCTION bTempTable

		RETURN this.GetU16(393) # 0

	FUNCTION iUnused(i, n)

		If (PCount() > 0) And (i > 0) And (i < 17)
			If PCount() > 1
				this.SetU16(395 + ((i - 1) * 2), n)
			EndIf
			RETURN this.GetU16(395 + ((i - 1) * 2))
		EndIf
		RETURN -1

	PROCEDURE LogoutData

		? "szName:          " + this.szName()
		? "iFNameSize:      " + this.iFNameSize()
		? "szTableType:     " + this.szTableType()
		? "iFields:         " + this.iFields()
		? "iRecSize:        " + this.iRecSize()
		? "iRecBufSize:     " + this.iRecBufSize()
		? "iKeySize:        " + this.iKeySize()
		? "iIndexes:        " + this.iIndexes()
		? "iValChecks:      " + this.iValChecks()
		? "iRefIntChecks:   " + this.iRefIntChecks()
		? "iBookMarkSize:   " + this.iBookMarkSize()
		? "bBookMarkStable: " + this.bBookMarkStable()
		? "DBIOpenMode:     " + this.DBIOpenMode()
		? "DBIShareMode:    " + this.DBIShareMode()
		? "bIndexed:        " + this.bIndexed()
		? "iSeqNums:        " + this.iSeqNums()
		? "bSoftDeletes:    " + this.bSoftDeletes()
		? "bDeletedOn:      " + this.bDeletedOn()
		? "iRefRange:       " + this.iRefRange()
		? "exltMode:        " + this.exltMode()
		? "iRestrVersion:   " + this.iRestrVersion()
		? "bUniDirectional: " + this.bUniDirectional()
		? "eprvRights:      " + this.eprvRights()
		? "Dummy4:          " + this.Dummy4()
		? "iFmlRights:      " + this.iFmlRights()
		? "iPasswords:      " + this.iPasswords()
		? "iCodePage:       " + this.iCodePage()
		? "bProtected:      " + this.bProtected()
		? "iTblLevel:       " + this.iTblLevel()
		? "szLangDriver:    " + this.szLangDriver()
		? "bFieldMap:       " + this.bFieldMap()
		? "iBlockSize:      " + this.iBlockSize()
		? "bStrictRefInt:   " + this.bStrictRefInt()
		? "iFilters:        " + this.iFilters()
		? "bTempTable:      " + this.bTempTable()
		? "iUnused        " + "1: " + this.iUnused(1)
		For i = 2 To 16
			? "              " + IIf(i < 10, " ", "") + i + ": " + this.iUnused(i)
		EndFor

ENDCLASS  // sCURProps Of BaseStruct


CLASS sIDXDesc Of BaseStruct(893) From :coreShared:StBase.CC

	FUNCTION szName(c)

		If PCount() > 0
			this.SetSBCSString(0, c, True)
		EndIf
		RETURN this.GetSBCSString(0, 261, False, True)

	FUNCTION iIndexID(n)

		If PCount() > 0
			this.SetU16(261, n)
		EndIf
		RETURN this.GetU16(261)

	FUNCTION szTagName(c)

		If PCount() > 0
			this.SetSBCSString(263, c, True)
		EndIf
		RETURN this.GetSBCSString(263, 32, False, True)

	FUNCTION szFormat(c)

		If PCount() > 0
			this.SetSBCSString(295, c, True)
		EndIf
		RETURN this.GetSBCSString(295, 32, False, True)

	FUNCTION bPrimary(l)

		If PCount() > 0
			this.SetU16(327, IIf(l, 1, 0))
		EndIf
      //QAID: 4421 - D.Brooks - 03/09/2005
      RETURN this.GetU16(327) # 0
		//RETURN this.Get32(327) # 0

	FUNCTION bUnique(l)

		If PCount() > 0
			this.SetU16(329, IIf(l, 1, 0))
		EndIf
      //QAID: 4421 - D.Brooks - 03/09/2005
      RETURN this.GetU16(329) # 0
		//RETURN this.Get32(329) # 0

	FUNCTION bDescending(l)

		If PCount() > 0
			this.SetU16(331, IIf(l, 1, 0))
		EndIf
		RETURN this.Get16(331) # 0

	FUNCTION bMaintained(l)

		If PCount() > 0
			this.SetU16(333, IIf(l, 1, 0))
		EndIf
      //QAID: 4421 - D.Brooks - 03/10/2005
      RETURN this.GetU16(333) # 0
		//RETURN this.Get32(333) # 0

	FUNCTION bSubset(l)

		If PCount() > 0
			this.SetU16(335, IIf(l, 1, 0))
		EndIf
      //QAID: 4421 - D.Brooks - 03/10/2005
      RETURN this.GetU16(335) # 0
		//RETURN this.Get32(335) # 0

	FUNCTION bExpIdx(l)

		If PCount() > 0
			this.SetU16(337, IIf(l, 1, 0))
		EndIf
      //QAID: 4421 - D.Brooks - 03/10/2005
      RETURN this.GetU16(337) # 0
		//RETURN this.Get32(337) # 0

	FUNCTION iCost(n)

		If PCount() > 0
			this.SetU16(339, n)
		EndIf
		RETURN this.GetU16(339)

	FUNCTION iFldsInKey(n)

		If PCount() > 0
			this.SetU16(341, n)
		EndIf
		RETURN this.GetU16(341)

	FUNCTION iKeyLen(n)

		If PCount() > 0
			this.SetU16(343, n)
		EndIf
		RETURN this.GetU16(343)

	FUNCTION bOutOfDate(l)

		If PCount() > 0
			this.SetU16(345, IIf(l, 1, 0))
		EndIf
      //QAID: 4421 - D.Brooks - 03/10/2005
      RETURN this.GetU16(345) # 0
		//RETURN this.Get32(345) # 0

	FUNCTION iKeyExpType(n)

		If PCount() > 0
			this.SetU16(347, n)
		EndIf
		RETURN this.GetU16(347)

	FUNCTION aiKeyFld(i, n)

		If (PCount() > 0) And (i > 0) And (i < 17)
			If PCount() > 1
				this.SetU16(349 + ((i - 1) * 2), n)
			EndIf
			RETURN this.GetU16(349 + ((i - 1) * 2))
		EndIf
		RETURN -1

	FUNCTION szKeyExp(c)

		If PCount() > 0
			this.SetSBCSString(381, c, True)
		EndIf
		RETURN this.GetSBCSString(381, 221, False, True)

	FUNCTION szKeyCond(c)

		If PCount() > 0
			this.SetSBCSString(602, c, True)
		EndIf
		RETURN this.GetSBCSString(602, 221, False, True)

	FUNCTION bCaseInsensitive(l)

		If PCount() > 0
			this.SetU16(823, IIf(l, 1, 0))
		EndIf
      //QAID: 4421 - D.Brooks - 03/10/2005
      RETURN this.GetU16(823) # 0
		//RETURN this.Get32(823) # 0

	FUNCTION iBlockSize(n)

		If PCount() > 0
			this.SetU16(825, n)
		EndIf
		RETURN this.GetU16(825)

	FUNCTION iRestrNum(n)

		If PCount() > 0
			this.SetU16(827, n)
		EndIf
		RETURN this.GetU16(827)

	FUNCTION abDescending(i, l)

		If (PCount() > 0) And (i > 0) And (i < 17)
			If PCount() > 1
				this.SetU16(829 + ((i - 1) * 2), IIf(l, 1, 0))
			EndIf
			RETURN this.GetU16(829 + ((i - 1) * 2)) # 0
		EndIf
		RETURN False

	FUNCTION iUnused(i, n)

		If (PCount() > 0) And (i > 0) And (i < 17)
			If PCount() > 1
				this.SetU16(861 + ((i - 1) * 2), n)
			EndIf
			RETURN this.GetU16(861 + ((i - 1) * 2))
		EndIf
		RETURN -1

	PROCEDURE LogoutData
		LOCAL i

		? "szName:           " + this.szName()
		? "iIndexID:         " + this.iIndexID()
		? "szTagName:        " + this.szTagName()
		? "szFormat:         " + this.szFormat()
		? "bPrimary:         " + this.bPrimary()
		? "bUnique:          " + this.bUnique()
		? "bDescending:      " + this.bDescending()
		? "bMaintained:      " + this.bMaintained()
		? "bSubset:          " + this.bSubset()
		? "bExpIdx:          " + this.bExpIdx()
		? "iCost:            " + this.iCost()
		? "iFldsInKey:       " + this.iFldsInKey()
		? "iKeyLen:          " + this.iKeyLen()
		? "bOutOfDate:       " + this.bOutOfDate()
		? "iKeyExpType:      " + this.iKeyExpType()
		? "aiKeyFld       " + "1: " + this.aiKeyFld(1)
		For i = 2 To 16
			? "              " + IIf(i < 10, " ", "") + i + ": " + this.aiKeyFld(i)
		EndFor
		? "szKeyExp:         " + this.szKeyExp()
		? "szKeyCond:        " + this.szKeyCond()
		? "bCaseInsensitive: " + this.bCaseInsensitive()
		? "iBlockSize:       " + this.iBlockSize()
		? "iRestrNum:        " + this.iRestrNum()
		? "abDescending   " + "1: " + this.abDescending(1)
		For i = 2 To 16
			? "              " + IIf(i < 10, " ", "") + i + ": " + this.abDescending(i)
		EndFor
		? "iUnused        " + "1: " + this.iUnused(1)
		For i = 2 To 16
			? "              " + IIf(i < 10, " ", "") + i + ": " + this.iUnused(i)
		EndFor

ENDCLASS  // sIDXDesc Of BaseStruct

/* struct IDXDesc
{
	char szName[261];
	Word iIndexId;
	char szTagName[32];
	char szFormat[32];
	Word bPrimary;
	Word bUnique;
	Word bDescending;
	Word bMaintained;
	Word bSubset;
	Word bExpIdx;
	Word iCost;
	Word iFldsInKey;
	Word iKeyLen;
	Word bOutofDate;
	Word iKeyExpType;
	Word aiKeyFld[16];
	char szKeyExp[221];
	char szKeyCond[221];
	Word bCaseInsensitive;
	Word iBlockSize;
	Word iRestrNum;
	Word abDescending[16];
	Word iUnUsed[16];
} ;  */


CLASS sDBDesc Of BaseStruct(357) From :coreShared:StBase.CC

	FUNCTION szName

		RETURN this.GetSBCSString(0, 32, False, True)

	FUNCTION szText

		RETURN this.GetSBCSString(32, 32, False, True)

	FUNCTION szPhyName

		RETURN this.GetSBCSString(64, 261, False, True)

	FUNCTION szDbType

		RETURN this.GetSBCSString(325, 32, False, True)

ENDCLASS  // sDBDesc Of BaseStruct

/* struct DBDesc
{
	char szName[32];
	char szText[32];
	char szPhyName[261];
	char szDbType[32];
} ;  */


CLASS sSYSVersion Of BaseStruct(32) From :coreShared:StBase.CC

	FUNCTION iVersion

		RETURN this.GetU16(0)

	FUNCTION iIntfLevel

		RETURN this.GetU16(2)

	FUNCTION dateVer

		RETURN this.GetU32(4)

	FUNCTION timeVer

		RETURN this.GetU32(8)

	FUNCTION szVersion

		RETURN this.GetSBCSString(12, 20, False, True)

	PROCEDURE LogoutData

		? "iVersion:   " + this.iVersion()
		? "iIntfLevel: " + this.iIntfLevel()
		? "dateVer:    " + this.dateVer()
		? "timeVer:    " + this.timeVer()
		? "szVersion:  " + this.szVersion()

ENDCLASS  // sSYSVersion Of BaseStruct




CLASS sFLDType Of BaseStruct(164) From :coreShared:StBase.CC
/*typedef struct
   {

Len    Offset
Bytes
  2       0    UINT16         iId;                    // Id of Field Type
 32       2    DBINAME        szName;                 // Symbolic name; eg "ALPHA"
 32      33    DBINAME        szText;                 // Descriptive text
  2      65    UINT16         iPhyType;               // Physical/Native type
  2      67    UINT16         iXltType;               // Default xlated type
  2      69    UINT16         iXltSubType;            // Default xlated sub type
  2      71    UINT16         iMaxUnits1;             // Max units allowed (1)
  2      73    UINT16         iMaxUnits2;             // Max units allowed (2)
  2      75    UINT16         iPhySize;               // Physical size in bytes (per unit)
  2      77    BOOL16         bRequired;              // Supports 'required' option
  2      79    BOOL16         bDefaultVal;            // Supports user specified 'default'
  2      81    BOOL16         bMinVal;                // Supports MIN Val constraint
  2      83    BOOL16         bMaxVal;                // Supports MAX Val constraint
  2      85    BOOL16         bRefIntegrity;          // Can participate in ref integrity
  2      87    BOOL16         bOtherChecks;           // Supports other kinds of checks
  2      89    BOOL16         bKeyed;                 // The field type can be keyed
  2      91    BOOL16         bMultiplePerTable;      // Table can have more than 1 of this type
  2      93    UINT16         iMinUnits1;             // Min units required (1)
  2      95    UINT16         iMinUnits2;             // Min units required (2)
  2      97    BOOL16         bCreateable;            // Type can be created
 32      99    DBINAME        szNativeName;           // Native (SQL) name used in DDL
 32     131    UINT16         iUnUsed[16];
     } FLDType;
132 Bytes
 32 Bytes (iUnUsed)
164
*/

	FUNCTION iId
		RETURN this.GetU16(0)

	FUNCTION szName
		RETURN this.GetSBCSString(2, 32, False, True)


   FUNCTION szText
      RETURN this.GetSBCSString(33,32, False, True)


   FUNCTION iPhyType
      RETURN this.GetU16(65)

   FUNCTION iXltType
      RETURN this.GetU16(67)

   FUNCTION iXltSubType
      RETURN this.GetU16(69)

   FUNCTION iMaxUnits1
      RETURN this.GetU16(71)

   FUNCTION iMaxUnits2
      RETURN this.GetU16(73)

   FUNCTION iPhySize
      RETURN this.GetU16(75)

   FUNCTION bRequired
      RETURN this.Get16(77) # 0

   FUNCTION bDefaultVal
      RETURN this.Get16(79) # 0

   FUNCTION bMinVal
      RETURN this.Get16(81) # 0

   FUNCTION bMaxVal
      RETURN this.Get16(83) # 0

   FUNCTION bRefIntegrity
      RETURN this.Get16(85) # 0
                                  
   FUNCTION bOtherChecks
      RETURN this.Get16(87) # 0

   FUNCTION bKeyed
      RETURN this.Get16(89) # 0

   FUNCTION bMultiplePerTable
      RETURN this.Get16(91) # 0

   FUNCTION iMinUnits1
      RETURN this.GetU16(93)

   FUNCTION iMinUnits2
      RETURN this.GetU16(95)

   FUNCTION bCreateable
      RETURN this.Get16(97) # 0

   FUNCTION szNativeName
      RETURN this.GetSBCSString(99,32, False, True)


   FUNCTION iUnused(i, n)
		If (PCount() > 0) And (i > 0) And (i < 17)
			If PCount() > 1
				this.SetU16(131 + ((i - 1) * 2), n)
			EndIf
			RETURN this.GetU16(131 + ((i - 1) * 2))
		EndIf
		RETURN -1



	PROCEDURE LogoutData
      ? "iId:               " + this.iId()
		? "szName:            " + this.szName()
      ? "szText:            " + this.szText()
      ? "iPhyType:          " + this.iPhyType()
      ? "iXltType:          " + this.iXltType()
      ? "iXltSubType:       " + this.iXltSubType()
      ? "iMaxUnits1:        " + this.iMaxUnits1()
      ? "iMaxUnits2:        " + this.iMaxUnits2()
      ? "iPhySize:          " + this.iPhySize()
      ? "bRequired:         " + this.bRequired()
      ? "bDefaultVal:       " + this.bDefaultVal()
      ? "bMinVal:           " + this.bMinVal()
      ? "bMaxVal:           " + this.bMaxVal()
      ? "bRefIntegrity:     " + this.bRefIntegrity()
      ? "bOtherChecks:      " + this.bOtherChecks()
      ? "bKeyed:            " + this.bKeyed()
      ? "bMultiplePerTable: " + this.bMultiplePerTable()
      ? "iMinUnits1:        " + this.iMinUnits1()
      ? "iMinUnits2:        " + this.iMinUnits2()        
      ? "bCreateable:       " + this.bCreateable()       
      ? "szNativeName:      " + this.szNativeName()     
		? "iUnused         " + "1: " + this.iUnused(1)
		For i = 2 To 16
	  	   ? "                " + IIf(i < 10, " ", "") + i + ": " + this.iUnused(i)
		EndFor

ENDCLASS  // sFLDType Of BaseStruct



CLASS sTBLType Of BaseStruct(156) From :coreShared:StBase.CC
/*
typedef struct                            // Table Capabilities
   {

Len    Offset
Bytes
  2      0    UINT16         iId;                    // Id of Table Type
 32      2    DBINAME        szName;                 // Symbolic name; eg "dBASE"
 32     33    DBINAME        szText;                 // Descriptive text
 32     65    DBINAME        szFormat;               // Format; eg "HEAP"
  2     67    BOOL16         bReadWrite;             // User can Read/Write
  2     69    BOOL16         bCreate;                // Can create new tables
  2     71    BOOL16         bRestructure;           // Can restructure this table
  2     73    BOOL16         bValChecks;             // Val Checks can be specified
  2     75    BOOL16         bSecurity;              // Can be protected
  2     77    BOOL16         bRefIntegrity;          // Can participate in ref integrity
  2     79    BOOL16         bPrimaryKey;            // Supports primary key concept
  2     81    BOOL16         bIndexing;              // Can have other indexes
  2     83    UINT16         iFldTypes;              // Number of Phy Field types supported
  2     85    UINT16         iMaxRecSize;            // Max record size
  2     87    UINT16         iMaxFldsInTable;        // Max fields in a table
  2     89    UINT16         iMaxFldNameLen;         // Maximum field name length
  2     91    UINT16         iTblLevel;              // Driver dependent table level (version)
 32     93    UINT16         iUnUsed[16];
--------------------------------------------------------------------------------

    } TBLType;

Structure Size: 156 Bytes
*/

	FUNCTION iId
		RETURN this.GetU16(0)


	FUNCTION szName
		RETURN this.GetSBCSString(2, 32, False, True)


   FUNCTION szText
      RETURN this.GetSBCSString(33,32, False, True)


   FUNCTION szFormat
      RETURN this.GetSBCSString(65,32, False, True)


   FUNCTION bReadWrite
      RETURN this.Get16(67) # 0


   FUNCTION bCreate
      RETURN this.Get16(69) # 0


   FUNCTION bRestructure
      RETURN this.Get16(71) # 0


   FUNCTION bValChecks
      RETURN this.Get16(73) # 0


   FUNCTION bSecurity
      RETURN this.Get16(75) # 0


   FUNCTION bRefIntegrity
      RETURN this.Get16(77) # 0


   FUNCTION bPrimaryKey
      RETURN this.Get16(79) # 0


   FUNCTION bIndexing
      RETURN this.Get16(81) # 0


	FUNCTION iFldTypes
		RETURN this.GetU16(83)


	FUNCTION iMaxRecSize
		RETURN this.GetU16(85)


	FUNCTION iMaxFldsInTable
		RETURN this.GetU16(87)


	FUNCTION iMaxFldNameLen
		RETURN this.GetU16(89)


	FUNCTION iTblLevel
		RETURN this.GetU16(91)


   FUNCTION iUnused(i, n)
		If (PCount() > 0) And (i > 0) And (i < 17)
			If PCount() > 1
				this.SetU16(93 + ((i - 1) * 2), n)
     		EndIf
			RETURN this.GetU16(93 + ((i - 1) * 2))
		EndIf
		RETURN -1



	PROCEDURE LogoutData
      ? "iId:               " + this.iId()
		? "szName:            " + this.szName()
      ? "szText:            " + this.szText()
      ? "szFormat:          " + this.szFormat()
      ? "bReadWrite:        " + this.bReadWrite()
      ? "bCreate:           " + this.bCreate()
      ? "bRestructure:      " + this.bRestructure()
      ? "bValChecks:        " + this.bValChecks()
      ? "bSecurity:         " + this.bSecurity()
      ? "bRefIntegrity:     " + this.bRefIntegrity()
      ? "bPrimaryKey:       " + this.bPrimaryKey()
      ? "bIndexing:         " + this.bIndexing()
      ? "iFldTypes:         " + this.iFldTypes()
      ? "iMaxRecSize:       " + this.iMaxRecSize()
      ? "iMaxFldsInTable:   " + this.iMaxFldsInTable()
      ? "iMaxFldNameLen:    " + this.iMaxFldNameLen()
      ? "iTblLevel:         " + this.iTblLevel()
		? "iUnused         " + "1: " + this.iUnused(1)
		For i = 2 To 16
	  	   ? "                " + IIf(i < 10, " ", "") + i + ": " + this.iUnused(i)
		EndFor

ENDCLASS




CLASS stFLDDesc Of BaseStruct(60) From :coreShared:StBase.CC

//Len    Offset
//Bytes
//
//  2      0    UINT16         iFldNum;                // Field number (1..n)
// 32      2    DBINAME        szName;                 // Field name
//  2     33    UINT16         iFldType;               // Field type
//  2     35    UINT16         iSubType;               // Field subtype (if applicable)
//  2     37    INT16          iUnits1;                // Number of Chars, digits etc
//  2     39    INT16          iUnits2;                // Decimal places etc.
//  2     41    UINT16         iOffset;                // Offset in the record (computed)
//  2     43    UINT16         iLen;                   // Length in bytes (computed)
//  2     45    UINT16         iNullOffset;            // For Null bits (computed)
//  4     47    FLDVchk        efldvVchk;              // Field Has vcheck (computed)
//  4     51    FLDRights      efldrRights;            // Field Rights (computed)
//  2     55    BOOL16         bCalcField;             // Is Calculated field (computed)
//  2     57    UINT16         iUnUsed[2];
//   } FLDDesc;
//  Structure Size: 60 Bytes

   FUNCTION iFldNum     // Field number (1..n)
		RETURN this.GetU16(0)

      
   FUNCTION szName      // Field name
		RETURN this.GetSBCSString(2, 32, False, True)


   FUNCTION iFldType    // Field type
		RETURN this.GetU16(33)


   FUNCTION iSubType    // Field subtype (if applicable)
		RETURN this.GetU16(35)


   FUNCTION iUnits1     // Number of Chars, digits etc
      RETURN this.Get16(37)


   FUNCTION iUnits2     // Decimal places etc.
      RETURN this.Get16(39)


   FUNCTION iOffset     // Offset in the record (computed)
		RETURN this.GetU16(41)


   FUNCTION iLen        // Length in bytes (computed)
		RETURN this.GetU16(43)


   FUNCTION iNullOffset // For Null bits (computed)
		RETURN this.GetU16(45)


   FUNCTION efldvVchk   // Field Has vcheck (computed)
      RETURN this.GetU32(49)


   FUNCTION efldrRights // Field Rights (computed)
      RETURN this.GetU32(51)


   FUNCTION bCalcField  // Calculated field (computed)
      RETURN this.Get16(55) # 0


   FUNCTION iUnused(i, n)
		If (PCount() > 0) And (i > 0) And (i < 3)
			If PCount() > 1
				this.SetU16(57 + ((i - 1) * 2), n)
     		EndIf
			RETURN this.GetU16(57 + ((i - 1) * 2))
		EndIf
		RETURN -1





	PROCEDURE LogoutData
      ? "iFldNum:           " + this.iFldNum()
		? "szName:            " + this.szName()
      ? "iFldType:          " + this.iFldType()
      ? "iSubType:          " + this.iSubType()
      ? "iUnits1:           " + this.iUnits1()
      ? "iUnits2:           " + this.iUnits2()
      ? "iOffset:           " + this.iOffset()
      ? "iLen:              " + this.iLen()
      ? "iNullOffset:       " + this.iNullOffset()
      ? "efldvVchk:         " + this.efldvVchk()
      ? "efldrRights:       " + this.efldrRights()
      ? "bCalcField:        " + this.bCalcField()
		? "iUnused         1: " + this.iUnused(1)
 	   ? "                2: " + this.iUnused(2)
      RETURN


ENDCLASS



CLASS sCFGDesc Of BaseStruct(292) From :coreShared:StBase.CC

// DbiOpenCfgInfoList()
//typedef struct                            // Config description
//   {
//  Len  Offset  Type           Name                            Description
//
//   32    0    DBINAME        szNodeName;                    // Node name
//  128   32    CHAR           szDescription[DBIMAXSCFLDLEN]; // Node description
//    2  160    UINT16         iDataType;                     // Value type
//  128  162    CHAR           szValue[DBIMAXSCFLDLEN];       // Value
//    2  290    BOOL16         bHasSubnodes;              // True, if not leaf node
//   } CFGDesc;
//
//typedef CFGDesc far *pCFGDesc;
//  Structure Size: 292 Bytes
//                                                                                                    |         |         |         |         |         |         |         |         |         |         |         |         |         |         |         |         |         |         |         |   
//          |         |         |         |         |         |         |         |         |         1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
//          1111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999
//012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabb

   function szNodeName
		RETURN this.GetSBCSString(0, 32, False, True)

   function szDescription
		RETURN this.GetSBCSString(32, 128, False, True)

   function iDataType
		RETURN this.GetU16(160)

   function szValue
		RETURN this.GetSBCSString(162, 128, False, True)

   function bHasSubNodes
      RETURN this.Get16(290) # 0


   procedure LogoutData
      ? "szNodeName:           " + this.szNodeName()
		? "szDescription:        " + this.szDescription()
      ? "iDataType:            " + this.iDataType()
      ? "szValue:              " + this.szValue()
      ? "bHasSubnodes:         " + this.bHasSubNodes()
      return

ENDCLASS


