Markus Neteler 51e2578aa9 DB driver meta manuals: header/footer completed 12 lat temu
..
Makefile d6700ffb2c Update LIBES, DEPENDENCIES from linkage database 16 lat temu
README db49180dd7 welcome to GRASS 7.0.svn 17 lat temu
create_table.c 5d490c2c31 DB drivers: use db_d_report_error() instead of its own mechanism 13 lat temu
cursor.c 5d490c2c31 DB drivers: use db_d_report_error() instead of its own mechanism 13 lat temu
db.c dd3aaad609 SQLite DB driver: implement delete_database() 12 lat temu
dbdriver.h 1acdd0be01 Build system clean-up 16 lat temu
describe.c 351dc028a3 sqlite: report text fields without width as text, not character 12 lat temu
driver.c 9a011b5f2b sqlite driver: fix for https://trac.osgeo.org/grass/ticket/548 and related 14 lat temu
error.c 5d490c2c31 DB drivers: use db_d_report_error() instead of its own mechanism 13 lat temu
execute.c 5d490c2c31 DB drivers: use db_d_report_error() instead of its own mechanism 13 lat temu
fetch.c 82833e7754 debug cosmetics 13 lat temu
globals.h 8868d4b686 indent -bad -bap -bbb -br -bli0 -bls -cli0 -ncs -fc1 -hnl -i4 \ 17 lat temu
grass-sqlite.html 51e2578aa9 DB driver meta manuals: header/footer completed 12 lat temu
index.c 5d490c2c31 DB drivers: use db_d_report_error() instead of its own mechanism 13 lat temu
listdb.c f3bc576a36 SQLite DB driver: list databases from default directory (`mapset/sqlite`) 12 lat temu
listtab.c 5d490c2c31 DB drivers: use db_d_report_error() instead of its own mechanism 13 lat temu
main.c b48f7a55b2 SQLITE driver: fix for https://trac.osgeo.org/grass/ticket/548 14 lat temu
proto.h 5d490c2c31 DB drivers: use db_d_report_error() instead of its own mechanism 13 lat temu
select.c 5d490c2c31 DB drivers: use db_d_report_error() instead of its own mechanism 13 lat temu

README

SQLite driver

Note:
If SQL types are wrongly detected as "numeric", check
(at least) the function affinity_type() in describe.c.

#####################################################
# email from 10/2005:

To use it, you have to set driver and database, e.g.:
db.connect driver=sqlite \
database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db'

The database is created automatically when used first time.
That is SQLite feature followed also in the driver.

SQLite uses "type affinity", (http://www.sqlite.org/datatype3.html)
that means column types are recommended, but not required.

If the driver in GRASS has to determin column type, it first reads
"affinity" if available (table column) and then data types of values
in the first row. If a column in a query does not come from table and there
are no results, the driver cannot recognize column type.

Example:
echo "select 1 as col1 where 1 = 2" | db.select
WARNING: SQLite driver: column 'col1', SQLite type 0 is not supported

For direct work with SQLite database you can use CLI called 'sqlite3'
which is part of SQLite distribution or one of available GUIs,
for example Kexi:
http://www.koffice.org/kexi/screenshots.php
http://www.koffice.org/kexi/

Related. I also added new type DB_SQL_TYPE_TEXT, which is mapped
to DB_C_TYPE_STRING.
That means you don't get warning like

WARNING: column 'c3' : type text is stored as varchar(250)
some data may be lost

until you try to copy the TEXT column with a driver which does not support
TEXT. Currently TEXT is support by sqlite and postgres driver.
It is possible and easy to add TEXT support to mysql driver, but I don't
have MySQL installed. If you are interested in TEXT in mysql
modify /drivers/mysql/create_table.c according to
/drivers/postgres/create_table.c


Radim