This is an automated email from the ASF dual-hosted git repository.

luky116 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-seata-go.git


The following commit(s) were added to refs/heads/master by this push:
     new 7e1a2bf3 feat: support get db version in conn (#802)
7e1a2bf3 is described below

commit 7e1a2bf31d02351178caa6df863014d5cb5f0b7c
Author: lxfeng1997 <33981743+lxfeng1...@users.noreply.github.com>
AuthorDate: Thu May 1 08:09:14 2025 +0800

    feat: support get db version in conn (#802)
---
 pkg/datasource/sql/conn.go        | 7 +++++++
 pkg/datasource/sql/conn_at.go     | 2 ++
 pkg/datasource/sql/types/types.go | 1 +
 3 files changed, 10 insertions(+)

diff --git a/pkg/datasource/sql/conn.go b/pkg/datasource/sql/conn.go
index 7a2b0423..f745dcec 100644
--- a/pkg/datasource/sql/conn.go
+++ b/pkg/datasource/sql/conn.go
@@ -248,6 +248,13 @@ func (c *Conn) GetAutoCommit() bool {
        return c.autoCommit
 }
 
+func (c *Conn) GetDbVersion() string {
+       if c.res == nil {
+               return ""
+       }
+       return c.res.GetDbVersion()
+}
+
 // Close invalidates and potentially stops any current
 // prepared statements and transactions, marking this
 // connection as no longer in use.
diff --git a/pkg/datasource/sql/conn_at.go b/pkg/datasource/sql/conn_at.go
index f1d0f5ed..abc31f26 100644
--- a/pkg/datasource/sql/conn_at.go
+++ b/pkg/datasource/sql/conn_at.go
@@ -63,6 +63,7 @@ func (c *ATConn) QueryContext(ctx context.Context, query 
string, args []driver.N
                        NamedValues:          args,
                        Conn:                 c.targetConn,
                        DBName:               c.dbName,
+                       DbVersion:            c.GetDbVersion(),
                        IsSupportsSavepoints: true,
                        IsAutoCommit:         c.GetAutoCommit(),
                }
@@ -102,6 +103,7 @@ func (c *ATConn) ExecContext(ctx context.Context, query 
string, args []driver.Na
                        NamedValues:          args,
                        Conn:                 c.targetConn,
                        DBName:               c.dbName,
+                       DbVersion:            c.GetDbVersion(),
                        IsSupportsSavepoints: true,
                        IsAutoCommit:         c.GetAutoCommit(),
                }
diff --git a/pkg/datasource/sql/types/types.go 
b/pkg/datasource/sql/types/types.go
index 36b44a2e..aa911285 100644
--- a/pkg/datasource/sql/types/types.go
+++ b/pkg/datasource/sql/types/types.go
@@ -159,6 +159,7 @@ type ExecContext struct {
        Conn        driver.Conn
        DBName      string
        DBType      DBType
+       DbVersion   string
        // todo set values for these 4 param
        IsAutoCommit         bool
        IsSupportsSavepoints bool


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to