5.6 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-17T15:59:59.091141+00:00 | zai-org/GLM-5-FP8 | 1 | 43b9fec3ece4689d |
Documentation: ConfigToDbMigrator
1. Purpose
The ConfigToDbMigrator class is a migration utility responsible for transferring user and application settings from legacy DataPRO configuration files into a database. It reads settings from an older version's config file (located via a provided path), maps specific named settings to corresponding database property IDs, and persists them for all users in the system. This module exists to support version upgrades where settings storage was migrated from file-based configuration to database-backed storage.
2. Public Interface
migrateConfigToDb(string nextLowerPath, out string result) → bool
Signature: public bool migrateConfigToDb(string nextLowerPath, out string result)
Orchestrates the full migration process. Loads both user and application settings from the config file at nextLowerPath, then inserts them into the database. Returns true on successful migration, false otherwise. The result output parameter contains a success/failure message.
ExportDesired(SupportedExportFormatBitFlags exportType, int settingValue) → bool
Signature: public bool ExportDesired(SupportedExportFormatBitFlags exportType, int settingValue)
Determines whether a specific export format is enabled within a bitmask value. Uses bitwise AND comparison to check if the exportType flag is present in settingValue.
SupportedExportFormatBitFlags (public enum)
Defines bit flags for various export formats. Values include:
none = 0x0csvunfiltered = 0x1diademadc = 0x2isounfiltered = 0x4somatunfiltered = 0x8tdmsadc = 0x10toyotaunfiltered = 0x20tsvunfiltered = 0x40csvfiltered = 0x80isofiltered = 0x200somatfiltered = 0x400tdasadc = 0x800toyotafiltered = 0x1000tsvfiltered = 0x2000rdfadc = 0x4000ChryslerDDAS = 0x8000HDFUnfiltered = 0x10000HDFFiltered = 0x20000HDFMV = 0x40000HDFADC = 0x80000xlsxfiltered = 0x100000xlsxunfiltered = 0x200000
3. Invariants
- Config file location: The old config file path is constructed as
nextLowerPath + Resources.RegistryDataPROExe. - Settings source: Only settings named
"UserSettings"and"ApplicationSettings"section groups are processed. - Database storage: All settings are stored per-user;
StoreInDbiterates over all user IDs returned byGetAllUserIds(). - Stored procedures: Database operations use
sp_UserPropertiesUpdateInsertfor inserts/updates andsp_UserGetIdsAllfor retrieving user IDs. - Error handling: If
resultcontains eitherResources.OldSettingsCouldNotBeFoundorResources.OldSettingsCouldNotBeProcessed, migration halts and returnsfalse. - Unit conversion:
DefaultTestExcitationWarmupMSis converted from milliseconds to seconds before storage.
4. Dependencies
This module depends on:
System.Configuration— ForConfigurationManager,Configuration,ClientSettingsSection, and configuration section group handling.System.Data.SqlClient— ForSqlConnection,SqlCommand,SqlParameterdatabase operations.ConfigToDb.Properties.Resources— For localized string resources (UserSettings,ApplicationSettings,OldSettingsCouldNotBeFound,OldSettingsCouldNotBeProcessed,RegistryDataPROExe).DTS.Common.Storage— Inferred; likely containsDbOperationsinfrastructure.DTS.Slice.Users.UserSettings— ForSettingElementCollectionandSettingElementtypes.DatabaseImport.DbOperations— ForGetSQLCommand(),Connection.QueryDataSet().PropertyEnums.PropertyIds— Enum defining property IDs for database storage.DbOperationsEnum.StoredProcedure— Enum for stored procedure names.DbOperations.Users.UserFields— For user field name constants.
What depends on this module:
- Unclear from source alone. No consumers are shown in this file.
5. Gotchas
-
Silent failure in
GetAllUserIds(): Exceptions are caught and swallowed; an empty list is returned, which would result in no settings being stored for any user without any indication of failure. -
Empty error handling block: In
StoreInDb(), the conditionif (int.Parse(errorNumberParam.Value.ToString()) != 0)has an empty body — database errors from the stored procedure are ignored. -
Hardcoded assumption about install location: The comment in
GetOldConfigSettings()states: "this assumes that it was installed in the default folder!!!" -
Duplicate case handling: The setting key
"DefaultTestTriggerCheckStep"appears twice in the switch statement, mapping to two different property IDs (DefaultTriggerCheckStepandDefaultTriggerCheckStep). The second case will never execute. -
Semantic name mismatch:
DefaultTestAllowSensorIdToBlankChannelmaps toDefaultRequireSensorIdFound— the inverted naming suggests possible logic inversion, but this is unclear from source alone. -
Unit conversion for one setting only:
DefaultTestExcitationWarmupMSis explicitly converted from ms to seconds, butDefaultTestExcitationTOMWarmupDelayMSandDefaultTestExcitationIEPEWarmupDelayMSare stored as-is without conversion. Whether this is intentional is unclear from source alone. -
Export format expansion: The single
DefaultTestExportFormatinteger setting is expanded into 22 separate boolean database properties via bit flag checking.