//************************************************************************ //*** Desription class for dbUpdateUtil //************************************************************************ //*** Copyright (c) 2000-2001 NordTeam Gruppen //*** (Code has been clarified OPEN SOURCE 22/9 2000). //*** //*** Author......: Allan Kim Eriksen //*** Created.....: 25/9 2000 //************************************************************************ // This is the description part. //************************************************************************ Use UI Use akefs\akefs.pkg Use vWin32fh\vWin32fh.pkg Class cDescription is a cObject Procedure Construct_Object Forward Send Construct_Object // Define new Properties: // Path(s) for the database files. Property String psDataPath // Filelist for the database. Property String psFilelist // Directory where the descriptionfiles are written to. Property String psDescriptionDir // No info_boxes. Property Boolean pbQuiet False // Create child objects: // Set property values: End_Procedure Procedure End_Construct_Object Forward Send End_Construct_Object // Add your code that needs to be executed at the end of the object construction here: End_Procedure Procedure DoDescribeDatabase String sFileout sFiledir sOutdir sDataPath String sRootname sMessage sDirLine sFilelist String sOldFilelist sOldOpenPath Integer iFilenum iNoOfFiles iCurFileNo iMaxSlots Boolean bFound bDeleted bQuiet Handle hDir Get psFilelist to sFilelist Get psDataPath to sDataPath Get psDescriptionDir to sOutdir Get_Attribute DF_FILELIST_NAME to sOldFilelist Set_Attribute DF_FILELIST_NAME to sFilelist Get_Attribute DF_OPEN_PATH to sOldOpenPath Set_Attribute DF_OPEN_PATH to (sDataPath + ";" + sOldOpenPath) // Nessasary to include the original path, that includes License files path (from vdf 2008). Move (vFolderFormat(sOutdir)) to sOutdir Send cursor_wait of Cursor_Control // Delete old nta, ntb and ntc files. // ntk and nti files needs to survive. Get Create U_cDirectory to hDir Get SearchSingleDirectory of hDir (sOutdir + "*.nta") DIRMODE_FILES_ONLY to iNoOfFiles Decrement iNoOfFiles For iCurFileNo from 0 to iNoOfFiles Get SearchResult of hDir iCurFileNo LIST_FILENAME to sFileout Get FileDelete (sOutdir + sFileout) to bDeleted Loop Get SearchSingleDirectory of hDir (sOutdir + "*.ntb") DIRMODE_FILES_ONLY to iNoOfFiles Decrement iNoOfFiles For iCurFileNo from 0 to iNoOfFiles Get SearchResult of hDir iCurFileNo LIST_FILENAME to sFileout Get FileDelete (sOutdir + sFileout) to bDeleted Loop Get SearchSingleDirectory of hDir (sOutdir + "*.ntc") DIRMODE_FILES_ONLY to iNoOfFiles Decrement iNoOfFiles For iCurFileNo from 0 to iNoOfFiles Get SearchResult of hDir iCurFileNo LIST_FILENAME to sFileout Get FileDelete (sOutdir + sFileout) to bDeleted Loop Send Destroy of hDir Get_Attribute DF_NUMBER_FILES_SUPPORTED to iMaxSlots Send OnSetProgressMax iMaxSlots // Start description Move 0 to iFilenum //Start at top of current filelist Repeat Get_Attribute DF_FILE_NEXT_USED of iFilenum to iFilenum Send OnSetProgressPosition iFilenum If (iFilenum <> 0) Begin Get_Attribute DF_FILE_ROOT_NAME of iFilenum to sRootname If ((Uppercase(Trim(sRootname))) <> "FLEXERRS") Begin Open iFilenum Mode DF_SHARE If (Found) Send DoDescribeFile iFilenum Close iFilenum End End Until (iFilenum = 0) Send OnSetProgressPosition iMaxSlots Set_Attribute DF_FILELIST_NAME to sOldFilelist Set_Attribute DF_OPEN_PATH to sOldOpenPath Send cursor_ready of Cursor_Control Get pbQuiet to bQuiet If (not(bQuiet)) Begin Send info_box "Description is complete!" End Send OnSetProgressPosition 0 End_Procedure Procedure DoDescribeFile Integer iFilenum String sv sOutDir sLogicalname sFileout sFieldname Number nv Integer iNoOffields iActPos iLastIndex iActIndex iNoOfSegments Integer iSeqFile Get psDescriptionDir to sOutdir Move (vFolderFormat(sOutdir)) to sOutdir Get_Attribute DF_FILE_LOGICAL_NAME of iFilenum to sLogicalname Move (Trim(sLogicalname)) to sLogicalname //*** FILE definition Move (sOutdir + sLogicalname + ".NTA") to sFileout Get Seq_New_Channel to iSeqFile Direct_Output channel iSeqFile sFileout Get_Attribute DF_FILE_COMPRESSION of iFilenum to nv Move "" to sv If (nv = DF_FILE_COMPRESS_NONE) Move "None" to sv If (nv = DF_FILE_COMPRESS_FAST) Move "Fast" to sv If (nv = DF_FILE_COMPRESS_STANDARD) Move "Standard" to sv If (nv = DF_FILE_COMPRESS_CUSTOM) Move "Custom" to sv Writeln channel iSeqFile "Compression, " sv Get_Attribute DF_FILE_DISPLAY_NAME of iFilenum to sv Writeln channel iSeqFile "Display name, " sv Get_Attribute DF_FILE_DRIVER of iFilenum to sv Writeln channel iSeqFile "Driver, " sv Get_Attribute DF_FILE_INTEGRITY_CHECK of iFilenum to nv Move "" to sv If (nv = DFTRUE) Move "Yes" to sv Else Move "No" to sv Writeln channel iSeqFile "Integrity check, " sv Get_Attribute DF_FILE_IS_SYSTEM_FILE of iFilenum to nv Move "" to sv If (nv = DFTRUE) Move "Yes" to sv Else Move "No" to sv Writeln channel iSeqFile "System file, " sv Get_Attribute DF_FILE_LAST_INDEX_NUMBER of iFilenum to iLastIndex Move iLastIndex to sv Writeln channel iSeqFile "Last index number, " sv Get_Attribute DF_FILE_LOCK_TYPE of iFilenum to nv Move "" to sv If (nv = DF_LOCK_TYPE_NONE) Move "None" to sv If (nv = DF_LOCK_TYPE_FILE) Move "File" to sv If (nv = DF_LOCK_TYPE_RECORD) Move "Record" to sv Writeln channel iSeqFile "Lock type, " sv Get_Attribute DF_FILE_LOGICAL_NAME of iFilenum to sv Writeln channel iSeqFile "Logical name, " sv // DF_FILE_LOGIN currently not in NTA-definition Get_Attribute DF_FILE_MAX_RECORDS of iFilenum to nv Move nv to sv Writeln channel iSeqFile "Max records, " sv Get_Attribute DF_FILE_MULTIUSER of iFilenum to nv Move "" to sv If (nv = DF_FILE_USER_MULTI) Move "Yes" to sv If (nv = DF_FILE_USER_SINGLE) Move "No" to sv Writeln channel iSeqFile "Multiuser, " sv Writeln channel iSeqFile "File number, " iFilenum //DF_FILE_OWNER currently not in NTA-definition //DF_PHYSICAL_NAME currently not in NTA-definition Get_Attribute DF_FILE_RECORD_IDENTITY of iFilenum to nv Move nv to sv Writeln channel iSeqFile "Record identity, " sv Get_Attribute DF_FILE_RECORD_LENGTH of iFilenum to nv Move nv to sv Writeln channel iSeqFile "Record length, " sv Get_Attribute DF_FILE_REUSE_DELETED of iFilenum to nv Move "" to sv If (nv = DF_FILE_DELETED_NOREUSE) Move "No" to sv If (nv = DF_FILE_DELETED_REUSE) Move "Yes" to sv Writeln channel iSeqFile "Reuse deleted records, " sv Get_Attribute DF_FILE_REVISION of iFilenum to sv Writeln channel iSeqFile "Revision, " sv Get_Attribute DF_FILE_ROOT_NAME of iFilenum to sv Writeln channel iSeqFile "Root name, " sv Get_Attribute DF_FILE_TRANSACTION of iFilenum to nv Move "" to sv If (nv = DF_FILE_TRANSACTION_NONE) Move "None" to sv If (nv = DF_FILE_TRANSACTION_CLIENT_ATOMIC) Move "Client atomic" to sv If (nv = DF_FILE_TRANSACTION_SERVER_ATOMIC) Move "Server atomic" to sv If (nv = DF_FILE_TRANSACTION_SERVER_LOGGED) Move "Server logged" to sv Writeln channel iSeqFile "Transaction, " sv //DF_FILE_TYPE currently not in NTA-definition Close_Output channel iSeqFile Send Seq_Release_Channel iSeqFile //*** FIELD definition Move (sOutdir + (Trim(sLogicalname)) + ".NTB") to sFileout Get Seq_New_Channel to iSeqFile Direct_Output channel iSeqFile sFileout Get_Attribute DF_FILE_NUMBER_FIELDS of iFilenum to iNoOfFields For iActPos from 1 to iNoOfFields //Fieldnumber is iActPos Get_Attribute DF_FIELD_NAME of iFilenum iActPos to sFieldname Writeln channel iSeqFile "Name, " iActpos ", " sFieldname Get_Attribute DF_FIELD_INDEX of iFilenum iActPos to nv Writeln channel iSeqFile "Main index," iActpos ", " nv Get_Attribute DF_FIELD_LENGTH of iFilenum iActPos to nv Writeln channel iSeqFile "Length," iActpos ", " nv Get_Attribute DF_FIELD_OFFSET of iFilenum iActPos to nv Writeln channel iSeqFile "Offset," iActpos ", " nv Get_Attribute DF_FIELD_PRECISION of iFilenum iActPos to nv Writeln channel iSeqFile "Precision," iActpos ", " nv Get_Attribute DF_FIELD_RELATED_FIELD of iFilenum iActPos to nv Writeln channel iSeqFile "Related field," iActpos ", " nv Get_Attribute DF_FIELD_RELATED_FILE of iFilenum iActPos to nv Writeln channel iSeqFile "Related file," iActpos ", " nv Get_Attribute DF_FIELD_TYPE of iFilenum iActPos to nv Move "" to sv If (nv = DF_ASCII) Move "Ascii" to sv If (nv = DF_BCD) Move "Nummeric" to sv If (nv = DF_DATE) Move "Date" to sv If (nv = DF_TEXT) Move "Text" to sv If (nv = DF_BINARY) Move "Binary" to sv If (nv = DF_OVERLAP) Move "Overlap" to sv Writeln channel iSeqFile "Type, " iActPos ", " sv Loop Close_Output channel iSeqFile Send Seq_Release_Channel iSeqFile //*** INDEX definition Move (sOutdir + (Trim(sLogicalname)) + ".NTC") to sFileout Get Seq_New_Channel to iSeqFile Direct_Output channel iSeqFile sFileout For iActIndex from 1 to iLastIndex Get_Attribute DF_INDEX_NUMBER_SEGMENTS of iFilenum iActIndex to iNoOfSegments If (iNoOfSegments) Begin Get_Attribute DF_INDEX_TYPE of iFilenum iActIndex to nv Move "" to sv If (nv = DF_INDEX_TYPE_ONLINE) Move "Online" to sv If (nv = DF_INDEX_TYPE_BATCH) Move "Batch" to sv Writeln channel iSeqFile "Type, " iActIndex ", , " sv For iActPos from 1 to iNoOfSegments Get_Attribute DF_INDEX_SEGMENT_CASE of iFilenum IActIndex iActPos to nv Move "" to sv If (nv = DF_CASE_USED) Move "Used" to sv If (nv = DF_CASE_IGNORED) Move "Ignored" to sv Writeln channel iSeqFile "Case, " iActIndex ", " iActPos ", " sv Get_Attribute DF_INDEX_SEGMENT_DIRECTION of iFilenum IActIndex iActPos to nv Move "" to sv If (nv = DF_ASCENDING) Move "Ascending" to sv If (nv = DF_DESCENDING) Move "Descending" to sv Writeln channel iSeqFile "Direction, " iActIndex ", " iActPos ", " sv Get_Attribute DF_INDEX_SEGMENT_FIELD of iFilenum IActIndex iActPos to nv Writeln channel iSeqFile "Field, " iActIndex ", " iActPos ", " nv Loop End Loop Close_Output channel iSeqFile Send Seq_Release_Channel iSeqFile End_Procedure Procedure OnSetProgressPosition Integer iCurPos End_Procedure Procedure OnSetProgressMax Integer iMaxPos End_Procedure End_Class