jimmyH / mypois

Build POIs for Skoda MIB2 (Columbus & Amundsen) SatNavs
GNU General Public License v2.0
20 stars 5 forks source link

documentation about the database? #10

Open 1e1 opened 6 years ago

1e1 commented 6 years ago

Hi,

Do you have some links where read how the database works?

I see the schema of MIB2HIGH:

CREATE VIRTUAL TABLE poicoord USING rtree (poiid INTEGER,latmin REAL,latmax REAL,lonmin REAL,lonmax REAL);
CREATE TABLE IF NOT EXISTS "poicoord_rowid"(rowid INTEGER PRIMARY KEY,nodeno);
CREATE TABLE IF NOT EXISTS "poicoord_node"(nodeno INTEGER PRIMARY KEY,data);
CREATE TABLE IF NOT EXISTS "poicoord_parent"(nodeno INTEGER PRIMARY KEY,parentnode);
CREATE TABLE poidata (poiid INTEGER,type INTEGER,namephon TEXT,ccode INTEGER,zipcode TEXT,city TEXT,street TEXT,housenr TEXT,phone TEXT,ntlimportance INTEGER,exttype TEXT,extcont TEXT,warning TEXT,warnphon TEXT,CONSTRAINT PK_poidata PRIMARY KEY (poiid));
CREATE VIRTUAL TABLE poiname USING fts3 (name TEXT);
CREATE TABLE IF NOT EXISTS 'poiname_content'(docid INTEGER PRIMARY KEY, 'c0name');
CREATE TABLE IF NOT EXISTS 'poiname_segments'(blockid INTEGER PRIMARY KEY, block BLOB);
CREATE TABLE IF NOT EXISTS 'poiname_segdir'(level INTEGER,idx INTEGER,start_block INTEGER,leaves_end_block INTEGER,end_block INTEGER,root BLOB,PRIMARY KEY(level, idx));

I would know more about poiname_segments. I would add POI on a road section.

Thanks

jimmyH commented 6 years ago

I have not seen any documentation on how VW uses the database(s). Both MIB2HIGH and MIB2TSD use sqlite3 databases which you can read about at https://www.sqlite.org

MIB2HIGH uses virtual tables to speed up searching. The poicoord* and poiname* tables are used internal to sqlite to handle these virtual tables. We can only use the poidata and poicoord tables.

1e1 commented 6 years ago

Ok, it's very light :/

pPoiSystemTable.personalComment is used for each category, not for each POI.

But pPoiId is the primary key and catId is a foreign key.

I dumped the database:

sqlite3 ./SD_CARD/PersonalPOI/MIB2TSD/personalpoi/ppoidb/1/default/poidata.db3 .dump > dump.sql
grep -n pPoiSystemTable ./dump.sql | head -10
58151:CREATE TABLE pPoiSystemTable( pPoiId INTEGER UNIQUE PRIMARY KEY,catId INTEGER NOT NULL,priority INTEGER,sortIndex INTEGER ,personalComment TEXT ,str1 TEXT ,str2 TEXT ,int1 INTEGER ,int2 INTEGER ,version TEXT,isDirty INTEGER , FOREIGN KEY(catId) REFERENCES pPoiCategoryTable(catId) ON UPDATE CASCADE);
58152:INSERT INTO pPoiSystemTable VALUES(1,2001,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
58153:INSERT INTO pPoiSystemTable VALUES(2,2001,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
58154:INSERT INTO pPoiSystemTable VALUES(3,2001,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
58155:INSERT INTO pPoiSystemTable VALUES(4,2001,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
58156:INSERT INTO pPoiSystemTable VALUES(5,2001,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
58157:INSERT INTO pPoiSystemTable VALUES(6,2001,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
58158:INSERT INTO pPoiSystemTable VALUES(7,2001,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
58159:INSERT INTO pPoiSystemTable VALUES(8,2001,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
58160:INSERT INTO pPoiSystemTable VALUES(9,2001,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

I think we can add a personalComment :)

jimmyH commented 6 years ago

You are right, I was just getting confused :)

The only question is whether the MIB2TSD displays the personalComment...

1e1 commented 6 years ago

I tested on VW Sharan (revision 2015), I don't know if i'm using MIB2TSD or MIB2HIGH. I stuff personalComment on MIB2TSD but I cann't see its content on my GPS.

1e1 commented 6 years ago

I can confirm my Sharan (revision 2015) is using MIB2TSD(not MIB2HIGH). Values in personalComment are not displayed on my screen.