Bug 446303 - backing out cal_relation changes

This commit is contained in:
daniel.boelzle%sun.com 2008-08-11 09:06:50 +00:00
Родитель d8dc8ad7ea
Коммит 6319dceaf7
1 изменённых файлов: 1 добавлений и 81 удалений

Просмотреть файл

@ -100,7 +100,6 @@ const CAL_ITEM_FLAG_EVENT_ALLDAY = 8;
const CAL_ITEM_FLAG_HAS_RECURRENCE = 16;
const CAL_ITEM_FLAG_HAS_EXCEPTIONS = 32;
const CAL_ITEM_FLAG_HAS_ATTACHMENTS = 64;
const CAL_ITEM_FLAG_HAS_RELATIONS = 128;
const USECS_PER_SECOND = 1000000;
@ -860,7 +859,7 @@ calStorageCalendar.prototype = {
this.mDB.executeSimpleSQL("INSERT INTO cal_calendar_schema_version VALUES(" + this.DB_SCHEMA_VERSION + ")");
},
DB_SCHEMA_VERSION: 13,
DB_SCHEMA_VERSION: 12,
/**
* @return db schema version
@ -1182,22 +1181,6 @@ calStorageCalendar.prototype = {
}
}
if (oldVersion < 13) {
this.mDB.beginTransaction();
try {
this.mDB.createTable("cal_relations", sqlTables.cal_relations);
// update schema
this.mDB.executeSimpleSQL("UPDATE cal_calendar_schema_version SET version = 13;");
this.mDB.commitTransaction();
oldVersion = 13;
} catch (e) {
ERROR("Upgrade failed! DB Error: " + this.mDB.lastErrorString);
this.mDB.rollbackTransaction();
throw e;
}
}
if (oldVersion != this.DB_SCHEMA_VERSION) {
dump ("#######!!!!! calStorageCalendar Schema Update failed -- db version: " + oldVersion + " this version: " + this.DB_SCHEMA_VERSION + "\n");
throw Components.results.NS_ERROR_FAILURE;
@ -1461,12 +1444,6 @@ calStorageCalendar.prototype = {
"WHERE item_id = :item_id "
);
this.mSelectRelationsForItem = createStatement(
this.mDBTwo,
"SELECT * FROM cal_relations " +
"WHERE item_id = :item_id "
);
this.mSelectMetaData = createStatement(
this.mDB,
"SELECT * FROM cal_metadata"
@ -1534,13 +1511,6 @@ calStorageCalendar.prototype = {
"VALUES (:item_id, :data, :format_type, :encoding)"
);
this.mInsertRelation = createStatement (
this.mDB,
"INSERT INTO cal_relations " +
" (item_id, rel_type, rel_id) " +
"VALUES (:item_id, :rel_type, :rel_id)"
);
this.mInsertMetaData = createStatement(
this.mDB,
"INSERT INTO cal_metadata"
@ -1572,10 +1542,6 @@ calStorageCalendar.prototype = {
this.mDB,
"DELETE FROM cal_attachments WHERE item_id = :item_id"
);
this.mDeleteRelations = createStatement (
this.mDB,
"DELETE FROM cal_relations WHERE item_id = :item_id"
);
this.mDeleteMetaData = createStatement(
this.mDB,
"DELETE FROM cal_metadata WHERE item_id = :item_id"
@ -1988,18 +1954,6 @@ calStorageCalendar.prototype = {
selectAttachment.reset();
}
if (flags & CAL_ITEM_FLAG_HAS_RELATIONS) {
var selectRelation = this.mSelectRelationsForItem;
selectRelation.params.item_id = item.id;
while (selectRelation.step()) {
var row = selectRelation.row;
var relation = this.getRelationFromRow(row);
item.addRelation(relation);
}
selectRelation.reset();
}
// Restore the saved modification time
item.setProperty("LAST-MODIFIED", savedLastModifiedTime);
},
@ -2036,15 +1990,6 @@ calStorageCalendar.prototype = {
return a;
},
getRelationFromRow: function (row) {
var r = createRelation();
r.relType = row.rel_type;
r.relId = row.rel_id;
return r;
},
//
// get item from db or from cache with given iid
//
@ -2130,7 +2075,6 @@ calStorageCalendar.prototype = {
flags |= this.writeRecurrence(item, olditem);
flags |= this.writeProperties(item, olditem);
flags |= this.writeAttachments(item, olditem);
flags |= this.writeRelations(item, olditem);
if (isEvent(item))
this.writeEvent(item, olditem, flags);
@ -2390,23 +2334,6 @@ calStorageCalendar.prototype = {
return 0;
},
writeRelations: function (item, olditem) {
var relations = item.getRelations({});
if (relations && relations.length > 0) {
for each (rel in relations) {
var rp = this.mInsertRelation.params;
rp.item_id = item.id;
rp.rel_type = rel.relType;
rp.rel_id = rel.relId;
this.mInsertRelation.execute();
this.mInsertRelation.reset();
}
return CAL_ITEM_FLAG_HAS_RELATIONS;
}
return 0;
},
//
// delete the item with the given uid
//
@ -2421,7 +2348,6 @@ calStorageCalendar.prototype = {
this.mDeleteEvent(aID);
this.mDeleteTodo(aID);
this.mDeleteAttachments(aID);
this.mDeleteRelations(aID);
this.mDeleteMetaData(aID);
if (!hasGuardingTransaction) {
this.mDB.commitTransaction();
@ -2639,12 +2565,6 @@ var sqlTables = {
" encoding TEXT" +
"",
cal_relations:
" item_id TEXT," +
" rel_type TEXT," +
" rel_id TEXT" +
"",
cal_metadata:
" cal_id INTEGER, " +
" item_id TEXT UNIQUE," +