mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-12 16:02:48 +08:00
🐛 fix(oracle): 修复表结构注释读取与保存报错
- 补齐 Oracle 表字段注释元数据读取 - 在表结构 DDL 中追加表和字段注释信息 - 规范表设计器 Oracle DDL 执行前的分号处理 Refs #482
This commit is contained in:
@@ -27,6 +27,7 @@ type oracleRecordingState struct {
|
||||
mu sync.Mutex
|
||||
execQueries []string
|
||||
execArgs [][]driver.NamedValue
|
||||
queries []string
|
||||
rowsAffected int64
|
||||
queryResults map[string]oracleRecordingQueryResult
|
||||
queryError error
|
||||
@@ -54,6 +55,12 @@ func (s *oracleRecordingState) snapshotExecArgs() [][]driver.NamedValue {
|
||||
return result
|
||||
}
|
||||
|
||||
func (s *oracleRecordingState) snapshotQueries() []string {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
return append([]string(nil), s.queries...)
|
||||
}
|
||||
|
||||
type oracleRecordingDriver struct{}
|
||||
|
||||
func (oracleRecordingDriver) Open(name string) (driver.Conn, error) {
|
||||
@@ -88,6 +95,7 @@ func (c *oracleRecordingConn) ExecContext(_ context.Context, query string, args
|
||||
|
||||
func (c *oracleRecordingConn) QueryContext(_ context.Context, query string, _ []driver.NamedValue) (driver.Rows, error) {
|
||||
c.state.mu.Lock()
|
||||
c.state.queries = append(c.state.queries, query)
|
||||
if err := c.state.queryError; err != nil {
|
||||
c.state.mu.Unlock()
|
||||
return nil, err
|
||||
@@ -103,10 +111,10 @@ func (c *oracleRecordingConn) QueryContext(_ context.Context, query string, _ []
|
||||
|
||||
if strings.Contains(strings.ToLower(query), "tab_columns") {
|
||||
return &oracleRecordingRows{
|
||||
columns: []string{"COLUMN_NAME", "DATA_TYPE", "NULLABLE", "DATA_DEFAULT"},
|
||||
columns: []string{"COLUMN_NAME", "DATA_TYPE", "NULLABLE", "DATA_DEFAULT", "COLUMN_KEY", "COMMENT"},
|
||||
rows: [][]driver.Value{
|
||||
{"UPDATED_AT", "TIMESTAMP", "YES", nil},
|
||||
{"CREATED_AT", "DATE", "NO", nil},
|
||||
{"UPDATED_AT", "TIMESTAMP", "YES", nil, "", "更新时间"},
|
||||
{"CREATED_AT", "DATE", "NO", nil, "", nil},
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user