EnglishFrenchSpanish

Ad


OnWorks favicon

db.executegrass - Online in the Cloud

Run db.executegrass in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command db.executegrass that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


db.execute - Executes any SQL statement.
For SELECT statements use ’db.select’.

KEYWORDS


database, attribute table, SQL

SYNOPSIS


db.execute
db.execute --help
db.execute [-i] [sql=sql_query] [input=name] [driver=name] [database=name]
[schema=name] [--help] [--verbose] [--quiet] [--ui]

Flags:
-i
Ignore SQL errors and continue

--help
Print usage summary

--verbose
Verbose module output

--quiet
Quiet module output

--ui
Force launching GUI dialog

Parameters:
sql=sql_query
SQL statement
Example: update rybniky set kapri = ’hodne’ where kapri = ’malo’

input=name
Name of file containing SQL statement(s)
’-’ for standard input

driver=name
Name of database driver
Options: mysql, odbc, sqlite, pg, ogr, dbf
Default: sqlite

database=name
Name of database
Default: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db

schema=name
Database schema
Do not use this option if schemas are not supported by driver/database server

DESCRIPTION


db.execute allows the user to execute SQL statements.

NOTES


db.execute only executes SQL statements and does not return any data. If you need data
returned from the database, use db.select.

If parameters for database connection are already set with db.connect, they are taken as
default values and do not need to be specified each time.

If you have a large number of SQL commands to process, it is much much faster to place all
the SQL statements into a text file and use input file parameter than it is to process
each statement individually in a loop. If multiple instruction lines are given, each SQL
line must end with a semicolon.

Please see the individual GRASS SQL interface for how to create a new database.

EXAMPLES


Create a new table with columns ’cat’ and ’soiltype’:
db.execute sql="CREATE TABLE soils (cat integer, soiltype varchar(10))"
Create a new table using a file with SQL statements
db.execute driver=odbc database=grassdb input=file.sql
Insert new row into attribute table:
db.execute sql="INSERT INTO mysites (id,name,east,north) values (30,’Ala’,1657340,5072301)"
Update attribute entries to new value based on SQL rule:
db.execute sql="UPDATE roads SET travelcost=5 WHERE cat=1"
Update attribute entries to new value based on SQL rule:
db.execute sql="UPDATE dourokukan SET testc=50 WHERE testc is NULL"
Delete selected rows from attribute table:
db.execute sql="DELETE FROM gsod_stationlist WHERE latitude < -91"
Add new column to attribute table:
db.execute sql="ALTER TABLE roads ADD COLUMN length double"
Column type conversion - update new column from existing column (all drivers except for
DBF):
# ’z_value’ is varchar and ’z’ is double precision:
echo "UPDATE geodetic_pts SET z = CAST(z_value AS numeric)" | db.execute input=-
Drop column from attribute table:
db.execute sql="ALTER TABLE roads DROP COLUMN length"
Drop table (not supported by all drivers):
db.execute sql="DROP TABLE fmacopy"
Update attribute with multiple SQL instructions in file (e.g., file.sql, instruction line
must end with a semicolon):
UPDATE roads SET travelcost=5 WHERE cat=1;
UPDATE roads SET travelcost=2 WHERE cat=2;
db.execute input=file.sql
Join table ’myroads’ to table ’extratab’ based on common ’cat’ column values (not
supported by DBF driver):
db.execute sql="UPDATE extratab SET names=(SELECT label FROM myroads WHERE extratab.cat=myroads.cat)"

Use db.executegrass online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

  • 1
    VASSAL Engine
    VASSAL Engine
    VASSAL is a game engine for creating
    electronic versions of traditional board
    and card games. It provides support for
    game piece rendering and interaction,
    and...
    Download VASSAL Engine
  • 2
    OpenPDF - Fork of iText
    OpenPDF - Fork of iText
    OpenPDF is a Java library for creating
    and editing PDF files with a LGPL and
    MPL open source license. OpenPDF is the
    LGPL/MPL open source successor of iText,
    a...
    Download OpenPDF - Fork of iText
  • 3
    SAGA GIS
    SAGA GIS
    SAGA - System for Automated
    Geoscientific Analyses - is a Geographic
    Information System (GIS) software with
    immense capabilities for geodata
    processing and ana...
    Download SAGA GIS
  • 4
    Toolbox for Java/JTOpen
    Toolbox for Java/JTOpen
    The IBM Toolbox for Java / JTOpen is a
    library of Java classes supporting the
    client/server and internet programming
    models to a system running OS/400,
    i5/OS, o...
    Download Toolbox for Java/JTOpen
  • 5
    D3.js
    D3.js
    D3.js (or D3 for Data-Driven Documents)
    is a JavaScript library that allows you
    to produce dynamic, interactive data
    visualizations in web browsers. With D3
    you...
    Download D3.js
  • 6
    Shadowsocks
    Shadowsocks
    A fast tunnel proxy that helps you
    bypass firewalls This is an application
    that can also be fetched from
    https://sourceforge.net/projects/shadowsocksgui/.
    It ha...
    Download Shadowsocks
  • More »

Linux commands

Ad