Fixed some problems with the database convertion

pull/239/merge
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...");
etherpadDB.query("SELECT ID FROM PAD_META LIMIT", [], function(err, _padIDs)
etherpadDB.query("SELECT ID FROM PAD_META", [], function(err, _padIDs)
{
padIDs = _padIDs;
callback(err);
@ -152,12 +152,15 @@ function convertPad(padId, callback)
etherpadDB.query(sql, [padId], function(err, results)
{
if(!err)
{
try
{
//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);
@ -171,12 +174,15 @@ function convertPad(padId, callback)
etherpadDB.query(sql, [padId], function(err, results)
{
if(!err)
{
try
{
//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);
@ -190,12 +196,15 @@ function convertPad(padId, callback)
etherpadDB.query(sql, [padId], function(err, results)
{
if(!err)
{
try
{
//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);
@ -209,8 +218,11 @@ function convertPad(padId, callback)
etherpadDB.query(sql, [padId], function(err, results)
{
if(!err)
{
try
{
apool=JSON.parse(results[0].JSON).x;
}catch(e) {err = e}
}
callback(err);
@ -224,12 +236,15 @@ function convertPad(padId, callback)
etherpadDB.query(sql, [padId], function(err, results)
{
if(!err)
{
try
{
//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);
@ -243,8 +258,11 @@ function convertPad(padId, callback)
etherpadDB.query(sql, [padId], function(err, results)
{
if(!err)
{
try
{
padmeta = JSON.parse(results[0].JSON).x;
}catch(e) {err = e}
}
callback(err);

View File

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