/// <summary> /// Create a new entry in FsBlock /// </summary> /// <returns> new ID for the inserted node </returns> internal static FsID addFsNode(SQLiteDatabase db, SqlFsConst.FSTYPE type, string dirName, FsID parentID) { long curTime = SqlFsFunc.calToFileTime(new DateTime()); List <object> colsAndValues = new List <object>(10); colsAndValues.Add(SqlFs.FSBLOCK.fsCreateTime.ToString()); colsAndValues.Add(curTime); colsAndValues.Add(SqlFs.FSBLOCK.fsLastModTime.ToString()); colsAndValues.Add(curTime); colsAndValues.Add(SqlFs.FSBLOCK.fsFileSize.ToString()); colsAndValues.Add(0); colsAndValues.Add(SqlFs.FSBLOCK.fsType.ToString()); colsAndValues.Add(type.v()); colsAndValues.Add(SqlFs.FSBLOCK.fsName.ToString()); colsAndValues.Add(dirName); colsAndValues.Add(SqlFs.FSBLOCK.fsParent.ToString()); colsAndValues.Add(parentID); ContentValues contValues = SqlStr.genContentValues(colsAndValues); try { db.insert(SqlFs.DBNAMES.FsBlock.ToString(), null, contValues); } catch (Exception e) { SqlFsLog.debug(e); SqlFsErrCode.CurrentError = FsErr.AddFsNodeError; return(SqlFsConst.INVALIDID); } // retrieve the ID of the new entry return(SqlFs.getLastInsertID(db)); }
protected internal virtual FsID getLastInsertID(SQLiteDatabase db) { return(SqlFs.getLastInsertID(db)); }