Skip to content
Snippets Groups Projects
Commit 98e253bd authored by Rafael Dias's avatar Rafael Dias
Browse files

finished postgres


Signed-off-by: default avatarRafael <rpd17@inf.ufpr.br>
parent f1cdffa8
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,10 @@ export class PostgresAdapter extends SQLAdapter {
}
public getDataFromView(view: View, cb: (error: Error, result?: any[]) => void): void {
const query = this.getQueryFromView(view);
this.executeQuery(query, cb);
}
private executeQuery(query: string, cb: (err: Error, result?: any[]) => void): void{
this.pool.connect((err, client, done) => {
if (err) {
cb (err);
......@@ -48,19 +51,7 @@ export class PostgresAdapter extends SQLAdapter {
}
public insertIntoSource(source: Source, data: any[], cb: (err: Error, result?: any[]) => void): void {
const query = this.getQueryFromSource(source, data);
this.pool.connect((err, client, done) => {
if (err) {
cb (err);
return;
}
client.query(query, [], (error, result) => {
// call 'done()' to release client back to pool
done();
cb(error, (result) ? result.rows : null);
});
});
this.executeQuery(query, cb);
}
public materializeView(view: View): boolean {
......
......@@ -44,7 +44,6 @@ describe("API collect controller", () => {
let adapter: Adapter;
let fixture;
before(function (done): void {
// Arrow function not used to get acces to this and skip the test
config = ConfigParser.parse("config/test.yaml");
if (config.adapter === "postgres") {
fixture = new FixPostgres(config.connection);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment