Skip to content

Code table management

The imaging library defines four parallel code-table families — category, document name, document type, and file type — each with a single-object business class and a matching collection class. These tables constrain the valid values used during image indexing, and this operation covers their shared CRUD pattern.

Field Value
Operation ID OP-IMG-06
Trigger Caller creates, retrieves (single or collection), updates, or deletes a code-table object: clsImageCategoryCode, clsImageDocumentNameCode, clsImageDocumentTypeCode, or clsImageFileCode (and their *Collection counterparts)
Inputs Code, description, and file/category/type context fields specific to each code table
Outputs Persisted or retrieved code-table rows
Primary components clsImageCategoryCode, clsImageCategoryCodeCollection, clsImageDocumentNameCode, clsImageDocumentTypeCode, clsImageDocumentTypeCodeCollection, clsImageFileCode, clsImageFileCodeCollection
Entry point Business\SAIF.Business.Imaging\clsImageCategoryCode.vb, Business\SAIF.Business.Imaging\clsImageDocumentNameCode.vb, Business\SAIF.Business.Imaging\clsImageDocumentTypeCode.vb, Business\SAIF.Business.Imaging\clsImageFileCode.vb

Steps

  1. Caller provides a code, description, and context fields (e.g., ImageFileCode, ImageCategoryCode) to a code-table business object, such as clsImageDocumentNameCode.
  2. Insert the code row. BeforeInsert executes the relevant insert statement for the object — SQL-005 for document-name codes.
  3. Verify the insert. AfterInsert confirms exactly one row was affected.
  4. On failure: an error message is raised.
  5. Retrieve a single code row. Single-object classes filter by their specific key fields — SQL-019 (category code by code and file code), SQL-023 (document type code by key), SQL-025 (file code by code).
  6. Retrieve all rows of a code table. Collection classes' BeforeRetrieve returns the full table — SQL-020 (all category codes), SQL-024 (all document type codes), SQL-026 (all file codes).
  7. Update or delete a code row. Update and delete paths exist for each object but may be incomplete in live code: clsImageDocumentNameCode.UpdateSQL (SQL-034) and DeleteSQL (SQL-040) each concatenate a base statement with a separately-assignable WhereSqlStatement that defaults to the bare literal " Where " with no predicate appended.**
  8. If WhereSqlStatement is never set to a real predicate before use: the resulting SQL ends in a dangling WHERE clause, which would fail at execution or (depending on the database driver) match unintended rows.**

Process flow

The following diagram visualizes the shared code-table CRUD pattern.

flowchart TD
    Start([Caller provides code,<br>description, context fields]) --> Which{Which action?}
    Which -->|Create| Insert[BeforeInsert: INSERT row]
    Insert --> Check{AfterInsert:<br>exactly 1 row?}
    Check -->|No| Error([Error raised])
    Check -->|Yes| DoneI([Code row created])
    Which -->|Retrieve one| RetrieveOne[BeforeRetrieve by key]
    RetrieveOne --> DoneR([Code row loaded])
    Which -->|Retrieve all| RetrieveAll[BeforeRetrieve: all rows]
    RetrieveAll --> DoneRC([Collection loaded])
    Which -->|Update/Delete| UpdDel[BeforeUpdate/BeforeDelete:<br>base SQL + WhereSqlStatement]
    UpdDel --> WhereCheck{WhereSqlStatement<br>set to real predicate?}
    WhereCheck -->|No| Dangling([Dangling WHERE clause:<br>likely execution failure])
    WhereCheck -->|Yes| DoneUD([Code row updated/deleted])

Failure and edge-case behavior

  • clsImageDocumentNameCode.UpdateSQL and DeleteSQL end with a bare WHERE clause unless WhereSqlStatement is separately assigned by the caller, suggesting those paths are incomplete or dead code in current usage.**
  • AfterInsert row-count verification exists across the code-table classes but not uniformly for update/delete lifecycle methods; behavior on a failed update/delete varies by class.*

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • Business\SAIF.Business.Imaging\clsImageCategoryCode.vb
  • Business\SAIF.Business.Imaging\clsImageCategoryCodeCollection.vb
  • Business\SAIF.Business.Imaging\clsImageDocumentNameCode.vb
  • Business\SAIF.Business.Imaging\clsImageDocumentTypeCode.vb
  • Business\SAIF.Business.Imaging\clsImageDocumentTypeCodeCollection.vb
  • Business\SAIF.Business.Imaging\clsImageFileCode.vb
  • Business\SAIF.Business.Imaging\clsImageFileCodeCollection.vb