Jitmisra opened a new issue, #1071:
URL: https://github.com/apache/incubator-seata-go/issues/1071

   ### Description
   
   Currently, several components within the `pkg/datasource/sql/undo` and 
`pkg/datasource/sql/exec/at` packages hardcode the database dialect as 
`types.DBTypeMySQL`. This occurs frequently when fetching table metadata from 
the cache or when resolving SQL escape configurations (e.g., calls to 
`DelEscape`).
   
   To ensure that Seata-Go can seamlessly support multiple database 
architectures (such as PostgreSQL, Oracle, OceanBase, etc.), these hardcoded 
references should be removed. Instead, the dialect should be retrieved 
dynamically from the execution's transaction context (`execCtx.TxCtx.DBType`), 
mirroring the approach being adopted in other parts of the codebase.
   
   ### Expected Behavior
   
   Executors and undo log builders should resolve the database dialect 
dynamically, ensuring the correct metadata and SQL escaping rules are applied 
for the specific database currently in use.
   
   <img width="566" height="587" alt="Image" 
src="https://github.com/user-attachments/assets/f5680ed0-6f82-4b5d-ad39-9af28e82ff61";
 />
   
   ### Proposed Changes
   
   1. **Sweep `pkg/datasource/sql/undo`**: Update `GetTableMeta`, `DelEscape`, 
and related builder functions to use the `dbType` from the execution context. 
Extend helper function signatures (e.g., `containPK`, `getPkIndex`) to accept 
the target context.
   2. **Sweep `pkg/datasource/sql/exec/at`**: Update executors (like 
`multi_update`, `multi_delete`, `select_for_update`, `update_join`) to 
dynamically pass the dialect from their respective contexts.
   3. **Update tests**: Ensure mock testing contexts correctly instantiate the 
`TxCtx` to provide the required dialect during unit tests.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to