Fixed some problems with the database convertion

This commit is contained in:
Peter 'Pita' Martischka 2011-08-24 13:31:02 +01:00
parent 932ad0eeeb
commit 6bcd2886e9
2 changed files with 38 additions and 20 deletions

View file

@ -52,7 +52,7 @@ async.series([
{ {
log("get all padIds out of the database..."); log("get all padIds out of the database...");
etherpadDB.query("SELECT ID FROM PAD_META LIMIT", [], function(err, _padIDs) etherpadDB.query("SELECT ID FROM PAD_META", [], function(err, _padIDs)
{ {
padIDs = _padIDs; padIDs = _padIDs;
callback(err); callback(err);
@ -153,11 +153,14 @@ function convertPad(padId, callback)
{ {
if(!err) if(!err)
{ {
//parse the pages try
for(var i=0,length=results.length;i<length;i++)
{ {
parsePage(chatMessages, results[i].PAGESTART, results[i].OFFSETS, results[i].DATA, true); //parse the pages
} for(var i=0,length=results.length;i<length;i++)
{
parsePage(chatMessages, results[i].PAGESTART, results[i].OFFSETS, results[i].DATA, true);
}
}catch(e) {err = e}
} }
callback(err); callback(err);
@ -172,11 +175,14 @@ function convertPad(padId, callback)
{ {
if(!err) if(!err)
{ {
//parse the pages try
for(var i=0,length=results.length;i<length;i++)
{ {
parsePage(changesets, results[i].PAGESTART, results[i].OFFSETS, results[i].DATA, false); //parse the pages
} for(var i=0,length=results.length;i<length;i++)
{
parsePage(changesets, results[i].PAGESTART, results[i].OFFSETS, results[i].DATA, false);
}
}catch(e) {err = e}
} }
callback(err); callback(err);
@ -191,11 +197,14 @@ function convertPad(padId, callback)
{ {
if(!err) if(!err)
{ {
//parse the pages try
for(var i=0,length=results.length;i<length;i++)
{ {
parsePage(changesetsMeta, results[i].PAGESTART, results[i].OFFSETS, results[i].DATA, true); //parse the pages
} for(var i=0,length=results.length;i<length;i++)
{
parsePage(changesetsMeta, results[i].PAGESTART, results[i].OFFSETS, results[i].DATA, true);
}
}catch(e) {err = e}
} }
callback(err); callback(err);
@ -210,7 +219,10 @@ function convertPad(padId, callback)
{ {
if(!err) if(!err)
{ {
apool=JSON.parse(results[0].JSON).x; try
{
apool=JSON.parse(results[0].JSON).x;
}catch(e) {err = e}
} }
callback(err); callback(err);
@ -225,11 +237,14 @@ function convertPad(padId, callback)
{ {
if(!err) if(!err)
{ {
//parse the pages try
for(var i=0, length=results.length;i<length;i++)
{ {
parsePage(authors, results[i].PAGESTART, results[i].OFFSETS, results[i].DATA, true); //parse the pages
} for(var i=0, length=results.length;i<length;i++)
{
parsePage(authors, results[i].PAGESTART, results[i].OFFSETS, results[i].DATA, true);
}
}catch(e) {err = e}
} }
callback(err); callback(err);
@ -244,7 +259,10 @@ function convertPad(padId, callback)
{ {
if(!err) if(!err)
{ {
padmeta = JSON.parse(results[0].JSON).x; try
{
padmeta = JSON.parse(results[0].JSON).x;
}catch(e) {err = e}
} }
callback(err); callback(err);

View file

@ -1,5 +1,5 @@
{ {
"etherpad-db": "etherpadDB":
{ {
"host": "localhost", "host": "localhost",
"port": 3306, "port": 3306,