24 lines
1.6 KiB
Markdown
24 lines
1.6 KiB
Markdown
|
|
---
|
||
|
|
source_files:
|
||
|
|
- DataPRO/DbAPI/DbAPI.cs
|
||
|
|
generated_at: "2026-04-17T15:59:50.596613+00:00"
|
||
|
|
model: "zai-org/GLM-5-FP8"
|
||
|
|
schema_version: 1
|
||
|
|
sha256: "bc000aec064c94e0"
|
||
|
|
---
|
||
|
|
|
||
|
|
# DbAPI Documentation
|
||
|
|
|
||
|
|
## 1. Purpose
|
||
|
|
|
||
|
|
The `DbAPI` class serves as the primary facade and entry point for database operations within the DataPRO system. It provides centralized access to various domain-specific database interfaces (Connections, Database, DAS, Sensors, Channels, Groups, etc.) through static properties, implements a stored procedure versioning system to handle client/server database version compatibility, and manages logging initialization for database operations.
|
||
|
|
|
||
|
|
## 2. Public Interface
|
||
|
|
|
||
|
|
### Static Methods
|
||
|
|
|
||
|
|
| Method | Signature | Description |
|
||
|
|
|--------|-----------|-------------|
|
||
|
|
| `GetStoredProcedureToUse` | `ulong GetStoredProcedureToUse(IConnectionDetails connection, string storedProcedure, int clientDbVersion, out int storedProcedureVersionToUse)` | Determines the appropriate stored procedure version by comparing client and server database versions, returning the minimum. Calls `GetDatabaseVersion` then `GetStoredProcedureVersion`. |
|
||
|
|
| `GetStoredProcedureToUseCached` | `ulong GetStoredProcedureToUseCached(IConnectionDetails connection, string storedProcedure, int clientDbVersion, out int storedProcedureVersionToUse)` | Same as `GetStoredProcedureToUse` but caches results in an internal dictionary keyed by stored procedure name, client version, and `connection.ConnectionDbVersion`. |
|
||
|
|
| `GetDatabaseVersion` | `ulong GetDatabaseVersion(IConnectionDetails connection, out int serverDbVersion)` | Executes `sp_DbVersionGet` stored procedure and returns the maximum version
|