2.5 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-17T15:57:00.684177+00:00 | zai-org/GLM-5-FP8 | 1 | 7f88751dbad5ffc9 |
Database Module Documentation
1. Purpose
This module provides database version management functionality for the DbAPI system. It enables retrieval of SQL Server versions, querying and inserting database version records, and resolving versioned stored procedure names. The module serves as an abstraction layer for database schema versioning, allowing the system to track and manage database migrations/versions across different database instances.
2. Public Interface
Interface: IDatabase
Location: DbAPI.Database namespace
int GetSQLVersion(IConnectionDetails connection)
Retrieves the major SQL Server version number from the specified database connection. Returns 0 on failure.
ulong GetDatabaseVersion(IUserDbRecord user, IConnectionDetails connection, out int version)
Retrieves the highest database version number from the target database by calling the sp_DBVersionGet stored procedure. Returns 0 (ERROR_SUCCESS) on success; non-zero error codes on failure. The version output parameter is set to the maximum version number found, or 0 on error.
ulong InsertDatabaseVersion(IUserDbRecord user, IConnectionDetails connection, int version, int step, DateTime date, string remarks, string userField)
Inserts a new database version record via the sp_DbVersionInsert stored procedure. Parameters:
version- Version number to insertstep- Step number to insertdate- DateTime for the recordremarks- Remarks string (max 255 characters based on SqlParameter size)userField- User identifier to associate with the record (does not require validation against actual users)
Returns 0 (ERROR_SUCCESS) on success, ERROR_ACCESS_DENIED if user is not logged in, or ERROR_UNKNOWN on other failures.
Class: Database (internal)
Location: DbAPI.Database namespace
Implements IDatabase. Not exposed outside the assembly.
Static Methods:
string GetStoredProcedureVersion(IConnectionDetails connection, string storedProcedure, int clientDbVersion)
Determines the appropriate stored procedure name to call based on database and client versions. Returns the original storedProcedure name if version is 0, otherwise returns {storedProcedure}_{version}.