go-xorm / xorm

Simple and Powerful ORM for Go, support mysql,postgres,tidb,sqlite3,mssql,oracle, Moved to https://gitea.com/xorm/xorm
BSD 3-Clause "New" or "Revised" License
6.66k stars 757 forks source link

How to take connection pool without database name? #546

Open sivakumar07 opened 7 years ago

sivakumar07 commented 7 years ago

I have 10 databases in one instance. I want to take a single connection pool to the instance. From that connection i will trigger "use database" query before trigger any other query or i can build query with database name. Ex select *from database.table.

How do i get connection pool to instance without database?

lunny commented 7 years ago

I think maybe you can define only one engine with some of default database and wrap engine.Exec("use database xxx") to do that but I haven't tested it.

kumarsiva07 commented 7 years ago

We can create engine without database. Then We can wrap engine.Exec("use database xxx"). I tested that.