32 lines
603 B
D
32 lines
603 B
D
module db.pgsql;
|
|
|
|
import db.db;
|
|
|
|
import ddbc.core;
|
|
import ddbc.common;
|
|
|
|
import slf4d;
|
|
|
|
class PostgresDB : DB {
|
|
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);
|
|
}
|
|
|
|
debugF!"DB URL: %s"(url);
|
|
|
|
return new ConnectionPoolDataSourceImpl(driver, url, params);
|
|
}
|
|
}
|