Active Topics

 



Notices


Reply
Thread Tools
brendan's Avatar
Posts: 531 | Thanked: 79 times | Joined on Oct 2006 @ This side of insane, that side of genius
#1
i am trying to use sqlite3 command line to look at my poi.db file.

when i issue...

select * from poi;

i only get the prompt back. i invoke sqlite3 from the command line as such...

sqlite3 poi.db

from the dir that the poi.db file resides in. a .databases returns the file as the main database and some temp db, so the db is opened and connected/attached to, or so i think.

i have over 50 poi's in the db, and i am getting nothing back form the select statement, though .schema and .tables comes back with info. is my syntax off or does anyone have an idea?
__________________
Nokia n800
OS 2008
Pharos iGPS 360-BT
ElmScan 5 BlueTooth
BlackBerry Bold (9000)
AT&T Wireless
 
bizshop's Avatar
Posts: 98 | Thanked: 8 times | Joined on Apr 2007 @ Port Angeles, WA
#2
When you issue 'select * from poi' is poi your table name? That is what you re asking in your query.
 
rcull's Avatar
Posts: 299 | Thanked: 168 times | Joined on Jun 2006 @ Wales UK
#3
Brendan
The 'temp' database will have been created when you issued something like 'create temp table poi' . When you then 'select * from poi;' it will default to the temp table. Issue 'drop table temp.poi;' you will then get what you expect from your select.

Rick
 
brendan's Avatar
Posts: 531 | Thanked: 79 times | Joined on Oct 2006 @ This side of insane, that side of genius
#4
sqlite> .databases
seq name file
--- --------------- ----------------------------------------------------------
0 main /home/user/poi.db
1 temp /var/tmp/sqlite_UP0NBVV1OTeVdi5
sqlite> drop table temp.poi;
SQL error: no such table: temp.poi
sqlite> drop table temp.poi
...> ;
SQL error: no such table: temp.poi
sqlite> drop database temp;
SQL error: near "database": syntax error
sqlite> select * from main.poi;
sqlite>

this is what i got when i tried...
__________________
Nokia n800
OS 2008
Pharos iGPS 360-BT
ElmScan 5 BlueTooth
BlackBerry Bold (9000)
AT&T Wireless
 
bizshop's Avatar
Posts: 98 | Thanked: 8 times | Joined on Apr 2007 @ Port Angeles, WA
#5
I still think you are querying the wrong thing.. You cannot " Select from" a database, you must select from a table. Unless you named both the table and the database by the same name (not a good idea IMHO).

In your example, you used 'select * from main.poi;' Main is just a namr/pointer to tjhe db file. So the queruy should be either 'select * from sometable' or 'select * from poi.sometable'
 
rcull's Avatar
Posts: 299 | Thanked: 168 times | Joined on Jun 2006 @ Wales UK
#6
Bizshop
The default name for Maemo Mappers db is poi.db. It holds two tables poi and category.
Brendan
I don't understand your query - 'select * from main.poi;'
If you have a temp.db then you have created at least one temporary table. What is the output from .schema

Rick
 
brendan's Avatar
Posts: 531 | Thanked: 79 times | Joined on Oct 2006 @ This side of insane, that side of genius
#7
what didn't show up was that i also did a 'select * from poi;' and got no returned record set. i was trying to explicitly specify the database and table in dotted, object-oriented fashion. that, too, didn't work.

sqlite> .schema
CREATE TABLE category (cat_id integer PRIMARY KEY,label text, desc text, enabled integer);
CREATE TABLE poi (poi_id integer PRIMARY KEY, lat real, lon real, label text, desc text, cat_id integer);
sqlite>
__________________
Nokia n800
OS 2008
Pharos iGPS 360-BT
ElmScan 5 BlueTooth
BlackBerry Bold (9000)
AT&T Wireless
 
rcull's Avatar
Posts: 299 | Thanked: 168 times | Joined on Jun 2006 @ Wales UK
#8
Brendan
It looks to me that you have lost your poi records. Does a .databases still list the temp database? 'select * from main.poi;' should really have listed any records in poi,dbs poi table in either case and .schema would normally list tables created in the temp db as well as the main db and you only seem to have the one poi table. If 'insert into poi (lat,lon,label,desc,cat_id) values (3.1,5.5,"Trial",Description",1);' and then a 'select * from poi;' returns your record then I think you have a good db with no records.

Rick
 
Reply


 
Forum Jump


All times are GMT. The time now is 23:30.