Skip to content

Commit

Permalink
Merge pull request #8 from Ryanair/feature/sybasepool
Browse files Browse the repository at this point in the history
Use common pool
  • Loading branch information
rsbodoqueryanair authored Aug 3, 2021
2 parents 5d56e2f + 5470f27 commit f276d04
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 f276d04

Please sign in to comment.