Establish/refresh Oracle data connection¶
This operation prepares the shared IDataPortalInfo handle that both code-generation operations use to run their query. It runs automatically the moment a caller constructs CodeTableMap, and it rebuilds the underlying Oracle data-layer objects only when the requested dbUser or database differs from the connection already cached on the instance — otherwise it leaves the existing connection untouched.
| Field | Value |
|---|---|
| Operation ID | OP-CODEGEN-001 |
| Trigger | Constructor call or later Connect(dbUser, database) invocation |
| Inputs | dbUser, database |
| Outputs | Populated or reused m_dpi As IDataPortalInfo |
| Primary components | CodeTableMap.New, CodeTableMap.Connect |
| Entry point | SAIF.Framework.CodeGen\CodeTableMap.vb |
Steps¶
CodeTableMap.New(dbUser, database)callsConnect(dbUser, database)as the last step of object construction, so every new instance is connection-ready before the caller can invoke a generation method.Connectfirst checks whetherm_dpialready references an Oracle data portal (BR-004).- If
m_dpiexists and bothm_dpi.Databaseandm_dpi.dbUsermatch the requested values, the method keeps the existing portal in place and returns without doing any further work (BR-004). - If
m_dpiisNothing, or either value differs from what is cached, the method proceeds to build a new Oracle data-layer instance (BR-004). ConnectinstantiatesNew clsMSOracleDataLayer(dbUser, database)and reads itsDataPortalInfoproperty.- The delegated constructor creates a new
clsDataAccessowner together with aclsDataAccess.clsEnvironmentobject. - It copies the requested
dbUseranddatabasevalues into that environment, fixesDBMSTypeto Oracle, and turns on connection pooling. - It creates a
clsMSOracleDataPortalfrom the prepared environment. - It registers that portal with
m_DataAccess.AddDataPortal(...), assignsDataApiAccessLayer, and hands the resultingIDataPortalInfohandle back toCodeTableMap.
Origin: Steps 3.1-3.4 are implemented in Execute a data portal request (
SAIF.Framework.Core) and execute on behalf of this operation. 4.Connectassigns the returned handle tom_dpi, so the instance is ready for the code-table query the generation operations issue immediately afterward. 5. No local exception handling wraps this sequence, so any failure raised while constructing or registering the Oracle data layer propagates unchanged to the caller.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Caller constructs CodeTableMap]) --> Check{Existing m_dpi?}
Check -->|No| Build[Create new clsMSOracleDataLayer]
Check -->|Yes| Compare{Same database<br>and dbUser?}
Compare -->|Yes| Reuse[Keep current IDataPortalInfo]
Compare -->|No| Build
Build --> Assign[Assign DataPortalInfo to m_dpi]
Reuse --> EndOk([Connection ready])
Assign --> EndOk
Failure and edge-case behavior¶
- Repeated calls with an unchanged
dbUser/databasepair intentionally reuse the current portal rather than paying the cost of rebuilding the Oracle data layer (BR-004). - Any exception raised while constructing
clsMSOracleDataLayeror registering its portal propagates unchanged to the caller, becauseConnectneither catches nor wraps it.
Related documentation¶
Sources¶
- SAIF.Framework.CodeGen\CodeTableMap.vb
- SAIF.Framework.Core\V1\DataAccessLayer\MSOracle\MSOracleDataLayer.vb
- SAIF.Framework.Core\V1\Interfaces\iDataPortalInfo.vb