9.5 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-17T15:45:10.285441+00:00 | zai-org/GLM-5-FP8 | 1 | 82e99bbb3ec2255d |
Documentation: DatabaseExport (Version 57 - ISO Module)
1. Purpose
This module provides a data access and entity modeling layer for a crash test data acquisition system, specifically handling "Version 57" database schemas. It contains classes responsible for mapping database rows (System.Data.DataRow) to C# objects representing test configurations, hardware channels, templates, and metadata. The module supports exporting and managing ISO-compliant data structures, including test objects, calculated channels, and trigger configurations.
2. Public Interface
AbstractOLEDbWrapper
Abstract class providing static helper methods for safe database value retrieval.
public static long GetLong(IDataReader reader, string field): Returnslong.MinValueif the database field isDBNull, otherwise converts the value toInt64.public static DateTime GetDate(IDataReader reader, string field): ReturnsDateTime.MinValueif the database field isDBNull, otherwise casts the value toDateTime.
TemplateZone
Represents a zone within a test template.
public TemplateZone(string template, string name, string picture, string description): Constructor initializing properties directly.public TemplateZone(System.Data.DataRow dr): Constructor populating fields from a database row. SetsZoneNameto "Default zone" if null. Automatically loadsTemplateRegionsviaTemplateRegion.GetAllRegions.public TemplateRegion[] TemplateRegions { get; set; }: Array of regions belonging to this zone.
TemplateRegion
Represents a specific region within a TemplateZone, including coordinate data.
public TemplateRegion(DataRow dr): Constructor mapping database columns (e.g.,UpperLeftX,RegionName) to properties.internal static TemplateRegion[] GetAllRegions(string templateName, string zoneName): Queries the database (tblTemplateRegions) to retrieve all regions for a specific template and zone. Silently catches exceptions and returns an empty array on failure.
TestObjectChannel
Represents a specific data channel on a test object. Inherits from TestObjectTemplateChannel (not shown) and implements IComparable<TestObjectChannel>.
public enum SquibChannelTypes: Defines channel types (None,Voltage,Current).public string GetGraphID(): Returns the channel ID, appending"_CU"ifSquibChannelTypeisCurrent.public string GetId(): Returns a formatted ID string (SerialNumber_MMEChannelType_Id).public string GetID(): Functionally identical toGetId()but usesstring.Formatinstead of interpolation.public int CompareTo(TestObjectChannel right): Compares byDisplayOrder, thenName, thenTestObject.SerialNumberOrOriginalSerialNumber.public string HardwareId { set; }: Setter parses the input string expecting an underscore-delimited format (3 tokens) and reconstructs the value based on specific token logic involvingChannelSeparator.
CalculatedValueClass
Defines a calculated channel derived from other input channels.
public enum Operations: Defines calculation types (SUM,AVERAGE,IRTRACC3D, etc.).public CalculatedValueClass(System.Data.DataRow dr): Constructor mapping database fields to properties usingDbOperations.CalculatedChannels.Fieldsenum.public byte[] InputChannelIdsBlob { get; set; }: Serializes/deserializes theInputChannelIdslist to/from a UTF-8 encoded string separated by the system's list separator.
ISOHardwareChannel
Represents a physical hardware channel configuration.
public ISOHardwareChannel(DataRow dr, Hardware hardware): Constructor mappingDbOperations.DAS.DASChannelFieldsto properties. ThrowsNotSupportedExceptionfor unknown fields.public static int PhysicalCompare(ISOHardwareChannel left, ISOHardwareChannel right): Compares two channels byChannelIdx.
LevelTriggerChannel
Stores trigger configuration based on signal levels.
public LevelTriggerChannel(System.Data.DataRow dr): Constructor mappingDbOperations.LevelTriggers.Fieldsto properties.- Properties include thresholds:
GreaterThanThresholdEU,LessThanThresholdEU,InsideUpperLevelEU, etc.
MMEFigures
Represents figure metadata, inheriting from AbstractOLEDbWrapper.
public static MMEFigures[] GetFigures(): Static factory method querying theMMEFIGUREStable viaDbOperations.GetISOCommand(). Returns an array of populatedMMEFiguresobjects.
TestSetting & TestSettingDictionary
Classes for managing key-value test settings with serialization support.
public string TestSetting.ToSerializeString(): Serializes the setting to "Key=Value" format, escaping internal equals signs with"_x_".public static bool TestSetting.TryParse(string s, out TestSetting ts): Parses a serialized string back into aTestSettingobject.public void TestSettingDictionary.LoadSettings(string s): Parses a serialized string (separated by system list separator) and populates the dictionary.public string TestSettingDictionary.ToSerializeString(): Serializes all settings in the dictionary.
TestEngineerDetails & CustomerDetails
Serializable classes holding contact details.
public Dictionary<string, string> GetValues(): Returns a dictionary of all fields and their values (used for serialization/database storage).public static TestEngineerDetails[] GetAllTestEngineerDetails(): Fetches all records fromtblTestEngineerDetails.public static CustomerDetails[] GetAllCustomerDetails(): Fetches all records fromtblCustomerDetails.
TestObjectMetaData & TestSetupMetaData
Manage metadata properties using a dictionary backing field.
public void SetProperty(MetaData meta): Adds or updates a metadata property.public MetaData[] Properties { get; }: Returns all metadata properties as an array.
IsoCode
Handles the construction and parsing of a 16-character ISO code string.
public IsoCode(string isoCode): Constructor. Pads or truncates input to exactly 16 characters.public string StringRepresentation { get; set; }: Gets or sets the 16-char code.public static string GetString(...): Overloaded static methods to construct an ISO code from various components (MMEPossibleChannels,MMETestObjects, etc.).
3. Invariants
- IsoCode Length: An
IsoCodestring representation is always exactly 16 characters. Inputs are padded with'?'or truncated to enforce this. - ChannelIDX Default: The default value for
TestObjectChannel._channelIDXisCHANNEL_IDX_UNKNOWN(-1). - DBNull Handling: Database readers/constructors in this module consistently convert
DBNull.Valueto specific default values (e.g.,long.MinValue,DateTime.MinValue, "NOVALUE", or "Default zone") rather than throwing exceptions or leaving values null. - Comparison Logic:
TestObjectChannel.CompareToguarantees a stable sort order based onDisplayOrder->Name->SerialNumber. - HardwareId Parsing: The
TestObjectChannel.HardwareIdsetter expects an underscore-delimited string with exactly 3 tokens to perform its parsing logic; otherwise, it passes the value through (or null) toSetProperty.
4. Dependencies
Internal Dependencies (Inferred from source):
DbOperations: Used extensively for database connections, commands, and parameter creation (GetCommand,GetISOCommand,CreateParam,Connection.QueryDataSet).DatabaseExport.ISO.TestObject: Referenced inTestObjectChannel.DatabaseExport.ISO.TestObjectTemplateChannel: Base class forTestObjectChannel.DatabaseExport.Hardware: Referenced inISOHardwareChannel.MMEPossibleChannels,MMETestObjects,MMEPositions,MMEFilterClasses: Referenced inIsoCode.GetStringstatic methods.
External Dependencies:
System.Data/System.Data.OleDb: Used for database interaction.System.Drawing: Used inTemplateRegionforPointobjects.System.Globalization: Used for culture-invariant string parsing/serialization.
5. Gotchas
- Bug in MMEFigures.GetFigures: In the
GetFigures()method, when reading theLAST_CHANGEcolumn, the code incorrectly assigns the value to thedatRevisionvariable instead oflastChange. This meansLast_Changein the resulting object will likely beDateTime.MinValue, andDatRevisionmay contain the