diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js index cef2f44457..5e89a0a3d2 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/data_access.js +++ b/chrome/chromeFiles/content/scholar/xpcom/data_access.js @@ -751,58 +751,116 @@ Scholar.Item.prototype.updateDateModified = function(){ // // save() is not required for note functions // -/** -* Add a new note to an item and return the noteID -**/ -Scholar.Item.prototype.addNote = function(text){ - Scholar.DB.beginTransaction(); - var noteID = Scholar.getRandomID('itemNotes', 'noteID', 65535); - var sql = "INSERT INTO itemNotes (noteID, itemID, note) VALUES (?,?,?)"; - Scholar.DB.query(sql, - [{'int':noteID}, {'int':this.getID()}, {'string':text}] - ); - this.updateDateModified(); +Scholar.Item.prototype.incrementNoteCount = function(){ this._data['numNotes']++; - Scholar.DB.commitTransaction(); - Scholar.Notifier.trigger('modify', 'item', this.getID()); - return noteID; } + +Scholar.Item.prototype.decrementNoteCount = function(){ + this._data['numNotes']--; +} + + +/** +* Determine if an item is a note +**/ +Scholar.Item.prototype.isNote = function(){ + return Scholar.ItemTypes.getName(this.getType())=='note'; +} + + /** * Update an item note +* +* Note: This can only be called on note items. **/ -Scholar.Item.prototype.updateNote = function(noteID, text){ +Scholar.Item.prototype.updateNote = function(text){ + if (!this.isNote()){ + throw ("updateNote() can only be called on items of type 'note'"); + } + + if (!this.getID()){ + throw ("Cannot call updateNote() on unsaved note"); + } + Scholar.DB.beginTransaction(); - var sql = "UPDATE itemNotes SET note=?, dateModified=CURRENT_TIMESTAMP " - + "WHERE itemID=? AND noteID=?"; - var updated = Scholar.DB.query(sql, - [{'string':text}, {'int':this.getID()}, {'int':noteID}] - ); - this.updateDateModified(); - Scholar.DB.commitTransaction(); - Scholar.Notifier.trigger('modify', 'item', this.getID()); + + var sql = "UPDATE itemNotes SET note=? WHERE itemID=?"; + bindParams = [{string:text}, this.getID()]; + var updated = Scholar.DB.query(sql, bindParams); + if (updated){ + this.updateDateModified(); + Scholar.DB.commitTransaction(); + Scholar.Notifier.trigger('modify', 'item', this.getID()); + } + else { + Scholar.DB.commitTransaction(); + } } -/** -* Delete an item note -**/ -Scholar.Item.prototype.removeNote = function(noteID){ - Scholar.DB.beginTransaction(); - var sql = "DELETE FROM itemNotes WHERE itemID=" + this.getID() - + " AND noteID=" + noteID; - var deleted = Scholar.DB.query(sql); - if (deleted){ - this.updateDateModified(); - this._data['numNotes']--; + +Scholar.Item.prototype.setNoteSource = function(sourceItemID){ + if (!this.isNote()){ + throw ("updateNote() can only be called on items of type 'note'"); } + + if (!this.getID()){ + throw ("Cannot call setNoteSource() on unsaved note"); + } + + Scholar.DB.beginTransaction(); + + var newItem = Scholar.Items.get(sourceItemID); + // FK check + if (sourceItemID && !newItem){ + Scholar.DB.rollbackTransaction(); + throw ("Cannot set note source to invalid item " + sourceItemID); + } + + // Get previous source item id + var sql = "SELECT sourceItemID FROM itemNotes WHERE item=" + this.getID(); + var oldSourceItemID = Scholar.DB.valueQuery(sql); + + if (oldSourceItemID==sourceItemID){ + Scholar.debug("Note source hasn't changed", 4); + Scholar.DB.commitTransaction(); + return false; + } + + var oldItem = Scholar.Items.get(oldSourceItemID); + if (oldSourceItemID && !oldItem){ + Scholar.debug("Old source item " + oldSourceItemID + + "didn't exist in setNoteSource()", 2); + } + + var sql = "UPDATE itemNotes SET sourceItemID=? WHERE itemID=?"; + var bindParams = [sourceItemID ? {int:sourceItemID} : null, this.getID()]; + Scholar.DB.query(sql, bindParams); + this.updateDateModified(); Scholar.DB.commitTransaction(); - Scholar.Notifier.trigger('modify', 'item', this.getID()); + + // Update the note counts of the previous and new sources + if (oldItem){ + oldItem.decrementNoteCount(); + Scholar.Notifier.trigger('modify', 'item', oldSourceItemID); + } + if (newItem){ + newItem.incrementNoteCount(); + Scholar.Notifier.trigger('modify', 'item', sourceItemID); + } + + return true; } + /** * Returns number of notes in item **/ Scholar.Item.prototype.numNotes = function(){ + if (this.isNote()){ + throw ("numNotes() cannot be called on items of type 'note'"); + } + if (!this.getID()){ return 0; } @@ -810,25 +868,48 @@ Scholar.Item.prototype.numNotes = function(){ return this._data['numNotes']; } + /** * Get the text of an item note **/ -Scholar.Item.prototype.getNote = function(noteID){ - var sql = "SELECT note FROM itemNotes WHERE itemID=" + this.getID() - + " AND noteID=" + noteID; +Scholar.Item.prototype.getNote = function(){ + if (!this.isNote()){ + throw ("getNote() can only be called on items of type 'note'"); + } + + var sql = "SELECT note FROM itemNotes WHERE itemID=" + this.getID(); return Scholar.DB.valueQuery(sql); } + /** -* Returns an array of noteIDs for this item +* Get the itemID of the source item for a note +**/ +Scholar.Item.prototype.getNoteSource = function(){ + if (!this.isNote()){ + throw ("getNoteSource() can only be called on items of type 'note'"); + } + + var sql = "SELECT sourceItemID FROM itemNotes WHERE itemID=" + this.getID(); + return Scholar.DB.valueQuery(sql); +} + + +/** +* Returns an array of note itemIDs for this item **/ Scholar.Item.prototype.getNotes = function(){ + if (this.isNote()){ + Scholar.debug('here'); + throw ("getNotes() cannot be called on items of type 'note'"); + } + if (!this.getID()){ return []; } - var sql = "SELECT noteID FROM itemNotes WHERE itemID=" + this.getID() - + " ORDER BY dateCreated"; + var sql = "SELECT itemID FROM itemNotes NATURAL JOIN items " + + "WHERE sourceItemID=" + this.getID() + " ORDER BY dateAdded"; return Scholar.DB.columnQuery(sql); } @@ -851,6 +932,24 @@ Scholar.Item.prototype.erase = function(){ Scholar.Collections.get(parentCollectionIDs[i]).removeItem(this.getID()); } + // If note, remove item from source notes + if (this.isNote()){ + var sql = "SELECT sourceItemID FROM itemNotes WHERE itemID=" + this.getID(); + var sourceItemID = Scholar.DB.valueQuery(sql); + if (sourceItemID){ + var sourceItem = Scholar.Items.get(sourceItemID); + Scholar.debug(sourceItem); + sourceItem.decrementNoteCount(); + } + } + // If not note, unassociate any notes for which this is a source + else { + var sql = "UPDATE itemNotes SET sourceItemID=NULL WHERE sourceItemID=" + + this.getID(); + } + + // TODO: remove item from See Also table + sql = 'DELETE FROM itemCreators WHERE itemID=' + this.getID() + ";\n"; sql += 'DELETE FROM itemNotes WHERE itemID=' + this.getID() + ";\n"; sql += 'DELETE FROM itemKeywords WHERE itemID=' + this.getID() + ";\n"; @@ -864,6 +963,9 @@ Scholar.Item.prototype.erase = function(){ Scholar.DB.commitTransaction(); } catch (e){ + if (sourceItem){ + sourceItem.incrementNoteCount(); + } Scholar.DB.rollbackTransaction(); throw (e); } @@ -958,6 +1060,46 @@ Scholar.Item.prototype._loadItemData = function(){ +Scholar.Notes = new function(){ + this.add = add; + + /** + * Create a new item of type 'note' and add the note text to the itemNotes table + * + * Returns the itemID of the new note item + **/ + function add(text, sourceItemID){ + Scholar.DB.beginTransaction(); + + if (sourceItemID){ + var sourceItem = Scholar.Items.get(sourceItemID); + if (!sourceItem){ + Scholar.DB.commitTransaction(); + throw ("Cannot set note source to invalid item " + sourceItemID); + } + } + + var note = Scholar.Items.getNewItemByType(Scholar.ItemTypes.getID('note')); + note.save(); + + var sql = "INSERT INTO itemNotes VALUES (?,?,?)"; + var bindParams = [ + note.getID(), + (sourceItemID ? {int:sourceItemID} : null), + {string:text} + ]; + Scholar.DB.query(sql, bindParams); + Scholar.DB.commitTransaction(); + + sourceItem.incrementNoteCount(); + + Scholar.Notifier.trigger('modify', 'item', sourceItemID); + Scholar.Notifier.trigger('add', 'item', note.getID()); + + return note.getID(); + } +} + /* @@ -2114,7 +2256,8 @@ Scholar.getItems = function(parent){ var toReturn = new Array(); if (!parent){ - var sql = 'SELECT itemID FROM items'; + var sql = "SELECT itemID FROM items LEFT JOIN itemNotes USING (itemID) " + + "WHERE sourceItemID IS NULL"; } else { var sql = 'SELECT itemID FROM collectionItems ' diff --git a/chrome/chromeFiles/content/scholar/xpcom/schema.js b/chrome/chromeFiles/content/scholar/xpcom/schema.js index 8f34c69cc4..3bdbde23f4 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/schema.js +++ b/chrome/chromeFiles/content/scholar/xpcom/schema.js @@ -385,7 +385,7 @@ Scholar.Schema = new function(){ // // Change this value to match the schema version // - var toVersion = 24; + var toVersion = 25; if (toVersion != _getSchemaSQLVersion()){ throw('Schema version does not match version in _migrateSchema()'); @@ -400,7 +400,7 @@ Scholar.Schema = new function(){ // Each block performs the changes necessary to move from the // previous revision to that one. for (var i=parseInt(fromVersion) + 1; i<=toVersion; i++){ - if (i==24){ + if (i==25){ _initializeSchema(); } } diff --git a/chrome/chromeFiles/locale/en-US/scholar/scholar.properties b/chrome/chromeFiles/locale/en-US/scholar/scholar.properties index a296a159bc..bbef86d0be 100644 --- a/chrome/chromeFiles/locale/en-US/scholar/scholar.properties +++ b/chrome/chromeFiles/locale/en-US/scholar/scholar.properties @@ -47,6 +47,7 @@ itemFields.type = Type itemFields.callNumber = Call Number itemFields.extra = Extra +itemTypes.note = Note itemTypes.book = Book itemTypes.bookSection = Book Section itemTypes.journalArticle = Journal Article diff --git a/schema.sql b/schema.sql index 57eca8a40b..692a670b38 100644 --- a/schema.sql +++ b/schema.sql @@ -1,4 +1,4 @@ --- 24 +-- 25 DROP TABLE IF EXISTS version; CREATE TABLE version ( @@ -62,16 +62,14 @@ DROP TABLE IF EXISTS itemNotes; CREATE TABLE itemNotes ( - noteID INT, itemID INT, + sourceItemID INT, note TEXT, - dateCreated DATETIME DEFAULT CURRENT_TIMESTAMP, - dateModified DATETIME DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (noteID), - FOREIGN KEY (itemID) REFERENCES items(itemID) + PRIMARY KEY (itemID), + FOREIGN KEY (sourceItemID) REFERENCES items(itemID) ); - DROP INDEX IF EXISTS itemNotes_itemID; - CREATE INDEX itemNotes_itemID ON itemNotes(itemID); + DROP INDEX IF EXISTS itemNotes_sourceItemID; + CREATE INDEX itemNotes_sourceItemID ON itemNotes(sourceItemID); DROP TABLE IF EXISTS keywords; CREATE TABLE keywords ( @@ -178,18 +176,19 @@ ); - INSERT INTO itemTypes VALUES (1,'book'); - INSERT INTO itemTypes VALUES (2,'bookSection'); - INSERT INTO itemTypes VALUES (3,'journalArticle'); - INSERT INTO itemTypes VALUES (4,'magazineArticle'); - INSERT INTO itemTypes VALUES (5,'newspaperArticle'); - INSERT INTO itemTypes VALUES (6,'thesis'); - INSERT INTO itemTypes VALUES (7,'letter'); - INSERT INTO itemTypes VALUES (8,'manuscript'); - INSERT INTO itemTypes VALUES (9,'interview'); - INSERT INTO itemTypes VALUES (10,'film'); - INSERT INTO itemTypes VALUES (11,'artwork'); - INSERT INTO itemTypes VALUES (12,'website'); + INSERT INTO itemTypes VALUES (1,'note'); + INSERT INTO itemTypes VALUES (2,'book'); + INSERT INTO itemTypes VALUES (3,'bookSection'); + INSERT INTO itemTypes VALUES (4,'journalArticle'); + INSERT INTO itemTypes VALUES (5,'magazineArticle'); + INSERT INTO itemTypes VALUES (6,'newspaperArticle'); + INSERT INTO itemTypes VALUES (7,'thesis'); + INSERT INTO itemTypes VALUES (8,'letter'); + INSERT INTO itemTypes VALUES (9,'manuscript'); + INSERT INTO itemTypes VALUES (10,'interview'); + INSERT INTO itemTypes VALUES (11,'film'); + INSERT INTO itemTypes VALUES (12,'artwork'); + INSERT INTO itemTypes VALUES (13,'website'); INSERT INTO "fieldFormats" VALUES(1, '.*', 0); INSERT INTO "fieldFormats" VALUES(2, '[0-9]*', 1); @@ -220,134 +219,133 @@ INSERT INTO fields VALUES (23,'url',NULL); INSERT INTO fields VALUES (24,'type',NULL); - INSERT INTO "itemTypeFields" VALUES(1, 1, 1); - INSERT INTO "itemTypeFields" VALUES(1, 2, 2); - INSERT INTO "itemTypeFields" VALUES(1, 3, 3); - INSERT INTO "itemTypeFields" VALUES(1, 4, 4); - INSERT INTO "itemTypeFields" VALUES(1, 5, 5); - INSERT INTO "itemTypeFields" VALUES(1, 6, 6); - INSERT INTO "itemTypeFields" VALUES(1, 7, 7); - INSERT INTO "itemTypeFields" VALUES(1, 8, 8); - INSERT INTO "itemTypeFields" VALUES(1, 9, 9); - INSERT INTO "itemTypeFields" VALUES(1, 10, 10); - INSERT INTO "itemTypeFields" VALUES(1, 11, 11); - INSERT INTO "itemTypeFields" VALUES(3, 1, 1); - INSERT INTO "itemTypeFields" VALUES(3, 2, 2); - INSERT INTO "itemTypeFields" VALUES(3, 12, 3); - INSERT INTO "itemTypeFields" VALUES(3, 4, 4); - INSERT INTO "itemTypeFields" VALUES(3, 5, 5); - INSERT INTO "itemTypeFields" VALUES(3, 10, 6); - INSERT INTO "itemTypeFields" VALUES(3, 13, 7); INSERT INTO "itemTypeFields" VALUES(2, 1, 1); INSERT INTO "itemTypeFields" VALUES(2, 2, 2); - INSERT INTO "itemTypeFields" VALUES(2, 12, 3); - INSERT INTO "itemTypeFields" VALUES(2, 3, 4); - INSERT INTO "itemTypeFields" VALUES(2, 4, 5); - INSERT INTO "itemTypeFields" VALUES(2, 5, 6); - INSERT INTO "itemTypeFields" VALUES(2, 6, 7); - INSERT INTO "itemTypeFields" VALUES(2, 7, 8); - INSERT INTO "itemTypeFields" VALUES(2, 8, 9); - INSERT INTO "itemTypeFields" VALUES(2, 9, 10); - INSERT INTO "itemTypeFields" VALUES(2, 10, 11); - INSERT INTO "itemTypeFields" VALUES(2, 11, 12); + INSERT INTO "itemTypeFields" VALUES(2, 3, 3); + INSERT INTO "itemTypeFields" VALUES(2, 4, 4); + INSERT INTO "itemTypeFields" VALUES(2, 5, 5); + INSERT INTO "itemTypeFields" VALUES(2, 6, 6); + INSERT INTO "itemTypeFields" VALUES(2, 7, 7); + INSERT INTO "itemTypeFields" VALUES(2, 8, 8); + INSERT INTO "itemTypeFields" VALUES(2, 9, 9); + INSERT INTO "itemTypeFields" VALUES(2, 10, 10); + INSERT INTO "itemTypeFields" VALUES(2, 11, 11); INSERT INTO "itemTypeFields" VALUES(4, 1, 1); INSERT INTO "itemTypeFields" VALUES(4, 2, 2); INSERT INTO "itemTypeFields" VALUES(4, 12, 3); - INSERT INTO "itemTypeFields" VALUES(4, 14, 4); - INSERT INTO "itemTypeFields" VALUES(4, 10, 5); - INSERT INTO "itemTypeFields" VALUES(4, 13, 6); + INSERT INTO "itemTypeFields" VALUES(4, 4, 4); + INSERT INTO "itemTypeFields" VALUES(4, 5, 5); + INSERT INTO "itemTypeFields" VALUES(4, 10, 6); + INSERT INTO "itemTypeFields" VALUES(4, 13, 7); + INSERT INTO "itemTypeFields" VALUES(3, 1, 1); + INSERT INTO "itemTypeFields" VALUES(3, 2, 2); + INSERT INTO "itemTypeFields" VALUES(3, 12, 3); + INSERT INTO "itemTypeFields" VALUES(3, 3, 4); + INSERT INTO "itemTypeFields" VALUES(3, 4, 5); + INSERT INTO "itemTypeFields" VALUES(3, 5, 6); + INSERT INTO "itemTypeFields" VALUES(3, 6, 7); + INSERT INTO "itemTypeFields" VALUES(3, 7, 8); + INSERT INTO "itemTypeFields" VALUES(3, 8, 9); + INSERT INTO "itemTypeFields" VALUES(3, 9, 10); + INSERT INTO "itemTypeFields" VALUES(3, 10, 11); + INSERT INTO "itemTypeFields" VALUES(3, 11, 12); INSERT INTO "itemTypeFields" VALUES(5, 1, 1); INSERT INTO "itemTypeFields" VALUES(5, 2, 2); INSERT INTO "itemTypeFields" VALUES(5, 12, 3); - INSERT INTO "itemTypeFields" VALUES(5, 6, 4); - INSERT INTO "itemTypeFields" VALUES(5, 14, 5); - INSERT INTO "itemTypeFields" VALUES(5, 15, 6); - INSERT INTO "itemTypeFields" VALUES(5, 10, 7); - INSERT INTO "itemTypeFields" VALUES(5, 13, 8); + INSERT INTO "itemTypeFields" VALUES(5, 14, 4); + INSERT INTO "itemTypeFields" VALUES(5, 10, 5); + INSERT INTO "itemTypeFields" VALUES(5, 13, 6); INSERT INTO "itemTypeFields" VALUES(6, 1, 1); INSERT INTO "itemTypeFields" VALUES(6, 2, 2); - INSERT INTO "itemTypeFields" VALUES(6, 8, 3); - INSERT INTO "itemTypeFields" VALUES(6, 16, 4); - INSERT INTO "itemTypeFields" VALUES(6, 9, 5); - INSERT INTO "itemTypeFields" VALUES(6, 10, 6); - INSERT INTO "itemTypeFields" VALUES(6, 17, 8); - INSERT INTO "itemTypeFields" VALUES(7, 2, 1); - INSERT INTO "itemTypeFields" VALUES(7, 24, 2); - INSERT INTO "itemTypeFields" VALUES(7, 14, 3); - INSERT INTO "itemTypeFields" VALUES(7, 19, 4); - INSERT INTO "itemTypeFields" VALUES(8, 1, 1); - INSERT INTO "itemTypeFields" VALUES(8, 2, 2); - INSERT INTO "itemTypeFields" VALUES(8, 24, 3); - INSERT INTO "itemTypeFields" VALUES(8, 7, 4); - INSERT INTO "itemTypeFields" VALUES(8, 14, 5); - INSERT INTO "itemTypeFields" VALUES(8, 19, 6); - INSERT INTO "itemTypeFields" VALUES(9, 2, 1); - INSERT INTO "itemTypeFields" VALUES(9, 14, 2); - INSERT INTO "itemTypeFields" VALUES(9, 20, 3); - INSERT INTO "itemTypeFields" VALUES(9, 19, 4); - INSERT INTO "itemTypeFields" VALUES(10, 1, 1); - INSERT INTO "itemTypeFields" VALUES(10, 2, 2); - INSERT INTO "itemTypeFields" VALUES(10, 21, 3); - INSERT INTO "itemTypeFields" VALUES(10, 9, 4); + INSERT INTO "itemTypeFields" VALUES(6, 12, 3); + INSERT INTO "itemTypeFields" VALUES(6, 6, 4); + INSERT INTO "itemTypeFields" VALUES(6, 14, 5); + INSERT INTO "itemTypeFields" VALUES(6, 15, 6); + INSERT INTO "itemTypeFields" VALUES(6, 10, 7); + INSERT INTO "itemTypeFields" VALUES(6, 13, 8); + INSERT INTO "itemTypeFields" VALUES(7, 1, 1); + INSERT INTO "itemTypeFields" VALUES(7, 2, 2); + INSERT INTO "itemTypeFields" VALUES(7, 8, 3); + INSERT INTO "itemTypeFields" VALUES(7, 16, 4); + INSERT INTO "itemTypeFields" VALUES(7, 9, 5); + INSERT INTO "itemTypeFields" VALUES(7, 10, 6); + INSERT INTO "itemTypeFields" VALUES(7, 17, 8); + INSERT INTO "itemTypeFields" VALUES(8, 2, 1); + INSERT INTO "itemTypeFields" VALUES(8, 24, 2); + INSERT INTO "itemTypeFields" VALUES(8, 14, 3); + INSERT INTO "itemTypeFields" VALUES(8, 19, 4); + INSERT INTO "itemTypeFields" VALUES(9, 1, 1); + INSERT INTO "itemTypeFields" VALUES(9, 2, 2); + INSERT INTO "itemTypeFields" VALUES(9, 24, 3); + INSERT INTO "itemTypeFields" VALUES(9, 7, 4); + INSERT INTO "itemTypeFields" VALUES(9, 14, 5); + INSERT INTO "itemTypeFields" VALUES(9, 19, 6); + INSERT INTO "itemTypeFields" VALUES(10, 2, 1); + INSERT INTO "itemTypeFields" VALUES(10, 14, 2); + INSERT INTO "itemTypeFields" VALUES(10, 20, 3); + INSERT INTO "itemTypeFields" VALUES(10, 19, 4); INSERT INTO "itemTypeFields" VALUES(11, 1, 1); INSERT INTO "itemTypeFields" VALUES(11, 2, 2); - INSERT INTO "itemTypeFields" VALUES(11, 24, 3); - INSERT INTO "itemTypeFields" VALUES(11, 14, 4); + INSERT INTO "itemTypeFields" VALUES(11, 21, 3); + INSERT INTO "itemTypeFields" VALUES(11, 9, 4); INSERT INTO "itemTypeFields" VALUES(12, 1, 1); INSERT INTO "itemTypeFields" VALUES(12, 2, 2); - INSERT INTO "itemTypeFields" VALUES(12, 14, 3); - INSERT INTO "itemTypeFields" VALUES(12, 23, 4); + INSERT INTO "itemTypeFields" VALUES(12, 24, 3); + INSERT INTO "itemTypeFields" VALUES(12, 14, 4); + INSERT INTO "itemTypeFields" VALUES(13, 1, 1); + INSERT INTO "itemTypeFields" VALUES(13, 2, 2); + INSERT INTO "itemTypeFields" VALUES(13, 14, 3); + INSERT INTO "itemTypeFields" VALUES(13, 23, 4); + INSERT INTO "itemTypeFields" VALUES(12, 18, 5); + INSERT INTO "itemTypeFields" VALUES(2, 18, 12); + INSERT INTO "itemTypeFields" VALUES(3, 18, 13); INSERT INTO "itemTypeFields" VALUES(11, 18, 5); - INSERT INTO "itemTypeFields" VALUES(1, 18, 12); - INSERT INTO "itemTypeFields" VALUES(2, 18, 13); - INSERT INTO "itemTypeFields" VALUES(10, 18, 5); + INSERT INTO "itemTypeFields" VALUES(12, 17, 6); + INSERT INTO "itemTypeFields" VALUES(12, 22, 7); + INSERT INTO "itemTypeFields" VALUES(2, 17, 13); + INSERT INTO "itemTypeFields" VALUES(2, 22, 14); + INSERT INTO "itemTypeFields" VALUES(3, 17, 14); + INSERT INTO "itemTypeFields" VALUES(3, 22, 15); INSERT INTO "itemTypeFields" VALUES(11, 17, 6); INSERT INTO "itemTypeFields" VALUES(11, 22, 7); - INSERT INTO "itemTypeFields" VALUES(1, 17, 13); - INSERT INTO "itemTypeFields" VALUES(1, 22, 14); - INSERT INTO "itemTypeFields" VALUES(2, 17, 14); - INSERT INTO "itemTypeFields" VALUES(2, 22, 15); INSERT INTO "itemTypeFields" VALUES(10, 17, 6); + INSERT INTO "itemTypeFields" VALUES(10, 18, 5); INSERT INTO "itemTypeFields" VALUES(10, 22, 7); - INSERT INTO "itemTypeFields" VALUES(9, 17, 6); - INSERT INTO "itemTypeFields" VALUES(9, 18, 5); - INSERT INTO "itemTypeFields" VALUES(9, 22, 7); - INSERT INTO "itemTypeFields" VALUES(3, 17, 9); - INSERT INTO "itemTypeFields" VALUES(3, 18, 8); - INSERT INTO "itemTypeFields" VALUES(3, 22, 10); - INSERT INTO "itemTypeFields" VALUES(7, 17, 6); - INSERT INTO "itemTypeFields" VALUES(7, 18, 5); - INSERT INTO "itemTypeFields" VALUES(7, 22, 7); - INSERT INTO "itemTypeFields" VALUES(4, 17, 8); - INSERT INTO "itemTypeFields" VALUES(4, 18, 7); - INSERT INTO "itemTypeFields" VALUES(4, 22, 9); - INSERT INTO "itemTypeFields" VALUES(8, 17, 8); - INSERT INTO "itemTypeFields" VALUES(8, 18, 7); - INSERT INTO "itemTypeFields" VALUES(8, 22, 9); - INSERT INTO "itemTypeFields" VALUES(5, 17, 10); - INSERT INTO "itemTypeFields" VALUES(5, 18, 9); - INSERT INTO "itemTypeFields" VALUES(5, 22, 11); - INSERT INTO "itemTypeFields" VALUES(6, 18, 7); - INSERT INTO "itemTypeFields" VALUES(6, 22, 9); - INSERT INTO "itemTypeFields" VALUES(12, 22, 5); - + INSERT INTO "itemTypeFields" VALUES(4, 17, 9); + INSERT INTO "itemTypeFields" VALUES(4, 18, 8); + INSERT INTO "itemTypeFields" VALUES(4, 22, 10); + INSERT INTO "itemTypeFields" VALUES(8, 17, 6); + INSERT INTO "itemTypeFields" VALUES(8, 18, 5); + INSERT INTO "itemTypeFields" VALUES(8, 22, 7); + INSERT INTO "itemTypeFields" VALUES(5, 17, 8); + INSERT INTO "itemTypeFields" VALUES(5, 18, 7); + INSERT INTO "itemTypeFields" VALUES(5, 22, 9); + INSERT INTO "itemTypeFields" VALUES(9, 17, 8); + INSERT INTO "itemTypeFields" VALUES(9, 18, 7); + INSERT INTO "itemTypeFields" VALUES(9, 22, 9); + INSERT INTO "itemTypeFields" VALUES(6, 17, 10); + INSERT INTO "itemTypeFields" VALUES(6, 18, 9); + INSERT INTO "itemTypeFields" VALUES(6, 22, 11); + INSERT INTO "itemTypeFields" VALUES(7, 18, 7); + INSERT INTO "itemTypeFields" VALUES(7, 22, 9); + INSERT INTO "itemTypeFields" VALUES(13, 22, 5); -- Some sample data - INSERT INTO "items" VALUES(1, 1, 'Online connections: Internet interpersonal relationships', '2006-03-12 05:24:40', '2006-03-12 05:24:40'); - INSERT INTO "items" VALUES(2, 1, 'Computer-Mediated Communication: Human-to-Human Communication Across the Internet', '2006-03-12 05:25:50', '2006-03-12 05:25:50'); - INSERT INTO "items" VALUES(3, 3, 'Residential propinquity as a factor in marriage selection', '2006-03-12 05:26:37', '2006-03-12 05:26:37'); - INSERT INTO "items" VALUES(4, 1, 'Connecting: how we form social bonds and communities in the Internet age', '2006-03-12 05:27:15', '2006-03-12 05:27:15'); - INSERT INTO "items" VALUES(5, 1, 'Male, Female, Email: The Struggle for Relatedness in a Paranoid Society', '2006-03-12 05:27:36', '2006-03-12 05:27:36'); - INSERT INTO "items" VALUES(6, 3, 'Social Implications of Sociology', '2006-03-12 05:27:53', '2006-03-12 05:27:53'); - INSERT INTO "items" VALUES(7, 1, 'Social Pressures in Informal Groups: A Study of Human Factors in Housing', '2006-03-12 05:28:05', '2006-03-12 05:28:05'); - INSERT INTO "items" VALUES(8, 1, 'Cybersociety 2.0: Revisiting Computer-Mediated Community and Technology', '2006-03-12 05:28:37', '2006-03-12 05:28:37'); - INSERT INTO "items" VALUES(9, 3, 'The Computer as a Communication Device', '2006-03-12 05:29:03', '2006-03-12 05:29:03'); - INSERT INTO "items" VALUES(10, 3, 'What Does Research Say about the Nature of Computer-mediated Communication: Task-Oriented, Social-Emotion-Oriented, or Both?', '2006-03-12 05:29:12', '2006-03-12 05:29:12'); - INSERT INTO "items" VALUES(11, 1, 'The second self: computers and the human spirit', '2006-03-12 05:30:38', '2006-03-12 05:30:38'); - INSERT INTO "items" VALUES(12, 1, 'Life on the screen: identity in the age of the Internet', '2006-03-12 05:30:49', '2006-03-12 05:30:49'); - INSERT INTO "items" VALUES(13, 3, 'The computer conference: An altered state of communication', '2006-03-12 05:31:00', '2006-03-12 05:31:00'); - INSERT INTO "items" VALUES(14, 3, 'Computer Networks as Social Networks: Collaborative Work, Telework, and Community', '2006-03-12 05:31:17', '2006-03-12 05:31:17'); - INSERT INTO "items" VALUES(15, 1, 'The Internet in everyday life', '2006-03-12 05:31:41', '2006-03-12 05:31:41'); + INSERT INTO "items" VALUES(1, 2, 'Online connections: Internet interpersonal relationships', '2006-03-12 05:24:40', '2006-03-12 05:24:40'); + INSERT INTO "items" VALUES(2, 2, 'Computer-Mediated Communication: Human-to-Human Communication Across the Internet', '2006-03-12 05:25:50', '2006-03-12 05:25:50'); + INSERT INTO "items" VALUES(3, 4, 'Residential propinquity as a factor in marriage selection', '2006-03-12 05:26:37', '2006-03-12 05:26:37'); + INSERT INTO "items" VALUES(4, 2, 'Connecting: how we form social bonds and communities in the Internet age', '2006-03-12 05:27:15', '2006-03-12 05:27:15'); + INSERT INTO "items" VALUES(5, 2, 'Male, Female, Email: The Struggle for Relatedness in a Paranoid Society', '2006-03-12 05:27:36', '2006-06-26 16:26:53'); + INSERT INTO "items" VALUES(6, 4, 'Social Implications of Sociology', '2006-03-12 05:27:53', '2006-03-12 05:27:53'); + INSERT INTO "items" VALUES(7, 2, 'Social Pressures in Informal Groups: A Study of Human Factors in Housing', '2006-03-12 05:28:05', '2006-03-12 05:28:05'); + INSERT INTO "items" VALUES(8, 2, 'Cybersociety 2.0: Revisiting Computer-Mediated Community and Technology', '2006-03-12 05:28:37', '2006-03-12 05:28:37'); + INSERT INTO "items" VALUES(9, 4, 'The Computer as a Communication Device', '2006-03-12 05:29:03', '2006-03-12 05:29:03'); + INSERT INTO "items" VALUES(10, 4, 'What Does Research Say about the Nature of Computer-mediated Communication: Task-Oriented, Social-Emotion-Oriented, or Both?', '2006-03-12 05:29:12', '2006-03-12 05:29:12'); + INSERT INTO "items" VALUES(11, 2, 'The second self: computers and the human spirit', '2006-03-12 05:30:38', '2006-03-12 05:30:38'); + INSERT INTO "items" VALUES(12, 2, 'Life on the screen: identity in the age of the Internet', '2006-03-12 05:30:49', '2006-03-12 05:30:49'); + INSERT INTO "items" VALUES(13, 4, 'The computer conference: An altered state of communication', '2006-03-12 05:31:00', '2006-03-12 05:31:00'); + INSERT INTO "items" VALUES(14, 4, 'Computer Networks as Social Networks: Collaborative Work, Telework, and Community', '2006-03-12 05:31:17', '2006-03-12 05:31:17'); + INSERT INTO "items" VALUES(15, 2, 'The Internet in everyday life', '2006-03-12 05:31:41', '2006-03-12 05:31:41'); INSERT INTO "itemData" VALUES(1, 9, 2001); INSERT INTO "itemData" VALUES(1, 7, 'Cresskill, N.J.');