Browse Source

feat: support get db version in conn (#802)

tags/v2.0.0-rc01
lxfeng1997 GitHub 5 months ago
parent
commit
7e1a2bf31d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 0 deletions
  1. +7
    -0
      pkg/datasource/sql/conn.go
  2. +2
    -0
      pkg/datasource/sql/conn_at.go
  3. +1
    -0
      pkg/datasource/sql/types/types.go

+ 7
- 0
pkg/datasource/sql/conn.go View File

@@ -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.


+ 2
- 0
pkg/datasource/sql/conn_at.go View File

@@ -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(),
}


+ 1
- 0
pkg/datasource/sql/types/types.go View File

@@ -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


Loading…
Cancel
Save