瀏覽代碼

better explain what the DBF driver isn't doing; explain table migration; cosmetics

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@36729 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 16 年之前
父節點
當前提交
ff65594e77
共有 3 個文件被更改,包括 58 次插入18 次删除
  1. 8 2
      db/databaseintro.html
  2. 47 15
      db/drivers/dbf/grass-dbf.html
  3. 3 1
      db/drivers/sqlite/grass-sqlite.html

+ 8 - 2
db/databaseintro.html

@@ -88,9 +88,7 @@ list all available tables for a given database, run <a href="db.tables.html">db.
 To drop a column from a selected attribute table, use <a href="db.dropcol.html">db.dropcol</a>.
 With <a href="db.droptable.html">db.droptable</a> an attribute table can be deleted.
 
-
 <h3>Database Schema</h3>
-
 Currently schema support only works for PostgreSQL connections. Default schema
 can be set with <a href="db.connect.html">db.connect</a>. Note that the default 
 schema will be used by all db.* modules.
@@ -98,6 +96,14 @@ schema will be used by all db.* modules.
 <a href="db.tables.html">db.tables</a> returns 'schema.table' if schemas are
 available in the database.
 
+<h3>Migrating to a different database engine</h3>
+
+To migrate a GRASS database table (or a GRASS vector map) to a different DBMI engine,
+the best solution is to create a new MAPSET, define the DBMI settings accordingly
+with <a href="db.connect.html">db.connect</a> and if needed, <a href="db.login.html">db.login</a>.
+Then the table of interest can be copied over with <a href="db.copy.html">db.copy</a> from
+the original MAPSET. Likewise, a vector map including its table(s) are copied from
+the original MAPSET to the current MAPSET with <a href="g.copy.html">g.copy</a>.
 
 <h3>See also</h3>
 

+ 47 - 15
db/drivers/dbf/grass-dbf.html

@@ -12,7 +12,7 @@
 
 <h1>DBF driver in GRASS</h1>
 
-<H2>Defining the DBF driver</H2>
+<h2>Defining the DBF driver</h2>
 
 The DBF driver is the default driver, in theory no user interaction is
 required. However, if the settings should be set back from a different
@@ -26,7 +26,8 @@ db.connect -p
 
 The dbf/ subdirectory in the mapset must exist or must be created by the user.
 
-<H2>Creating a DBF table</H2>
+
+<h2>Creating a DBF table</h2>
 
 Usually DBF tables are created by GRASS when generating a vector map
 with attributes (and using DBF as default attribute driver).
@@ -36,7 +37,9 @@ can be used or a spreadsheet application. Also <a href="db.copy.html">db.copy</a
 is sometimes useful as well as <a href="db.in.ogr.html">db.in.ogr</a> to import external
 tables.
 
-<H2>Supported SQL commands by DBF driver</H2>
+
+<h2>Supported SQL commands by DBF driver</h2>
+
 <div class="code"><pre>
   ALTER TABLE table ADD [COLUMN] columndef
   ALTER TABLE table DROP COLUMN colname
@@ -53,7 +56,9 @@ tables.
   UPDATE table SET assignment1[,assignment2,...] WHERE condition
 </pre></div>
 
-<H2>Operators available in conditions</H2>
+
+<h2>Operators available in conditions</h2>
+
 <div class="code"><pre>
   "="  : equal
   "&lt;"  : smaller than
@@ -65,23 +70,39 @@ tables.
   "%"  : Substring matching  (limited functionality)
 </pre></div>
 
-<p> Arithmetic expressions using constants and field values are allowed 
-in condition clauses and in the RHS of assignments. 
+<p>
+Arithmetic expressions using constants and field values are allowed 
+in condition clauses and in the RHS of assignments.
+<br>
 Usual precedence rules and bracketing (using '(' and ')') are supported. 
-Type conversion is performed if necessary (experimental). </p>
+<br>
+Type conversion is performed if necessary (experimental). 
+
+<p>
+Conditions allow boolean expressions using the AND, OR and NOT operators, 
+with the usual precedence rules. 
+
+<p>
+NULLs can be tested by 'colname IS NULL' in conditions. The negation is
+'colname NOT NULL'.
 
-<p> Aggregate functions (sum, count, min, max,...) are NOT currently supported 
-    in SELECT clauses. </p>
+<p>
+Sorting: Empty fields in a character column are sorted to the end.
 
-<p> Mathematic functions (sin, cos, exp, log,...) are NOT currently supported 
-    in expressions. </p>
 
-<p> Conditions allow boolean expressions using the AND, OR and NOT operators, 
-    with the usual precedence rules. </p>
+<h2>LIMITATIONS OF THE DBF DRIVER</h2>
 
-<p> NULLs can be tested by 'colname IS NULL' in conditions. The negation is 'colname NOT NULL'.</p>
+The DBF driver supports only a <b>few SQL statements</b> since the DBF tables are
+intended for simple table storage. DBF column names are limited to 10 characters
+(as defined in the DBF specifications). For example,
 
-<p> Sorting: Empty fields in a character column are sorted to the end.</p>
+<ul>
+<li> aggregate functions (sum, count, min, max,...) are <b>not</b> supported 
+in SELECT clauses;</li>
+<li> mathematic functions (sin, cos, exp, log,...) are <b>not</b> supported 
+in expressions;</li>
+<li> SQL query with IN are <b>not</b> supported.</li>
+</ul>
 
 <h2>ERROR MESSAGES</h2>
 
@@ -89,6 +110,17 @@ An error message such as:
 
 <div class="code"><pre>
 DBMI-DBF driver error:
+SQL parser error: syntax error, unexpected NAME processing 'IN'..
+</pre></div>
+indicates that an unsupported SQL statement (here, 'IN') was used. The only
+solution is to switch the DBMI backend to a real SQL engine (SQLite, 
+PostgreSQL, MySQL etc.). See <a HREF="sql.html">SQL support in GRASS GIS</a>.
+
+<p>
+An error message such as:
+
+<div class="code"><pre>
+DBMI-DBF driver error:
 SQL parser error: syntax error, unexpected DESC, expecting NAME processing 'DESC'
 </pre></div>
 

+ 3 - 1
db/drivers/sqlite/grass-sqlite.html

@@ -35,7 +35,8 @@ db.connect -p
 
 All SQL commands supported by SQLite (for limitations, see
 SQLite help page:
-<a href="http://www.sqlite.org/lang_expr.html">SQL As Understood By SQLite</a>).
+<a href="http://www.sqlite.org/lang.html">SQL As Understood By SQLite</a> and
+<a href="http://www.sqlite.org/omitted.html">Unsupported SQL</a>).
 
 
 <H2>Operators available in conditions</H2>
@@ -56,6 +57,7 @@ sqlitebrowser "$GISDBASE/$LOCATION_NAME/$MAPSET"/sqlite.db
 </pre></div>
 
 <!-- doesnt work yet, why?:
+  ah, pending patch: http://www.sqlite.org/cvstrac/tktview?tn=1476
 
 <H2>Adding an unique ID column</H2>