Paste #424

Welcome On LodgeIt

Welcome to the LodgeIt pastebin. In order to use the notification feature a 31 day cookie with an unique ID was created for you. The lodgeit database does not store any information about you, it's just used for an advanced pastebin experience :-). Read more on the about lodgeit page. Have fun :-)

hide this notification

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
var Drizze = require("./drizzle_bindings").Drizzle;
var drizzle = new exports.Drizzle();

console.log("BEFORE CONNECT");

drizzle.connect({
    //async: false,
    mysql: true,
    hostname: "localhost",
    user: "root",
    password: "password",
    database: "test",
    success: function(server) {
        console.log("Connected to " + server.hostname + " (" + server.version + ")");

        drizzle.query("SELECT * FROM profiles LIMIT 100", {
            buffer: false,
            success: function(columns, rows) {
                    console.log("SUCCESS!");
            },
            each: function(row, index, last) {
                    if (index === 0) {
                        console.log(row);
                    }
                    if (last) {
                        console.log((index + 1) + " TOTAL ROWS");
                    }
            },
            error: function(error) {
                console.log("QUERY ERROR: " + error);
            }
        });
    },
    error: function(error) {
        console.log("ERROR: " + error);
    }
});

console.log("AFTER CONNECT");

/**
ABOVE OUTPUTS:
BEFORE CONNECT                                                                                                                                                                                            
AFTER CONNECT                                                                                                                                                                                             
Connected to localhost (5.5.9-log)                                                                                                                                                                        
SUCCESS!                                                                                                                                                                                                  
{ id: '1',
  firstname: 'John',
  lastname: 'Doe',
  last_login: '2008-12-22 16:35:09', 
  phone: null }                                                                                                                                                                                           
100 TOTAL ROWS
*/