--- a/tweetcast/nodejs/node-direct.js Fri Oct 28 18:48:14 2011 +0200
+++ b/tweetcast/nodejs/node-direct.js Wed Nov 02 17:13:23 2011 +0100
@@ -54,14 +54,15 @@
function createTables() {
- var requete = "CREATE TABLE IF NOT EXISTS tweets ( pos INTEGER PRIMARY KEY, tweet_id TEXT UNIQUE, created_at INTEGER, json TEXT" + annotationMap(function(a) { return ', a_' + a + ' INTEGER' }).join("") + " )";
- db.execute(requete, function(err) {
+ var requete = "CREATE TABLE IF NOT EXISTS tweets ( pos INTEGER PRIMARY KEY, tweet_id TEXT UNIQUE, created_at INTEGER, json TEXT"
+ + annotationMap(function(a) { return ', a_' + a + ' INTEGER' }).join("")
+ + " );\n"
+ + "CREATE TABLE IF NOT EXISTS tweet_refs ( id INTEGER PRIMARY KEY, from_id TEXT, to_id TEXT, ref_type TEXT );\n"
+ + "CREATE INDEX IF NOT EXISTS idx_created_at ON tweets ( created_at );";
+ db.executeScript(requete, function(err) {
if (err) { myLog("SQLITE error",err.stack); }
- db.execute("CREATE INDEX IF NOT EXISTS idx_created_at ON tweets ( created_at )", function(err) { if (err) { myLog("SQLITE error",err.stack); } });
getSendLastPos();
});
-
- db.execute("CREATE TABLE IF NOT EXISTS tweet_refs ( id INTEGER PRIMARY KEY, from_id TEXT, to_id TEXT, ref_type TEXT )", function(err) { if (err) { myLog("SQLITE error",err.stack); } });
}
function commitReference(from_id, to_id, ref_type) {
@@ -136,7 +137,7 @@
commitTweet(newdata[i]);
}
}
- myLog("Data received - length :",chunk.length);
+// myLog("Data received - length :",chunk.length);
}
function requestTwitter() {
@@ -191,7 +192,7 @@
commit_script = '';
// console.log(requete);
// var reqd = new Date();
- db.execute(requete, function (err) {
+ db.executeScript(requete, function (err) {
if (err) { myLog("SQLITE error",err.stack); }
// myLog("Commit took",(new Date() - reqd),"ms");
getSendLastPos();
@@ -427,6 +428,7 @@
});
setInterval(commitTweets,500);
+setInterval(function(){myLog("Still alive, tweet count",lastpos)}, 60000);
if (RECORD_NEW_TWEETS) {
requestTwitter();