1grass-dbf(1)                  Grass User's Manual                 grass-dbf(1)
2
3
4
5DBF driver in GRASS
6

Defining the DBF driver

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

Creating a DBF table

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

Supported SQL commands by DBF driver

26
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         DELETE FROM table
34         DELETE FROM table WHERE condition
35         INSERT INTO table VALUES (value1[,value2,...])
36         INSERT     INTO    table    (    column1[,column2,...]    )    VALUES
37       (value1[,value2,...])
38         UPDATE table SET assignment1[,assignment2,...]
39         UPDATE table SET assignment1[,assignment2,...] WHERE condition
40
41

Operators available in conditions

43
44         "="  : equal
45         "<"  : smaller than
46         "<=" : smaller/equal than
47         ">"  : larger than
48         ">=" : larger/equal than
49         "<>" : not equal
50         "~"  : Substring matching  (non-standard SQL)
51         "%"  : Substring matching  (limited functionality)
52
53
54        Arithmetic expressions using constants and field values are allowed in
55       condition  clauses  and  in  the  RHS of assignments.  Usual precedence
56       rules and bracketing (using '(' and ')') are supported.   Type  conver‐
57       sion is performed if necessary (experimental).
58
59        Aggregate  functions (sum, count, min, max,...) are NOT currently sup‐
60       ported in SELECT clauses.
61
62        Mathematic functions (sin, cos, exp, log,...) are NOT  currently  sup‐
63       ported in expressions.
64
65        Conditions  allow boolean expressions using the AND, OR and NOT opera‐
66       tors, with the usual precedence rules.
67
68        NULLs can be tested by 'colname IS NULL' in conditions.  The  negation
69       is 'colname NOT NULL'.
70

ERROR MESSAGES

72       An error message such as:
73       DBMI-DBF driver error:
74       SQL  parser  error:  syntax error, unexpected DESC, expecting NAME pro‐
75       cessing 'DESC'
76        indicates that a column name corresponds to a reserved SQL word (here:
77       'DESC').   A different column name should be used. If this happens dur‐
78       ing import with v.in.ogr, the cnames parameter can be  used  to  assign
79       different column names on the fly.
80

SEE ALSO

82        db.connect, SQL support in GRASS GIS
83       DBF Specifications (Shapelib)
84
85       Last changed: $Date: 2007-07-18 16:10:27 +0200 (Wed, 18 Jul 2007) $
86       Help Index
87
88
89
90GRASS 6.3.0                                                       grass-dbf(1)
Impressum