Skip to content

Commit

Permalink
增强各数据库插件的 SQL 执行日志记录,添加 SQL 执行信息日志以提高调试能力
Browse files Browse the repository at this point in the history
  • Loading branch information
zgxkbtl committed Dec 13, 2024
1 parent 5918bda commit e3d4947
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions pkg/plugins/mssql_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func (p *MSSQLPlugin) DoSQLExecute(body *Body) (qr *QueryResult) {
}
defer db.Close()

logger.Log1.WithField("sql", body.SQL).Info("执行SQL")
rows, err := db.Query(body.SQL)
if err != nil {
logger.Log1.WithField("error", err).Error("SQL查询失败")
Expand Down
1 change: 1 addition & 0 deletions pkg/plugins/mysql_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func (p *MySQLPlugin) DoSQLExecute(body *Body) (qr *QueryResult) {
}
defer db.Close()

logger.Log1.WithField("sql", body.SQL).Info("执行SQL")
rows, err := db.Query(body.SQL)
if err != nil {
logger.Log1.WithField("error", err).Error("执行SQL查询失败")
Expand Down
4 changes: 1 addition & 3 deletions pkg/plugins/oracledb_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ func (p *OracleDBPlugin) DoSQLExecute(body *Body) (qr *QueryResult) {
}
defer db.Close()

// Sleep for 10000ms to simulate processing time
// time.Sleep(10000 * time.Millisecond)

logger.Log1.WithField("sql", body.SQL).Info("执行SQL")
rows, err := db.Query(body.SQL)
if err != nil {
logger.Log1.WithField("error", err).Error("执行SQL失败")
Expand Down
4 changes: 1 addition & 3 deletions pkg/plugins/pgsql_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ func (p *PGSQLPlugin) DoSQLExecute(body *Body) (qr *QueryResult) {
}
defer db.Close()

// Sleep for 10000ms to simulate processing time
// time.Sleep(10000 * time.Millisecond)

logger.Log1.WithField("sql", body.SQL).Info("执行SQL")
rows, err := db.Query(body.SQL)
if err != nil {
return &QueryResult{
Expand Down

0 comments on commit e3d4947

Please sign in to comment.