fix for bug #408443: Update from Gran Paradiso Alpha 2, Alpha 3, and Alpha 4 -> FF Beta 2 cause [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDocShellHistory.useGlobalHistory] if you have a a2,a3,a4 profile and you run a7 (or later), in place migration of places.sqlite will fail, causing problems (such as an empty personal toolbar and lost of history.) r=dietrich, a=beltzner

This commit is contained in:
sspitzer@mozilla.org 2007-12-17 16:20:45 -08:00
parent adea5d73e5
commit c681192bb1

View File

@ -994,12 +994,12 @@ nsNavHistory::MigrateV3Up(mozIStorageConnection* aDBConn)
nsresult
nsNavHistory::MigrateV6Up(mozIStorageConnection* aDBConn)
{
// if dateAdded & lastModified cols are already there, then a partial update occurred.
// return, making no changes, and allowing db version to be updated.
// if dateAdded & lastModified cols are already there, then a partial update occurred,
// and so we should not attempt to add these cols.
nsCOMPtr<mozIStorageStatement> statement;
nsresult rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
"SELECT a.dateAdded, a.lastModified, b.dateAdded, b.lastModified "
"FROM moz_annos a, moz_items_annos b"), getter_AddRefs(statement));
"SELECT a.dateAdded, a.lastModified FROM moz_annos a"),
getter_AddRefs(statement));
if (NS_FAILED(rv)) {
// add dateAdded and lastModified columns to moz_annos
rv = aDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
@ -1008,7 +1008,14 @@ nsNavHistory::MigrateV6Up(mozIStorageConnection* aDBConn)
rv = aDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
"ALTER TABLE moz_annos ADD lastModified INTEGER DEFAULT 0"));
NS_ENSURE_SUCCESS(rv, rv);
}
// if dateAdded & lastModified cols are already there, then a partial update occurred,
// and so we should not attempt to add these cols. see bug #408443 for details.
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
"SELECT b.dateAdded, b.lastModified FROM moz_items_annos b"),
getter_AddRefs(statement));
if (NS_FAILED(rv)) {
// add dateAdded and lastModified columns to moz_items_annos
rv = aDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
"ALTER TABLE moz_items_annos ADD dateAdded INTEGER DEFAULT 0"));