7.6. Suggested Exercises

Although this application nicely covers the basics (so say we all[]!) there are certainly other capabilities that a tool of this nature can, and arguably even should, provide. Fortunately, that makes it pretty easy for me to suggest exercises to you:

[] If you read that and immediately "geeked out," as the saying goes, then I really don't need to say anything further. For those unfamiliar with the phrase "so say we all," that is the call to arms in the Battlestar Galactica television series. It basically means "We're all working toward the same stated goal as a unified front." On the show it seems to have a religious origin, but we'll skip getting into BSG canon, in the interest of not killing any more trees than we have to in order to print this book!

  • Add functions for dealing with indexes. Since this application is modeled largely on the SQLite Manager Firefox add-on, index features should be roughly the same, which means you'd want three new buttons on the Table Details Window: Create Index, Drop Index, and Reindex. The last one should be nothing more than a modification of the doSimpleOp() method in TableDetailsWindow.js. The Create Index and Drop Index functions will first require that you figure out how to retrieve the list of indexes for a table and then present a Window to enter the index details in the case of Create Index, or a list of existing indexes to choose from in the case of Delete Index. None of this is especially hard, and would make for a good exercise (hint: getting the list of indexes is a slight modification to the query to retrieve a list of tables in a database).

  • The SQLite engine Gears uses has a full-text search capability, and it would be nice if there was a Text Search tool, similar to the Query tool, where that could be used.

  • Provide the ability to add a new record from the Browse tab of the Table Details Window, as well as the ability to duplicate, edit, or delete the selected record.

  • Allow more than 20 fields to be added in the Create Table Window. You can implement this however you choose; one way would be to dynamically add a new row to the form any time you detect that all existing rows have been populated.

  • Talking about the Browse tab again, there is one major flaw there: what happens if there are more than a trivial number of rows in the table? It's going to grind the UI down to a halt, that's what! Therefore, you should implement some sort of paging mechanism. You could take several approaches here (at least, two that I can think of). The first would be to use the Ext JS Store/paging mechanism, which would be a fair bit of work to set up but at least you could get the paging for free. This would require determining what provisions SQLite has for paging (and honestly, I'm not sure what it does or doesn't provide). The other approach is to simply query for all records as we're already doing, then implement the paging capability yourself without using Ext JS's data mechanisms. This would probably wind up being easier to implement in an ironic way, and performance shouldn't be too bad (there's still the possibility of a locked UI if there's a ton of rows, but I suspect there would truly have to be thousands and thousands before it became an issue).

  • Add the ability to limit the results seen in the Browse tab. I envision this as a list of the fields in the table and next to each is a ComboBox listing logic operations (equals, greater than, less, than, and so forth) and then a Textfield where a value is entered. Users can use as few or as many as they wish, and you simply build the where clause of the query.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.78.41