I think your proposed versioning makes sense. As long as we add any new columns after the existing columns so that if anybody's already using the schema and doing "select(*)" we won't break their code. Your idea of a hash-like index using separators seems a good idea. My only other thought was to force each of the x,y,z elements to a fixed length (perhaps by adding 1000000 to each, depending on what the biggest number each one could possibly be). But your method makes it more compact. Then for version 2, your lookup table could be: Code: CREATE TABLE tiles (z INTEGER, x INTEGER, y INTEGER, store_filename STRING, extension varchar(10), unix_epoch_timestamp INTEGER, store_tilenumber INTEGER, lookup STRING, PRIMARY KEY(lookup)); CREATE TABLE version (v integer); CREATE INDEX oldindex on tiles (z,x,y); For version 3, drop the z,x,y and extension columns as well as the oldindex index. Version 2 of the tile store could be: Code: CREATE TABLE tiles (z INTEGER, x INTEGER, y INTEGER, tile BLOB, extension VARCHAR(10), unix_epoch_timestamp INTEGER, id INTEGER AUTO INCREMENT, PRIMARY KEY(id)); CREATE TABLE version (v integer); CREATE INDEX oldindex on tiles (z,x,y); For version 3, drop the oldindex index. You could keep the x,y,z columns in this table for regenerating the lookup table as you mentioned. You could shrink the lookup table a bit more for version 3 by also dropping the epoch_timestamp from it. That would introduce a slight overhead when checking for updated tiles as it would need to be retrieved from the store rather than the lookup. I'm not sure which way would give the best balance of benefits. So you'd insert the tile in the store first, then retrieve the value of the id column to populate the store_tilenumber column in the lookup table.
CREATE TABLE tiles (z INTEGER, x INTEGER, y INTEGER, store_filename STRING, extension varchar(10), unix_epoch_timestamp INTEGER, store_tilenumber INTEGER, lookup STRING, PRIMARY KEY(lookup)); CREATE TABLE version (v integer); CREATE INDEX oldindex on tiles (z,x,y);
CREATE TABLE tiles (z INTEGER, x INTEGER, y INTEGER, tile BLOB, extension VARCHAR(10), unix_epoch_timestamp INTEGER, id INTEGER AUTO INCREMENT, PRIMARY KEY(id)); CREATE TABLE version (v integer); CREATE INDEX oldindex on tiles (z,x,y);
May i strongly suggest not using MyDocs and using dirs located directly under $HOME instead? MyDocs is exportable / mountable, so for example if you have connected your N900 via USB to a laptop maybe for copying some files over, you would not be able to use modRana (or any other SW that does this) at the same time and would have to choose between using the SW or copying files.
Another question (I guess this is already answered but I didn't find): Is there an easy way to download all needed tiles for an area externally and afterwards just throw them into correct folder on N900? downloading a bunch of some 20k tiles at once is quite hard. My N900 gets quite hot when using 3G-connection that intense.