Results 1 to 6 of 6
Like Tree1Likes
  • 1 Post By Herrie
  1.    #1  
    As you might know the 2.2.4 Enyo Phone app on the slower devices (Veer, Pre2 etc) get quite laggy after a while.

    This seems to be due to the call history accumulating. Doing a "Clear Call History" solves this, however this would delete ALL call history.

    I would prefer to delete the call history except for lets say the last 10 or 20 records.

    Anyone got an idea how to do this?

    Below is the code that deletes the complete call history.
    Code:
    	this.$.purgeCallHistory.call({
    			"query":{"from":"com.palm.phonecall:1"},"purge":false
    		}
    Once I know how to do this, I will try to create a (Tweaks enabled) patch that will automatically delete the old call history items
    Last edited by Herrie; 03/01/2013 at 02:50 AM.
    Isandunk likes this.
  2. #2  
    The simplest way might be to just get a list of ids using find with "select": ["_id"], remove the first or last 20 from the results, and then delete them by id with {"ids": ["id1", "id2"]}, etc.

    You'll need to call find multiple times with the "page" set to the last "next" value (if any) since each find can only return 500 results.

    https://developer.palm.com/content/a...-examples.html
  3. #3  
    What greenoyster says is basically correct... but the issue is that theoretically the database is not ordered, so "the last 20 ids" of what you find are not guaranteed to be the last 20 calls... so more secure would be to get a timestamp together with the id (i.e. expand the select statement) and use that to find the 20 most recent entries.
  4.    #4  
    Quote Originally Posted by Garfonso View Post
    What greenoyster says is basically correct... but the issue is that theoretically the database is not ordered, so "the last 20 ids" of what you find are not guaranteed to be the last 20 calls... so more secure would be to get a timestamp together with the id (i.e. expand the select statement) and use that to find the 20 most recent entries.
    It seems that there's a unix timestamp... Any idea how to create a query that would select everything except the last 20 items? I don't believe DB8 supports subqueries?
  5. #5  
    Instead of the number you could say "the last week" (or something, maybe tweakable?) and add a where clause to compare with the timestamp. That's the only thing that comes to my mind.

    Of course you can still get all entries and sort them out in jsjsjs $manually$.
  6.    #6  
    Quote Originally Posted by Garfonso View Post
    Instead of the number you could say "the last week" (or something, maybe tweakable?) and add a where clause to compare with the timestamp. That's the only thing that comes to my mind.

    Of course you can still get all entries and sort them out in jsjsjs $manually$.
    Thanks, that sounds like a proper suggestion. Will have a go at it when I have some time

Posting Permissions