Skip to content

Instantly share code, notes, and snippets.

@follesoe
Created December 24, 2010 14:21
Show Gist options
  • Save follesoe/754271 to your computer and use it in GitHub Desktop.
Save follesoe/754271 to your computer and use it in GitHub Desktop.
Google is gearing up!
var recentPhrases = ['', '', ''];
// We re-throw Gears exceptions to make them play nice with certain tools.
// This will be unnecessary in a future version of Gears.
try
{
// Get the 3 most recent entries. Delete any others.
var rs = db.execute('select * from Demo order by Timestamp desc');
var index = 0;
while (rs.isValidRow())
{
if (index < 3)
{
recentPhrases[index] = rs.field(0);
}
else
{
db.execute('delete from Demo where Timestamp=?', [rs.field(1)]);
}
++index;
rs.next();
}
rs.close();
}
catch (e)
{
throw new Error(e.message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment