Use getRandomID() for new item ids rather than auto-increment

This commit is contained in:
Dan Stillman 2006-06-29 06:28:50 +00:00
parent 72ca609b52
commit b495bb6334

View file

@ -625,6 +625,10 @@ Scholar.Item.prototype.save = function(){
//
// Primary fields
//
sqlColumns.push('itemID');
var itemID = Scholar.getRandomID('items', 'itemID');
sqlValues.push(itemID);
sqlColumns.push('itemTypeID');
sqlValues.push({'int':this.getField('itemTypeID')});
@ -651,8 +655,8 @@ Scholar.Item.prototype.save = function(){
}
sql = sql.substring(0,sql.length-1) + ")";
// Save basic data to items table and get new ID
var itemID = Scholar.DB.query(sql,sqlValues);
// Save basic data to items table
Scholar.DB.query(sql, sqlValues);
this._data['itemID'] = itemID;
Scholar.History.setAssociatedID(itemID);