Разработка:
- БД скрипт с начальными данными
- вывод списка номеров телефонов по группам
This commit is contained in:
Alexander Zhirov 2023-05-31 02:04:03 +03:00
parent ca5259c638
commit 815b5a6b6a
34 changed files with 1229 additions and 49 deletions

38
source/pgdb.d Normal file
View file

@ -0,0 +1,38 @@
module pgdb;
import arsd.postgres;
import std.stdio;
alias pgsql = PG.getConnection;
class PG : PostgreSql {
private:
static PG _pgsql;
this(string config) {
super(config);
}
public:
@property static PG getConnection(string config = null) {
if (this._pgsql is null) {
try {
this._pgsql = new PG(config);
} catch (Exception e) {
throw new Exception(e.msg);
}
}
return this._pgsql;
}
PostgresResult sql(T...)(string query, T t) {
return cast(PostgresResult)this.query(query, t);
}
void commit() {
this.query("COMMIT");
}
void rollback() {
this.query("ROLLBACK");
}
}