Fix a couple more potential upgrade errors with space trimming

This commit is contained in:
Dan Stillman 2008-10-28 06:18:11 +00:00
parent fa2a8bb30e
commit cf644465e3

View file

@ -2059,7 +2059,7 @@ Zotero.Schema = new function(){
var trimmed = Zotero.Utilities.prototype.trim(row.value);
var valueID = Zotero.DB.valueQuery("SELECT valueID FROM itemDataValues WHERE value=?", trimmed);
if (valueID) {
Zotero.DB.query("UPDATE itemData SET valueID=? WHERE valueID=?", [valueID, row.valueID]);
Zotero.DB.query("UPDATE OR REPLACE itemData SET valueID=? WHERE valueID=?", [valueID, row.valueID]);
Zotero.DB.query("DELETE FROM itemDataValues WHERE valueID=?", row.valueID);
}
else {
@ -2092,7 +2092,7 @@ Zotero.Schema = new function(){
var trimmed = Zotero.Utilities.prototype.trim(row.name);
var tagID = Zotero.DB.valueQuery("SELECT tagID FROM tags WHERE name=?", trimmed);
if (tagID) {
Zotero.DB.query("UPDATE itemTags SET tagID=? WHERE tagID=?", [tagID, row.tagID]);
Zotero.DB.query("UPDATE OR REPLACE itemTags SET tagID=? WHERE tagID=?", [tagID, row.tagID]);
Zotero.DB.query("DELETE FROM tags WHERE tagID=?", row.tagID);
}
else {