Dynamically populate charsets table
Instead of limiting charsets to a fixed list, dynamically populate it with any charset name of less than 50 ASCII characters. Previously, unknown charsets were discarded. Zotero.Item.prototype.attachmentCharset now always returns a charset name. It can be set with either a name or a charsetID. Also: - Remove the unused 'originalPath' column in itemAttachments
This commit is contained in:
parent
b670084925
commit
b785a3bfce
8 changed files with 98 additions and 220 deletions
|
@ -478,7 +478,6 @@ Zotero.Attachments = new function(){
|
|||
var url = document.location.href;
|
||||
var title = document.title; // TODO: don't use Mozilla-generated title for images, etc.
|
||||
var contentType = document.contentType;
|
||||
var charsetID = Zotero.CharacterSets.getID(document.characterSet);
|
||||
|
||||
var itemID;
|
||||
yield Zotero.DB.executeTransaction(function* () {
|
||||
|
@ -487,7 +486,7 @@ Zotero.Attachments = new function(){
|
|||
title: title,
|
||||
linkMode: this.LINK_MODE_LINKED_URL,
|
||||
contentType: contentType,
|
||||
charset: charsetID,
|
||||
charset: document.characterSet,
|
||||
parentItemID: parentItemID
|
||||
});
|
||||
|
||||
|
@ -553,8 +552,6 @@ Zotero.Attachments = new function(){
|
|||
);
|
||||
tmpFile.append(fileName);
|
||||
|
||||
var charsetID = Zotero.CharacterSets.getID(document.characterSet);
|
||||
|
||||
// If we're using the title from the document, make some adjustments
|
||||
if (!options.title) {
|
||||
// Remove e.g. " - Scaled (-17%)" from end of images saved from links,
|
||||
|
@ -620,7 +617,7 @@ Zotero.Attachments = new function(){
|
|||
attachmentItem.setField('accessDate', "CURRENT_TIMESTAMP");
|
||||
attachmentItem.parentID = parentItemID;
|
||||
attachmentItem.attachmentLinkMode = Zotero.Attachments.LINK_MODE_IMPORTED_URL;
|
||||
attachmentItem.attachmentCharset = charsetID;
|
||||
attachmentItem.attachmentCharset = document.characterSet;
|
||||
attachmentItem.attachmentContentType = contentType;
|
||||
var itemID = yield attachmentItem.save();
|
||||
|
||||
|
@ -1300,12 +1297,12 @@ Zotero.Attachments = new function(){
|
|||
Zotero.unlockPromise
|
||||
.then(function () {
|
||||
return Zotero.spawn(function* () {
|
||||
var charsetID = Zotero.CharacterSets.getID(charset);
|
||||
if (charsetID) {
|
||||
if (charset) {
|
||||
var disabled = Zotero.Notifier.disable();
|
||||
|
||||
var item = yield Zotero.Items.getAsync(itemID);
|
||||
item.attachmentCharset = charsetID;
|
||||
charset = yield Zotero.CharacterSets.add(charset);
|
||||
item.attachmentCharset = charset;
|
||||
yield item.save();
|
||||
|
||||
if (disabled) {
|
||||
|
|
|
@ -65,21 +65,7 @@ Zotero.CachedTypes = function() {
|
|||
|
||||
var types = yield this._getTypesFromDB();
|
||||
for (let i=0; i<types.length; i++) {
|
||||
let type = types[i];
|
||||
// Store as both id and name for access by either
|
||||
var typeData = {
|
||||
id: types[i].id,
|
||||
name: types[i].name,
|
||||
custom: this._hasCustom ? !!types[i].custom : false
|
||||
}
|
||||
this._types['_' + types[i].id] = typeData;
|
||||
if (this._ignoreCase) {
|
||||
this._types['_' + types[i].name.toLowerCase()] = this._types['_' + types[i].id];
|
||||
}
|
||||
else {
|
||||
this._types['_' + types[i].name] = this._types['_' + types[i].id];
|
||||
}
|
||||
this._typesArray.push(typeData);
|
||||
this._cacheTypeData(types[i]);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -157,7 +143,24 @@ Zotero.CachedTypes = function() {
|
|||
params ? params : false
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
this._cacheTypeData = function (type) {
|
||||
// Store as both id and name for access by either
|
||||
var typeData = {
|
||||
id: type.id,
|
||||
name: type.name,
|
||||
custom: this._hasCustom ? !!type.custom : false
|
||||
}
|
||||
this._types['_' + type.id] = typeData;
|
||||
if (this._ignoreCase) {
|
||||
this._types['_' + type.name.toLowerCase()] = this._types['_' + type.id];
|
||||
}
|
||||
else {
|
||||
this._types['_' + type.name] = this._types['_' + type.id];
|
||||
}
|
||||
this._typesArray.push(typeData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -479,5 +482,51 @@ Zotero.CharacterSets = new function() {
|
|||
function getAll() {
|
||||
return this.getTypes();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {String} name - Type name to add
|
||||
* @return {Integer|False} - The type id (new or existing), or false if invalid type name
|
||||
*/
|
||||
this.add = Zotero.Promise.coroutine(function* (name) {
|
||||
if (typeof name != 'string' || name === "") {
|
||||
return false;
|
||||
}
|
||||
|
||||
var id = this.getID(name);
|
||||
if (id) {
|
||||
return id;
|
||||
}
|
||||
|
||||
name = name.toLowerCase();
|
||||
|
||||
// Don't allow too-long or non-ASCII names
|
||||
if (name.length > 50 || !name.match(/[^a-z0-9\-_]/)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var sql = "INSERT INTO " + this._table + " (" + this._nameCol + ") VALUES (?)";
|
||||
yield Zotero.DB.queryAsync(sql, name);
|
||||
|
||||
sql = "SELECT id FROM " + this._table + " WHERE " + this._nameCol + "=?";
|
||||
var id = yield Zotero.DB.valueQueryAsync(sql, name);
|
||||
|
||||
this._cacheTypeData({
|
||||
id: id,
|
||||
name: name
|
||||
});
|
||||
|
||||
return id;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* @return {Promise}
|
||||
*/
|
||||
this.purge = function () {
|
||||
var sql = "DELETE FROM " + this._table + " WHERE " + this._idCol + " NOT IN "
|
||||
+ "(SELECT " + this._idCol + " FROM itemAttachments)";
|
||||
return Zotero.DB.queryAsync(sql);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -382,7 +382,7 @@ Zotero.Item.prototype._parseRowData = function(row) {
|
|||
this._sortCreator = row.sortCreator ? row.sortCreator : '';
|
||||
}
|
||||
if (row.attachmentCharset !== undefined) {
|
||||
this._attachmentCharset = row.attachmentCharset ? parseInt(row.attachmentCharset) : null;
|
||||
this._attachmentCharset = row.attachmentCharset ? row.attachmentCharset : null;
|
||||
}
|
||||
if (row.attachmentLinkMode !== undefined) {
|
||||
this._attachmentLinkMode = parseInt(row.attachmentLinkMode);
|
||||
|
@ -434,7 +434,6 @@ Zotero.Item.prototype._parseRowData = function(row) {
|
|||
break;
|
||||
|
||||
case 'parentID':
|
||||
case 'attachmentCharset':
|
||||
this['_' + col] = val ? parseInt(val) : false;
|
||||
break;
|
||||
|
||||
|
@ -1495,7 +1494,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
|
|||
let parent = this.parentID;
|
||||
let linkMode = this.attachmentLinkMode;
|
||||
let contentType = this.attachmentContentType;
|
||||
let charsetID = Zotero.CharacterSets.getID(this.attachmentCharset);
|
||||
let charsetID = yield Zotero.CharacterSets.add(this.attachmentCharset);
|
||||
let path = this.attachmentPath;
|
||||
let syncState = this.attachmentSyncState;
|
||||
|
||||
|
@ -2734,22 +2733,18 @@ Zotero.defineProperty(Zotero.Item.prototype, 'attachmentCharset', {
|
|||
throw (".attachmentCharset can only be set for attachment items");
|
||||
}
|
||||
|
||||
var oldVal = this.attachmentCharset;
|
||||
if (oldVal) {
|
||||
oldVal = Zotero.CharacterSets.getID(oldVal);
|
||||
if (typeof val == 'number') {
|
||||
oldVal = Zotero.CharacterSets.getID(this.attachmentCharset);
|
||||
}
|
||||
if (!oldVal) {
|
||||
oldVal = null;
|
||||
else {
|
||||
oldVal = this.attachmentCharset;
|
||||
}
|
||||
|
||||
if (val) {
|
||||
val = Zotero.CharacterSets.getID(val);
|
||||
}
|
||||
if (!val) {
|
||||
val = null;
|
||||
val = "";
|
||||
}
|
||||
|
||||
if (val == oldVal) {
|
||||
if (val === oldVal) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4043,7 +4038,7 @@ Zotero.Item.prototype.toJSON = Zotero.Promise.coroutine(function* (options, patc
|
|||
if (this.isAttachment()) {
|
||||
obj.linkMode = this.attachmentLinkMode;
|
||||
obj.contentType = this.attachmentContentType;
|
||||
obj.charset = Zotero.CharacterSets.getName(this.attachmentCharset);
|
||||
obj.charset = this.attachmentCharset;
|
||||
obj.path = this.attachmentPath;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ Zotero.Items = function() {
|
|||
parentID: "(CASE O.itemTypeID WHEN 14 THEN IAP.itemID WHEN 1 THEN INoP.itemID END) AS parentID",
|
||||
parentKey: "(CASE O.itemTypeID WHEN 14 THEN IAP.key WHEN 1 THEN INoP.key END) AS parentKey",
|
||||
|
||||
attachmentCharset: "IA.charsetID AS attachmentCharset",
|
||||
attachmentCharset: "CS.charset AS attachmentCharset",
|
||||
attachmentLinkMode: "IA.linkMode AS attachmentLinkMode",
|
||||
attachmentContentType: "IA.contentType AS attachmentContentType",
|
||||
attachmentPath: "IA.path AS attachmentPath",
|
||||
|
@ -97,7 +97,8 @@ Zotero.Items = function() {
|
|||
+ "LEFT JOIN items IAP ON (IA.parentItemID=IAP.itemID) "
|
||||
+ "LEFT JOIN itemNotes INo ON (O.itemID=INo.itemID) "
|
||||
+ "LEFT JOIN items INoP ON (INo.parentItemID=INoP.itemID) "
|
||||
+ "LEFT JOIN deletedItems DI ON (O.itemID=DI.itemID)";
|
||||
+ "LEFT JOIN deletedItems DI ON (O.itemID=DI.itemID) "
|
||||
+ "LEFT JOIN charsets CS ON (IA.charsetID=CS.charsetID)";
|
||||
|
||||
/**
|
||||
* Return items marked as deleted
|
||||
|
@ -619,6 +620,9 @@ Zotero.Items = function() {
|
|||
+ "(SELECT valueID FROM itemData)";
|
||||
yield Zotero.DB.queryAsync(sql);
|
||||
|
||||
// Purge unused charsetIDs (if attachments were deleted)
|
||||
yield Zotero.CharacterSets.purge();
|
||||
|
||||
Zotero.Prefs.set('purge.items', false)
|
||||
});
|
||||
|
||||
|
|
|
@ -1965,9 +1965,10 @@ Zotero.Schema = new function(){
|
|||
yield Zotero.DB.queryAsync("CREATE INDEX itemNotes_parentItemID ON itemNotes(parentItemID)");
|
||||
|
||||
yield Zotero.DB.queryAsync("ALTER TABLE itemAttachments RENAME TO itemAttachmentsOld");
|
||||
yield Zotero.DB.queryAsync("CREATE TABLE itemAttachments (\n itemID INTEGER PRIMARY KEY,\n parentItemID INT,\n linkMode INT,\n contentType TEXT,\n charsetID INT,\n path TEXT,\n originalPath TEXT,\n syncState INT DEFAULT 0,\n storageModTime INT,\n storageHash TEXT,\n FOREIGN KEY (itemID) REFERENCES items(itemID) ON DELETE CASCADE,\n FOREIGN KEY (parentItemID) REFERENCES items(itemID) ON DELETE CASCADE\n)");
|
||||
yield Zotero.DB.queryAsync("INSERT OR IGNORE INTO itemAttachments SELECT * FROM itemAttachmentsOld");
|
||||
yield Zotero.DB.queryAsync("CREATE TABLE itemAttachments (\n itemID INTEGER PRIMARY KEY,\n parentItemID INT,\n linkMode INT,\n contentType TEXT,\n charsetID INT,\n path TEXT,\n syncState INT DEFAULT 0,\n storageModTime INT,\n storageHash TEXT,\n FOREIGN KEY (itemID) REFERENCES items(itemID) ON DELETE CASCADE,\n FOREIGN KEY (parentItemID) REFERENCES items(itemID) ON DELETE CASCADE,\n FOREIGN KEY (charsetID) REFERENCES charsets(charsetID) ON DELETE SET NULL\n)");
|
||||
yield Zotero.DB.queryAsync("INSERT OR IGNORE INTO itemAttachments SELECT itemID, sourceItemID, linkMode, mimeType, charsetID, path, syncState, storageModTime, storageHash FROM itemAttachmentsOld");
|
||||
yield Zotero.DB.queryAsync("CREATE INDEX itemAttachments_parentItemID ON itemAttachments(parentItemID)");
|
||||
yield Zotero.DB.queryAsync("CREATE INDEX itemAttachments_charsetID ON itemAttachments(charsetID)");
|
||||
yield Zotero.DB.queryAsync("CREATE INDEX itemAttachments_contentType ON itemAttachments(contentType)");
|
||||
yield Zotero.DB.queryAsync("DROP INDEX IF EXISTS itemAttachments_syncState");
|
||||
yield Zotero.DB.queryAsync("CREATE INDEX itemAttachments_syncState ON itemAttachments(syncState)");
|
||||
|
|
|
@ -2083,6 +2083,7 @@ Components.utils.import("resource://gre/modules/osfile.jsm");
|
|||
yield Zotero.Items.purge();
|
||||
// DEBUG: this might not need to be permanent
|
||||
Zotero.Relations.purge();
|
||||
yield Zotero.CharacterSets.purge();
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -125,13 +125,6 @@ CREATE TABLE baseFieldMappingsCombined (
|
|||
CREATE INDEX baseFieldMappingsCombined_baseFieldID ON baseFieldMappingsCombined(baseFieldID);
|
||||
CREATE INDEX baseFieldMappingsCombined_fieldID ON baseFieldMappingsCombined(fieldID);
|
||||
|
||||
DROP TABLE IF EXISTS charsets;
|
||||
CREATE TABLE charsets (
|
||||
charsetID INTEGER PRIMARY KEY,
|
||||
charset TEXT UNIQUE
|
||||
);
|
||||
CREATE INDEX charsets_charset ON charsets(charset);
|
||||
|
||||
DROP TABLE IF EXISTS fileTypes;
|
||||
CREATE TABLE fileTypes (
|
||||
fileTypeID INTEGER PRIMARY KEY,
|
||||
|
@ -1185,175 +1178,6 @@ INSERT INTO "fileTypeMIMETypes" VALUES(7, 'application/powerpoint');
|
|||
INSERT INTO "fileTypeMIMETypes" VALUES(7, 'application/vnd.oasis.opendocument.presentation');
|
||||
INSERT INTO "fileTypeMIMETypes" VALUES(7, 'application/x-kpresenter');
|
||||
|
||||
INSERT INTO "charsets" VALUES(1, 'utf-8');
|
||||
INSERT INTO "charsets" VALUES(2, 'ascii');
|
||||
INSERT INTO "charsets" VALUES(3, 'windows-1250');
|
||||
INSERT INTO "charsets" VALUES(4, 'windows-1251');
|
||||
INSERT INTO "charsets" VALUES(5, 'windows-1252');
|
||||
INSERT INTO "charsets" VALUES(6, 'windows-1253');
|
||||
INSERT INTO "charsets" VALUES(7, 'windows-1254');
|
||||
INSERT INTO "charsets" VALUES(8, 'windows-1257');
|
||||
INSERT INTO "charsets" VALUES(9, 'us');
|
||||
INSERT INTO "charsets" VALUES(10, 'us-ascii');
|
||||
INSERT INTO "charsets" VALUES(11, 'utf-7');
|
||||
INSERT INTO "charsets" VALUES(12, 'iso8859-1');
|
||||
INSERT INTO "charsets" VALUES(13, 'iso8859-15');
|
||||
INSERT INTO "charsets" VALUES(14, 'iso_646.irv:1991');
|
||||
INSERT INTO "charsets" VALUES(15, 'iso_8859-1');
|
||||
INSERT INTO "charsets" VALUES(16, 'iso_8859-1:1987');
|
||||
INSERT INTO "charsets" VALUES(17, 'iso_8859-2');
|
||||
INSERT INTO "charsets" VALUES(18, 'iso_8859-2:1987');
|
||||
INSERT INTO "charsets" VALUES(19, 'iso_8859-4');
|
||||
INSERT INTO "charsets" VALUES(20, 'iso_8859-4:1988');
|
||||
INSERT INTO "charsets" VALUES(21, 'iso_8859-5');
|
||||
INSERT INTO "charsets" VALUES(22, 'iso_8859-5:1988');
|
||||
INSERT INTO "charsets" VALUES(23, 'iso_8859-7');
|
||||
INSERT INTO "charsets" VALUES(24, 'iso_8859-7:1987');
|
||||
INSERT INTO "charsets" VALUES(25, 'iso-8859-1');
|
||||
INSERT INTO "charsets" VALUES(26, 'iso-8859-1-windows-3.0-latin-1');
|
||||
INSERT INTO "charsets" VALUES(27, 'iso-8859-1-windows-3.1-latin-1');
|
||||
INSERT INTO "charsets" VALUES(28, 'iso-8859-15');
|
||||
INSERT INTO "charsets" VALUES(29, 'iso-8859-2');
|
||||
INSERT INTO "charsets" VALUES(30, 'iso-8859-2-windows-latin-2');
|
||||
INSERT INTO "charsets" VALUES(31, 'iso-8859-3');
|
||||
INSERT INTO "charsets" VALUES(32, 'iso-8859-4');
|
||||
INSERT INTO "charsets" VALUES(33, 'iso-8859-5');
|
||||
INSERT INTO "charsets" VALUES(34, 'iso-8859-5-windows-latin-5');
|
||||
INSERT INTO "charsets" VALUES(35, 'iso-8859-6');
|
||||
INSERT INTO "charsets" VALUES(36, 'iso-8859-7');
|
||||
INSERT INTO "charsets" VALUES(37, 'iso-8859-8');
|
||||
INSERT INTO "charsets" VALUES(38, 'iso-8859-9');
|
||||
INSERT INTO "charsets" VALUES(39, 'l1');
|
||||
INSERT INTO "charsets" VALUES(40, 'l2');
|
||||
INSERT INTO "charsets" VALUES(41, 'l4');
|
||||
INSERT INTO "charsets" VALUES(42, 'latin1');
|
||||
INSERT INTO "charsets" VALUES(43, 'latin2');
|
||||
INSERT INTO "charsets" VALUES(44, 'latin4');
|
||||
INSERT INTO "charsets" VALUES(45, 'x-mac-ce');
|
||||
INSERT INTO "charsets" VALUES(46, 'x-mac-cyrillic');
|
||||
INSERT INTO "charsets" VALUES(47, 'x-mac-greek');
|
||||
INSERT INTO "charsets" VALUES(48, 'x-mac-roman');
|
||||
INSERT INTO "charsets" VALUES(49, 'x-mac-turkish');
|
||||
INSERT INTO "charsets" VALUES(50, 'adobe-symbol-encoding');
|
||||
INSERT INTO "charsets" VALUES(51, 'ansi_x3.4-1968');
|
||||
INSERT INTO "charsets" VALUES(52, 'ansi_x3.4-1986');
|
||||
INSERT INTO "charsets" VALUES(53, 'big5');
|
||||
INSERT INTO "charsets" VALUES(54, 'chinese');
|
||||
INSERT INTO "charsets" VALUES(55, 'cn-big5');
|
||||
INSERT INTO "charsets" VALUES(56, 'cn-gb');
|
||||
INSERT INTO "charsets" VALUES(57, 'cn-gb-isoir165');
|
||||
INSERT INTO "charsets" VALUES(58, 'cp367');
|
||||
INSERT INTO "charsets" VALUES(59, 'cp819');
|
||||
INSERT INTO "charsets" VALUES(60, 'cp850');
|
||||
INSERT INTO "charsets" VALUES(61, 'cp852');
|
||||
INSERT INTO "charsets" VALUES(62, 'cp855');
|
||||
INSERT INTO "charsets" VALUES(63, 'cp857');
|
||||
INSERT INTO "charsets" VALUES(64, 'cp862');
|
||||
INSERT INTO "charsets" VALUES(65, 'cp864');
|
||||
INSERT INTO "charsets" VALUES(66, 'cp866');
|
||||
INSERT INTO "charsets" VALUES(67, 'csascii');
|
||||
INSERT INTO "charsets" VALUES(68, 'csbig5');
|
||||
INSERT INTO "charsets" VALUES(69, 'cseuckr');
|
||||
INSERT INTO "charsets" VALUES(70, 'cseucpkdfmtjapanese');
|
||||
INSERT INTO "charsets" VALUES(71, 'csgb2312');
|
||||
INSERT INTO "charsets" VALUES(72, 'cshalfwidthkatakana');
|
||||
INSERT INTO "charsets" VALUES(73, 'cshppsmath');
|
||||
INSERT INTO "charsets" VALUES(74, 'csiso103t618bit');
|
||||
INSERT INTO "charsets" VALUES(75, 'csiso159jisx02121990');
|
||||
INSERT INTO "charsets" VALUES(76, 'csiso2022jp');
|
||||
INSERT INTO "charsets" VALUES(77, 'csiso2022jp2');
|
||||
INSERT INTO "charsets" VALUES(78, 'csiso2022kr');
|
||||
INSERT INTO "charsets" VALUES(79, 'csiso58gb231280');
|
||||
INSERT INTO "charsets" VALUES(80, 'csisolatin4');
|
||||
INSERT INTO "charsets" VALUES(81, 'csisolatincyrillic');
|
||||
INSERT INTO "charsets" VALUES(82, 'csisolatingreek');
|
||||
INSERT INTO "charsets" VALUES(83, 'cskoi8r');
|
||||
INSERT INTO "charsets" VALUES(84, 'csksc56011987');
|
||||
INSERT INTO "charsets" VALUES(85, 'csshiftjis');
|
||||
INSERT INTO "charsets" VALUES(86, 'csunicode11');
|
||||
INSERT INTO "charsets" VALUES(87, 'csunicode11utf7');
|
||||
INSERT INTO "charsets" VALUES(88, 'csunicodeascii');
|
||||
INSERT INTO "charsets" VALUES(89, 'csunicodelatin1');
|
||||
INSERT INTO "charsets" VALUES(90, 'cswindows31latin5');
|
||||
INSERT INTO "charsets" VALUES(91, 'cyrillic');
|
||||
INSERT INTO "charsets" VALUES(92, 'ecma-118');
|
||||
INSERT INTO "charsets" VALUES(93, 'elot_928');
|
||||
INSERT INTO "charsets" VALUES(94, 'euc-jp');
|
||||
INSERT INTO "charsets" VALUES(95, 'euc-kr');
|
||||
INSERT INTO "charsets" VALUES(96, 'extended_unix_code_packed_format_for_japanese');
|
||||
INSERT INTO "charsets" VALUES(97, 'gb2312');
|
||||
INSERT INTO "charsets" VALUES(98, 'gb_2312-80');
|
||||
INSERT INTO "charsets" VALUES(99, 'greek');
|
||||
INSERT INTO "charsets" VALUES(100, 'greek8');
|
||||
INSERT INTO "charsets" VALUES(101, 'hz-gb-2312');
|
||||
INSERT INTO "charsets" VALUES(102, 'ibm367');
|
||||
INSERT INTO "charsets" VALUES(103, 'ibm819');
|
||||
INSERT INTO "charsets" VALUES(104, 'ibm850');
|
||||
INSERT INTO "charsets" VALUES(105, 'ibm852');
|
||||
INSERT INTO "charsets" VALUES(106, 'ibm855');
|
||||
INSERT INTO "charsets" VALUES(107, 'ibm857');
|
||||
INSERT INTO "charsets" VALUES(108, 'ibm862');
|
||||
INSERT INTO "charsets" VALUES(109, 'ibm864');
|
||||
INSERT INTO "charsets" VALUES(110, 'ibm866');
|
||||
INSERT INTO "charsets" VALUES(111, 'iso-10646');
|
||||
INSERT INTO "charsets" VALUES(112, 'iso-10646-j-1');
|
||||
INSERT INTO "charsets" VALUES(113, 'iso-10646-ucs-2');
|
||||
INSERT INTO "charsets" VALUES(114, 'iso-10646-ucs-4');
|
||||
INSERT INTO "charsets" VALUES(115, 'iso-10646-ucs-basic');
|
||||
INSERT INTO "charsets" VALUES(116, 'iso-10646-unicode-latin1');
|
||||
INSERT INTO "charsets" VALUES(117, 'iso-2022-jp');
|
||||
INSERT INTO "charsets" VALUES(118, 'iso-2022-jp-2');
|
||||
INSERT INTO "charsets" VALUES(119, 'iso-2022-kr');
|
||||
INSERT INTO "charsets" VALUES(120, 'iso-ir-100');
|
||||
INSERT INTO "charsets" VALUES(121, 'iso-ir-101');
|
||||
INSERT INTO "charsets" VALUES(122, 'iso-ir-103');
|
||||
INSERT INTO "charsets" VALUES(123, 'iso-ir-110');
|
||||
INSERT INTO "charsets" VALUES(124, 'iso-ir-126');
|
||||
INSERT INTO "charsets" VALUES(125, 'iso-ir-144');
|
||||
INSERT INTO "charsets" VALUES(126, 'iso-ir-149');
|
||||
INSERT INTO "charsets" VALUES(127, 'iso-ir-159');
|
||||
INSERT INTO "charsets" VALUES(128, 'iso-ir-58');
|
||||
INSERT INTO "charsets" VALUES(129, 'iso-ir-6');
|
||||
INSERT INTO "charsets" VALUES(130, 'iso646-us');
|
||||
INSERT INTO "charsets" VALUES(131, 'jis_x0201');
|
||||
INSERT INTO "charsets" VALUES(132, 'jis_x0208-1983');
|
||||
INSERT INTO "charsets" VALUES(133, 'jis_x0212-1990');
|
||||
INSERT INTO "charsets" VALUES(134, 'koi8-r');
|
||||
INSERT INTO "charsets" VALUES(135, 'korean');
|
||||
INSERT INTO "charsets" VALUES(136, 'ks_c_5601');
|
||||
INSERT INTO "charsets" VALUES(137, 'ks_c_5601-1987');
|
||||
INSERT INTO "charsets" VALUES(138, 'ks_c_5601-1989');
|
||||
INSERT INTO "charsets" VALUES(139, 'ksc5601');
|
||||
INSERT INTO "charsets" VALUES(140, 'ksc_5601');
|
||||
INSERT INTO "charsets" VALUES(141, 'ms_kanji');
|
||||
INSERT INTO "charsets" VALUES(142, 'shift_jis');
|
||||
INSERT INTO "charsets" VALUES(143, 't.61');
|
||||
INSERT INTO "charsets" VALUES(144, 't.61-8bit');
|
||||
INSERT INTO "charsets" VALUES(145, 'unicode-1-1-utf-7');
|
||||
INSERT INTO "charsets" VALUES(146, 'unicode-1-1-utf-8');
|
||||
INSERT INTO "charsets" VALUES(147, 'unicode-2-0-utf-7');
|
||||
INSERT INTO "charsets" VALUES(148, 'windows-31j');
|
||||
INSERT INTO "charsets" VALUES(149, 'x-cns11643-1');
|
||||
INSERT INTO "charsets" VALUES(150, 'x-cns11643-1110');
|
||||
INSERT INTO "charsets" VALUES(151, 'x-cns11643-2');
|
||||
INSERT INTO "charsets" VALUES(152, 'x-cp1250');
|
||||
INSERT INTO "charsets" VALUES(153, 'x-cp1251');
|
||||
INSERT INTO "charsets" VALUES(154, 'x-cp1253');
|
||||
INSERT INTO "charsets" VALUES(155, 'x-dectech');
|
||||
INSERT INTO "charsets" VALUES(156, 'x-dingbats');
|
||||
INSERT INTO "charsets" VALUES(157, 'x-euc-jp');
|
||||
INSERT INTO "charsets" VALUES(158, 'x-euc-tw');
|
||||
INSERT INTO "charsets" VALUES(159, 'x-gb2312-11');
|
||||
INSERT INTO "charsets" VALUES(160, 'x-imap4-modified-utf7');
|
||||
INSERT INTO "charsets" VALUES(161, 'x-jisx0208-11');
|
||||
INSERT INTO "charsets" VALUES(162, 'x-ksc5601-11');
|
||||
INSERT INTO "charsets" VALUES(163, 'x-sjis');
|
||||
INSERT INTO "charsets" VALUES(164, 'x-tis620');
|
||||
INSERT INTO "charsets" VALUES(165, 'x-unicode-2-0-utf-7');
|
||||
INSERT INTO "charsets" VALUES(166, 'x-x-big5');
|
||||
INSERT INTO "charsets" VALUES(167, 'x0201');
|
||||
INSERT INTO "charsets" VALUES(168, 'x0212');
|
||||
|
||||
INSERT INTO "syncObjectTypes" VALUES(1, 'collection');
|
||||
INSERT INTO "syncObjectTypes" VALUES(2, 'creator');
|
||||
INSERT INTO "syncObjectTypes" VALUES(3, 'item');
|
||||
|
|
|
@ -49,6 +49,12 @@ CREATE TABLE syncedSettings (
|
|||
FOREIGN KEY (libraryID) REFERENCES libraries(libraryID) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE charsets (
|
||||
charsetID INTEGER PRIMARY KEY,
|
||||
charset TEXT UNIQUE
|
||||
);
|
||||
CREATE INDEX charsets_charset ON charsets(charset);
|
||||
|
||||
-- Primary data applicable to all items
|
||||
CREATE TABLE items (
|
||||
itemID INTEGER PRIMARY KEY,
|
||||
|
@ -101,14 +107,15 @@ CREATE TABLE itemAttachments (
|
|||
contentType TEXT,
|
||||
charsetID INT,
|
||||
path TEXT,
|
||||
originalPath TEXT,
|
||||
syncState INT DEFAULT 0,
|
||||
storageModTime INT,
|
||||
storageHash TEXT,
|
||||
FOREIGN KEY (itemID) REFERENCES items(itemID) ON DELETE CASCADE,
|
||||
FOREIGN KEY (parentItemID) REFERENCES items(itemID) ON DELETE CASCADE
|
||||
FOREIGN KEY (parentItemID) REFERENCES items(itemID) ON DELETE CASCADE,
|
||||
FOREIGN KEY (charsetID) REFERENCES charsets(charsetID) ON DELETE SET NULL
|
||||
);
|
||||
CREATE INDEX itemAttachments_parentItemID ON itemAttachments(parentItemID);
|
||||
CREATE INDEX itemAttachments_charsetID ON itemAttachments(charsetID);
|
||||
CREATE INDEX itemAttachments_contentType ON itemAttachments(contentType);
|
||||
CREATE INDEX itemAttachments_syncState ON itemAttachments(syncState);
|
||||
|
||||
|
|
Loading…
Reference in a new issue