Skip to content

Commit

Permalink
Use common pool
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Sanchez Bodoque committed Aug 2, 2021
1 parent 5d56e2f commit 5470f27
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sybase/sybaseClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ func NewSyBaseClient(conn driver.Connector, schema string) *SyBaseClient {
}
}

var db *sql.DB

func (c *SyBaseClient) getDB() *sql.DB {
db := sql.OpenDB(c.conn)
if db == nil {
db = sql.OpenDB(c.conn)
}
return db
}

Expand All @@ -37,7 +41,6 @@ func (c *SyBaseClient) Query(sql string) (*sql.Rows, error) {
if err := c.moveToSchema(db); err != nil {
return nil, err
}
defer db.Close()
return db.Query(sql)
}

Expand Down

0 comments on commit 5470f27

Please sign in to comment.