Exemplo n.º 1
0
        /// <summary>
        /// Update an entry. </summary>
        /// <param name="id"> existing entry identifier. </param>
        /// <param name="values"> values to update. </param>
        /// <returns> true if update was successful, false otherwise. </returns>
        public virtual bool update(long id, ContentValues values)
        {
            /* Try SQLite */
            if (mIMDB == null)
            {
                try
                {
                    /* Update data */
                    int updated = Database.update(mManager.TableName, values, PRIMARY_KEY_SELECTION, new string[] { id.ToString() });

                    /* Return success */
                    return(updated > 0);
                }
                catch (Exception e)
                {
                    switchToInMemory("update", e);
                }
            }

            /* If failed over in-memory */
            ContentValues existing = mIMDB[id];

            if (existing == null)
            {
                return(false);
            }
            existing.putAll(values);
            return(true);
        }