1grass-dbf(1)                GRASS GIS User's Manual               grass-dbf(1)
2
3
4

DBF DATABASE DRIVER

6       The DBF driver is a file based attribute table driver.
7

Defining the DBF driver

9       The DBF driver is a file based driver, in theory no user interaction is
10       required. However, if the settings should be set back from a  different
11       driver to the DBF driver, the following step is required:
12       # keep single quotes:
13       db.connect driver=dbf database=’$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/’
14       db.connect -p
15       The  dbf/  subdirectory  in the mapset must exist or must be created by
16       the user.
17

Creating a DBF table

19       DBF tables are created by GRASS  when  generating  a  vector  map  with
20       attributes and having defined the DBF as attribute driver.
21
22       If  a DBF table has to be created manually, db.execute can be used or a
23       spreadsheet application. Also db.copy is sometimes useful  as  well  as
24       db.in.ogr to import external tables.
25

Supported SQL commands by DBF driver

27         ALTER TABLE table ADD [COLUMN] columndef
28         ALTER TABLE table DROP COLUMN colname
29         CREATE TABLE table ( columndefs )
30         DROP TABLE table
31         SELECT columns FROM table
32         SELECT columns FROM table WHERE condition
33         SELECT columns FROM table ORDER BY column
34         DELETE FROM table
35         DELETE FROM table WHERE condition
36         INSERT INTO table VALUES (value1[,value2,...])
37         INSERT INTO table ( column1[,column2,...] ) VALUES (value1[,value2,...])
38         UPDATE table SET assignment1[,assignment2,...]
39         UPDATE table SET assignment1[,assignment2,...] WHERE condition
40

Operators available in conditions

42         "="  : equal
43         "<"  : smaller than
44         "<=" : smaller/equal than
45         ">"  : larger than
46         ">=" : larger/equal than
47         "<>" : not equal
48         "~"  : Substring matching  (non-standard SQL)
49         "%"  : Substring matching  (limited functionality)
50
51       Arithmetic  expressions using constants and field values are allowed in
52       condition clauses and in the RHS of assignments.
53       Usual precedence rules and bracketing (using  ’(’  and  ’)’)  are  sup‐
54       ported.
55       Type conversion is performed if necessary (experimental).
56
57       Conditions  allow  boolean expressions using the AND, OR and NOT opera‐
58       tors, with the usual precedence rules.
59
60       NULLs can be tested by ’colname IS NULL’ in conditions. The negation is
61       ’colname NOT NULL’.
62
63       Sorting: Empty fields in a character column are sorted to the end.
64

LIMITATIONS OF THE DBF DRIVER

66       The  DBF driver supports only a few SQL statements since the DBF tables
67       are intended for simple table storage. DBF column names are limited  to
68       10 characters (as defined in the DBF specifications). For example,
69
70           ·   aggregate  functions  (sum,  count,  min, max,...) are not sup‐
71               ported in SELECT clauses;
72
73           ·   mathematic functions (sin, cos, exp, log,...) are not supported
74               in expressions;
75
76           ·   SQL query with IN are not supported.
77

ERROR MESSAGES

79       An error message such as:
80       DBMI-DBF driver error:
81       SQL parser error: syntax error, unexpected NAME processing ’IN’..
82       indicates  that an unsupported SQL statement (here, ’IN’) was used. The
83       only solution is to switch the  DBMI  backend  to  a  real  SQL  engine
84       (SQLite, PostgreSQL, MySQL etc.). See SQL support in GRASS GIS.
85
86       An error message such as:
87       DBMI-DBF driver error:
88       SQL parser error: syntax error, unexpected DESC, expecting NAME processing ’DESC’
89       indicates  that a column name corresponds to a reserved SQL word (here:
90       ’DESC’).  A different column name should be used. If this happens  dur‐
91       ing  import  with  v.in.ogr, the cnames parameter can be used to assign
92       different column names on the fly.
93

SEE ALSO

95        db.connect, SQL support in GRASS GIS
96       DBF Specifications (Shapelib)
97
98       Main index | Topics index | Keywords index |  Graphical  index  |  Full
99       index
100
101       © 2003-2020 GRASS Development Team, GRASS GIS 7.8.5 Reference Manual
102
103
104
105GRASS 7.8.5                                                       grass-dbf(1)
Impressum