Permalink
Browse files

made example file mo' pretty

  • Loading branch information...
1 parent 45c819b commit c2c84c953a506fe9682a1661437876a261160db4 @xivSolutions xivSolutions committed Jan 26, 2014
Showing with 9 additions and 14 deletions.
  1. +9 −14 examples/callbacks.js
View
23 examples/callbacks.js
@@ -3,9 +3,12 @@ var util = require("util");
var _ = require("underscore")._;
-
+// posgres login:
massive.connect("postgres://postgres@localhost/test", function(err,db) {
-//massive.connect({user : "root", password : "", database : "test"}, function(err,db) {
+
+// mysql login:
+// massive.connect({user : "root", password : "", database : "test"}, function(err,db) {
+
console.log("err " + err)
var dropProducts = db.dropTable("products").execute(function(err,data){
console.log("Products table dropped");
@@ -24,15 +27,10 @@ massive.connect("postgres://postgres@localhost/test", function(err,db) {
db = _db;
insertProducts();
});
-
-
});
};
-
var insertProducts = function() {
-
-
var items = [
{name:"stuffy stuff", price: 12.00},
{name:"poofy poof", price: 24.00}
@@ -43,16 +41,15 @@ massive.connect("postgres://postgres@localhost/test", function(err,db) {
updatePrices();
});
});
-
- }
+ };
var showProducts = function(callback){
var query = db.products.find();
query.on("row", function(p){
console.log(p);
});
query.on("end", callback)
- }
+ };
var updatePrices = function(){
console.log("Updating prices due to inflation");
@@ -62,8 +59,7 @@ massive.connect("postgres://postgres@localhost/test", function(err,db) {
runQuery();
});
});
- }
-
+ };
var runQuery = function(callback) {
console.log("Running arbitrary SQL: ");
@@ -79,8 +75,7 @@ massive.connect("postgres://postgres@localhost/test", function(err,db) {
query.execute(function(err,results){
console.log("Everything toast!");
});
- }
-
+ };
});

0 comments on commit c2c84c9

Please sign in to comment.