28 lines
564 B
D
28 lines
564 B
D
module db.pgsql;
|
|
|
|
import db.db;
|
|
|
|
import ddbc.core;
|
|
import ddbc.common;
|
|
|
|
class PostgresDB : DB {
|
|
shared this(Args...)(auto ref Args args) {
|
|
super(args);
|
|
}
|
|
|
|
protected override DataSource getDataSource() {
|
|
import ddbc.drivers.pgsqlddbc;
|
|
|
|
Driver driver = new PGSQLDriver();
|
|
string url;
|
|
string[string] params;
|
|
|
|
with (this.m_settings) {
|
|
url = PGSQLDriver.generateUrl(host, port, dbname);
|
|
params = PGSQLDriver.setUserAndPassword(username, password);
|
|
}
|
|
|
|
return new ConnectionPoolDataSourceImpl(driver, url, params);
|
|
}
|
|
}
|