So I have a database with 2 tables. One is the Polygon table, and each  
row in Polygon can map to multiple rows in the Points table. I want a  
fetchAllPolygons function, similar to the sample Notepad application.  
I could do something like this (I could make it better, but that's the  
main point):

     /**
      * Return a Cursor over the list of all notes in the database
      *
      * @return Cursor over all notes
      */
     public Cursor fetchAllPolys() {

         return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID,  
KEY_TITLE
                }, null, null, null, null, null);
     }

     public Cursor fetchAllPolyPoints() {

         return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID,  
KEY_X,
                 KEY_Y}, null, null, null, null, null);
     }

but that is 1) a pain, and 2) I don't want the rest of my application  
to have to understand the database layout. I don't know of a  
CursorAdapter that will do the transforms I am looking for, so I will  
write them myself.

So, the question - I am thinking of simply subclassing the Polygon, to  
create a DatabasePolygon, with all of the calls simply being the  
correct callthru's to the Cursor. I am thinking that this will still  
preserve the usefulness of Cursors, will use very low memory because  
they are wrapper classes, and will allow the rest of my application to  
never know anything about the database, simply about Polygon.

Thoughts?

Thanks,
Hamilton
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to