Skip to content

Commit

Permalink
Merge pull request #4 from Abscissa/mysql-pool-port-arg
Browse files Browse the repository at this point in the history
Add optional port and capFlags args to mysql.db.MysqlDB connection pool.
  • Loading branch information
s-ludwig committed Nov 4, 2012
2 parents 37604c2 + 0cb8822 commit 2d18beb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/mysql/db.d
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,26 @@ class MysqlDB {
string m_user;
string m_password;
string m_database;
ushort m_port;
SvrCapFlags m_capFlags;
ConnectionPool!Connection m_pool;
}

this(string host, string user, string password, string database)
this(string host, string user, string password, string database, ushort port = 3306, SvrCapFlags capFlags = defaultClientFlags)
{
m_host = host;
m_user = user;
m_password = password;
m_database = database;
m_port = port;
m_capFlags = capFlags;
m_pool = new ConnectionPool!Connection(&createConnection);
}

auto lockConnection() { return m_pool.lockConnection(); }

private Connection createConnection()
{
return new Connection(m_host, m_user, m_password, m_database);
return new Connection(m_host, m_user, m_password, m_database, m_port, m_capFlags);
}
}

0 comments on commit 2d18beb

Please sign in to comment.