Created
December 24, 2010 14:21
-
-
Save follesoe/754271 to your computer and use it in GitHub Desktop.
Google is gearing up!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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