Permalink
Browse files

saving of the intermadiate result

  • Loading branch information...
1 parent 8048f44 commit 4a04391d7814f68431b3e48cea349e8364d82d67 Roman Ostolosh committed May 25, 2012
Showing with 16 additions and 11 deletions.
  1. +0 −1 lib/driver/base.js
  2. +16 −10 lib/driver/pg.js
View
@@ -106,7 +106,6 @@ module.exports = Base = Class.extend({
if (options.ifExists) {
ifExistsSql = 'IF EXISTS';
}
-
var sql = util.format('DROP TABLE %s %s', ifExistsSql, tableName);
this.runSql(sql, callback);
},
View
@@ -1,12 +1,11 @@
var util = require('util');
var pg = require('pg');
-var Base = require('./../node_modules/node-db-migrate/lib/driver/base');
-var type = require('../node_modules/node-db-migrate/lib/data_type');
+var Base = require('./base');
+var type = require('../data_type');
var PgDriver = Base.extend({
init: function(connection) {
- console.log("initing");
this._super();
this.connection = connection;
this.connection.connect();
@@ -57,16 +56,23 @@ var PgDriver = Base.extend({
//},
runSql: function() {
- console.log("runSql performed");
- console.log('connection');
- console.log(this.connection);
- console.log('arguments');
- console.log(arguments);
- this.connection.query.apply(this.connection, arguments);
+ params = arguments;
+ this.connection.query.apply(this.connection, [params[0], function(err, result){
+ console.log(params);
+ callback = params[params.length-1];
+ if (result != undefined && result != null){
+ callback(err, result.rows);
+ } else {
+ callback(err, []);
+ }
+ }]);
},
all: function() {
- this.connection.query.apply(this.connection, arguments);
+ params = arguments;
+ this.connection.query.apply(this.connection, [params[0], function(err, result){
+ params[1](err, result.rows);
+ }]);
},
close: function() {

0 comments on commit 4a04391

Please sign in to comment.