Skip to content
Commits on Source (18)
The GRASS Development Team, the addon authors, further contributors and the user community have invested enormous efforts in making GRASS GIS available to you. Please give credit where credit is due and cite GRASS GIS and its addons when you use them for data analysis.
The GRASS Development Team, the addon authors, further contributors and
the user community have invested enormous efforts in making GRASS GIS
available to you. Please give credit where credit is due and cite GRASS
GIS and its addons when you use them for data analysis.
For citation choices see below; for citing a particular GRASS GIS module, you may cite the main author(s) along with the GRASS Development Team.
For citation choices see below; for citing a particular GRASS GIS
module, you may cite the main author(s) along with the GRASS
Development Team.
Choices for citing the main GRASS GIS software (update YEAR and version
number X.Y accordingly):
Choices for citing the main GRASS GIS software (update YEAR and version number accordingly):
* GRASS Development Team, YEAR. Geographic Resources Analysis Support System (GRASS) Software, Version 7.2. Open Source Geospatial Foundation. http://grass.osgeo.org
* GRASS Development Team, YEAR. Geographic Resources Analysis Support System (GRASS) Programmer's Manual. Open Source Geospatial Foundation. Electronic document: http://grass.osgeo.org/programming7
* GRASS Development Team, YEAR. Geographic Resources Analysis Support
System (GRASS) Software, Version X.Y. Open Source Geospatial
Foundation. http://grass.osgeo.org
* GRASS Development Team, YEAR. Geographic Resources Analysis Support
System (GRASS) Programmer's Manual. Open Source Geospatial Foundation.
Electronic document: http://grass.osgeo.org/programming7
Citing a GRASS GIS Addon (update AUTHOR(S), YEAR, Addon-NAME, and
version number X.Y accordingly):
Citing a GRASS GIS Addon (update AUTHOR(S), YEAR, Addon-NAME, and version number accordingly):
* AUTHOR(S), and GRASS Development Team, YEAR Addon-NAME. Geographic Resources Analysis Support System (GRASS) Software, Version 7.2. Open Source Geospatial Foundation. https://grass.osgeo.org/grass7/manuals/addons/Addon-NAME.html
* AUTHOR(S), and GRASS Development Team, YEAR Addon-NAME. Geographic
Resources Analysis Support System (GRASS) Software, Version X.Y.
Open Source Geospatial Foundation.
https://grass.osgeo.org/grass7/manuals/addons/Addon-NAME.html
For other (scientific) references, see
* https://grasswiki.osgeo.org/wiki/GRASS_Citation_Repository
* https://grasswiki.osgeo.org/wiki/GRASS_Citation_Repository
A BibTeX entry for LaTeX users is:
@Manual{GRASS_GIS_software,
title = {Geographic Resources Analysis Support System (GRASS) Software, Version 7.2},
title = {Geographic Resources Analysis Support System (GRASS) Software, Version X.Y},
author = {{GRASS Development Team}},
organization = {Open Source Geospatial Foundation},
address = {USA},
......
......@@ -30,6 +30,8 @@ RUN apt-get update \
libnetcdf-dev \
libopenjp2-7 \
libopenjp2-7-dev \
libpdal-dev pdal \
libpdal-plugin-python \
libpng-dev \
libpq-dev \
libproj-dev \
......@@ -37,6 +39,7 @@ RUN apt-get update \
libsqlite3-dev \
libtiff-dev \
libxmu-dev \
libzstd-dev \
bison \
flex \
g++ \
......@@ -74,7 +77,7 @@ COPY . /code/grass
WORKDIR /code/grass
# Set gcc/g++ environmental variables for GRASS GIS compilation, without debug symbols
ENV MYCFLAGS "-O2 -march=native -std=gnu99 -m64"
ENV MYCFLAGS "-O2 -std=gnu99 -m64"
ENV MYLDFLAGS "-s"
# CXX stuff:
ENV LD_LIBRARY_PATH "/usr/local/lib"
......@@ -91,11 +94,13 @@ RUN ./configure \
--with-readline \
--with-sqlite \
--with-bzlib \
--with-zstd \
--with-cairo --with-cairo-ldflags=-lfontconfig \
--with-freetype --with-freetype-includes="/usr/include/freetype2/" \
--with-fftw \
--with-netcdf \
--with-liblas --with-liblas-config=/usr/bin/liblas-config \
--with-pdal \
--with-proj --with-proj-share=/usr/share/proj \
--with-geos=/usr/bin/geos-config \
--with-postgres --with-postgres-includes="/usr/include/postgresql" \
......
......@@ -54,7 +54,7 @@ GRASS source code is currently distributed in 2 forms:
(*.tar.gz package) of that SVN repository. The SVN snapshot name
contains the date when the snapshot was created (checked out from
the SVN repository), e.g. grass-7.2.svn_src_snapshot_2016_06_11.tar.gz
from https://grass.osgeo.org/grass74/source/snapshot/
from https://grass.osgeo.org/grass76/source/snapshot/
Further instructions at https://trac.osgeo.org/grass/wiki/DownloadSource
......@@ -151,16 +151,16 @@ See also CODE OPTIMIZATION below.
After compilation, the resulting code is stored in the directory
./dist.$ARCH
and the scripts (grass74, ...) in
and the scripts (grass76, ...) in
./bin.$ARCH
To run GRASS, simply start
./bin.$ARCH/grass74
./bin.$ARCH/grass76
or run
make install
grass74
grass76
(E) INSTALLATION ON MACOSX
......@@ -316,4 +316,4 @@ https://grass.osgeo.org/documentation/first-time-users/
------------------
(C) 1999-2018 by The GRASS Development Team
Last changed: $Date: 2018-01-01 23:36:04 +0100 (Mon, 01 Jan 2018) $
Last changed: $Date: 2018-08-31 17:01:15 +0200 (Fri, 31 Aug 2018) $
......@@ -48,33 +48,33 @@ To generate the documents in PDF format, run
make pdfdocs
An online version is available at:
http://grass.osgeo.org/programming7/
https://grass.osgeo.org/programming7/
## Docker
Build using the downloaded source code (in the directory with the
source code):
docker build -t grassgis74 .
docker build -t grassgis76 .
A test run (assuming you have existing GRASS GIS location; it can be downloaded from
https://grass.osgeo.org/sampledata/north_carolina/nc_basic_spm_grass7.zip)
# case 1: launching in the grassdata directory in which the location is stored:
docker run -it --rm --user=$(id -u):$(id -g) --volume $(pwd):/data --env HOME=/data/ grassgis74 \
grass --text nc_basic_spm/PERMANENT --exec g.region -p
docker run -it --rm --user=$(id -u):$(id -g) --volume $(pwd):/data --env HOME=/data/ grassgis76 \
grass --text nc_spm_08_grass7/user1 --exec g.region -p
# case 2: launching anywhere
docker run -it --rm --user=$(id -u):$(id -g) --volume /your/test/grassdata/:/data --env HOME=/data/ grassgis74 \
docker run -it --rm --user=$(id -u):$(id -g) --volume /your/test/grassdata/:/data --env HOME=/data/ grassgis76 \
grass /data/nc_basic_spm/PERMANENT --exec g.region -p
Note that the first `grassgis74` is the name of the image while the second
Note that the first `grassgis76` is the name of the image while the second
`grass` is the name of the executable.
To run the tests (again assuming local location):
docker run -it --rm --user=$(id -u):$(id -g) --volume /your/test/grassdata/:/data --env HOME=/data/ -w /code/grass \
grassgis74 grass /data/nc_basic_spm/PERMANENT --exec \
grassgis76 grass /data/nc_basic_spm/PERMANENT --exec \
python -m grass.gunittest.main \
--location nc_basic_spm --location-type nc
......
......@@ -217,6 +217,6 @@ MacOSX users may go here to download precompiled libraries etc.:
<br><a href="https://grass.osgeo.org/development/bug-tracking/">https://grass.osgeo.org/development/bug-tracking/</a>
<p>
<i>Last changed: $Date: 2018-03-25 16:51:11 +0200 (Sun, 25 Mar 2018) $</i>
<i>Last changed: $Date: 2018-03-25 15:24:28 +0200 (Sun, 25 Mar 2018) $</i>
</body>
</html>
......@@ -13,10 +13,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
vm_ram = ENV['VAGRANT_VM_RAM'] || 1024
vm_cpu = ENV['VAGRANT_VM_CPU'] || 1
config.vm.box = "xenial64"
config.vm.box = "bionic64"
config.vm.hostname = "grass-gis-vagrant"
config.vm.box_url = "https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-vagrant.box"
config.vm.box_url = "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64-vagrant.box"
config.vm.define "grass-gis-vagrant" do |host|
config.vm.network :forwarded_port, guest: 80, host: 8080
......
......@@ -2,7 +2,7 @@
# Attempt to guess a canonical system name.
# Copyright 1992-2018 Free Software Foundation, Inc.
timestamp='2018-08-29'
timestamp='2018-12-07'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
......@@ -96,8 +96,7 @@ fi
tmp=
# shellcheck disable=SC2172
trap 'test -z "$tmp" || rm -fr "$tmp"' 1 2 13 15
trap 'exitcode=$?; test -z "$tmp" || rm -fr "$tmp"; exit $exitcode' 0
trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
set_cc_for_build() {
: "${TMPDIR=/tmp}"
......@@ -392,15 +391,20 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
echo i386-pc-auroraux"$UNAME_RELEASE"
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
UNAME_REL="`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
case `isainfo -b` in
32)
echo i386-pc-solaris2"$UNAME_REL"
;;
64)
echo x86_64-pc-solaris2"$UNAME_REL"
;;
esac
set_cc_for_build
SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH=x86_64
fi
fi
echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
......@@ -1424,6 +1428,9 @@ EOF
amd64:Isilon\ OneFS:*:*)
echo x86_64-unknown-onefs
exit ;;
*:Unleashed:*:*)
echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
exit ;;
esac
echo "$0: unable to guess system type" >&2
......
......@@ -2,7 +2,7 @@
# Configuration validation subroutine script.
# Copyright 1992-2018 Free Software Foundation, Inc.
timestamp='2018-08-29'
timestamp='2018-12-16'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
......@@ -111,7 +111,7 @@ case $# in
esac
# Split fields of configuration type
IFS="-" read -r field1 field2 field3 field4 <<EOF
IFS="-" read field1 field2 field3 field4 <<EOF
$1
EOF
......@@ -918,7 +918,7 @@ case $basic_machine in
;;
*-*)
IFS="-" read -r cpu vendor <<EOF
IFS="-" read cpu vendor <<EOF
$basic_machine
EOF
;;
......@@ -1361,7 +1361,7 @@ case $os in
| powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
| skyos* | haiku* | rdos* | toppers* | drops* | es* \
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa*)
| midnightbsd* | amdhsa* | unleashed*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
qnx*)
......
This diff is collapsed.
......@@ -268,6 +268,7 @@ LOC_ARG_WITH(pthread, POSIX threads, no)
LOC_ARG_WITH(openmp, OpenMP, no)
LOC_ARG_WITH(opencl, OpenCL, no)
LOC_ARG_WITH(bzlib, BZIP2, no)
LOC_ARG_WITH(zstd, Zstandard, no)
AC_ARG_WITH(gdal,
[ --with-gdal[=path/gdal-config]
......@@ -318,6 +319,9 @@ LOC_ARG_WITH_LIB(zlib, zlib)
LOC_ARG_WITH_INC(bzlib, BZIP2)
LOC_ARG_WITH_LIB(bzlib, BZIP2)
LOC_ARG_WITH_INC(zstd, ZSTD)
LOC_ARG_WITH_LIB(zstd, ZSTD)
LOC_ARG_WITH_INC(readline, Readline)
LOC_ARG_WITH_LIB(readline, Readline)
......@@ -485,6 +489,14 @@ AC_DEFINE(HAVE_LONG_LONG_INT)
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(for int64_t)
AC_TRY_COMPILE([#include <sys/types.h>],[int64_t x;],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_INT64_T)
],[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(for W11)
case "$enable_w11" in
yes|no) AC_MSG_RESULT("$enable_w11") ;;
......@@ -600,56 +612,113 @@ AC_SUBST(ZLIB)
# bzip2 support
BZIP2LIBPATH=
BZIP2INCPATH=
BZIP2LIB=
LOC_CHECK_USE(bzlib,bzlib,USE_BZIP2)
if test -n "$USE_BZIP2"; then
BZLIBLIBPATH=
BZLIBINCPATH=
BZLIB=
# With bzip2 includes directory
LOC_CHECK_INC_PATH(bzlib,bzlib,BZLIBINCPATH)
LOC_CHECK_INC_PATH(bzlib,bzlib,BZIP2INCPATH)
LOC_CHECK_INCLUDES(bzlib.h,bzlib,$BZLIBINCPATH)
LOC_CHECK_INCLUDES(bzlib.h,bzlib,$BZIP2INCPATH)
# With bzip2 library directory
LOC_CHECK_LIB_PATH(bzlib,bzlib,BZLIBLIBPATH)
LOC_CHECK_LIB_PATH(bzlib,bzlib,BZIP2LIBPATH)
LOC_CHECK_LIBS(bz2,BZ2_bzBuffToBuffCompress,bzlib,$BZLIBLIBPATH,BZLIB,,,)
LOC_CHECK_LIBS(bz2,BZ2_bzBuffToBuffCompress,bzlib,$BZIP2LIBPATH,BZIP2LIB,,,)
#
fi # $USE_BZIP2
AC_SUBST(BZLIBINCPATH)
AC_SUBST(BZLIBLIBPATH)
AC_SUBST(BZLIB)
AC_SUBST(BZIP2INCPATH)
AC_SUBST(BZIP2LIBPATH)
AC_SUBST(BZIP2LIB)
# Done checking bzip2
# zstd support
ZSTDLIBPATH=
ZSTDINCPATH=
ZSTDLIB=
LOC_CHECK_USE(zstd,zstd,USE_ZSTD)
if test -n "$USE_ZSTD"; then
# With zstd includes directory
LOC_CHECK_INC_PATH(zstd,zstd,ZSTDINCPATH)
LOC_CHECK_INCLUDES(zstd.h,zstd,$ZSTDINCPATH)
# With zstd library directory
LOC_CHECK_LIB_PATH(zstd,zstd,ZSTDLIBPATH)
LOC_CHECK_LIBS(zstd,ZSTD_compress,zstd,$ZSTDLIBPATH,ZSTDLIB,,,)
#
fi # $USE_ZSTD
AC_SUBST(ZSTDINCPATH)
AC_SUBST(ZSTDLIBPATH)
AC_SUBST(ZSTDLIB)
# Done checking zstd
# Mandatory PROJ dependency
PROJINC=
PROJLIB=
PROJSHARE=
PROJ4API=0
# With PROJ includes directory
LOC_CHECK_INC_PATH(proj,External PROJ.4,PROJINC)
LOC_CHECK_INC_PATH(proj,External PROJ,PROJINC)
LOC_CHECK_INCLUDES(proj_api.h,External PROJ.4,$PROJINC)
# PROJ version check: if proj.h exists, it must be proj 5+
LOC_CHECK_INCLUDES(proj.h,External PROJ,$PROJINC,PROJ4API=1)
# PROJ version check
if test $PROJ4API = 0 ; then
LOC_CHECK_VERSION_INT(proj.h,PROJ_VERSION_MAJOR,External PROJ major,proj_ver_major,$PROJINC,0)
LOC_CHECK_VERSION_INT(proj.h,PROJ_VERSION_MINOR,External PROJ minor,proj_ver_minor,$PROJINC,0)
LOC_CHECK_VERSION_INT(proj.h,PROJ_VERSION_PATCH,External PROJ patch,proj_ver_patch,$PROJINC,0)
AC_MSG_RESULT([found PROJ version "${proj_ver_major}.${proj_ver_minor}.${proj_ver_patch}"])
# minimum required PROJ 5+ version to use the new PROJ API: 5.1.0
if test ${proj_ver_major} = 5 && test `expr ${proj_ver_minor} \< 1` = 1 ; then
AC_MSG_WARN([At least PROJ version "5.1.0" is required for the new API ])
PROJ4API=1
fi
fi
if test $PROJ4API = 0 ; then
AC_MSG_RESULT([using new PROJ version 5+ API])
# With PROJ library directory
LOC_CHECK_LIB_PATH(proj,External PROJ,PROJLIB)
LOC_CHECK_LIBS(proj,proj_pj_info,External PROJ,$PROJLIB,PROJLIB,,,)
else
AC_MSG_RESULT([using old PROJ version 4 API])
AC_DEFINE(USE_PROJ4API)
LOC_CHECK_INCLUDES(proj_api.h,External PROJ,$PROJINC)
# PROJ version check for v4.x
if test "$cross_compiling" = yes; then
AC_MSG_WARN([*** Cannot check PROJ.4 version (cross-compiling).])
else
LOC_CHECK_VERSION_INT(proj_api.h,PJ_VERSION,External PROJ.4,proj_ver,$PROJINC,0)
if test `expr "$proj_ver" \< 446` = 1 ; then
if test `expr ${proj_ver} \< 446` = 1 ; then
AC_MSG_ERROR([*** PROJ.4.4.6 or later is required.])
fi
fi
......@@ -657,14 +726,14 @@ fi
# With PROJ library directory
LOC_CHECK_LIB_PATH(proj,External PROJ.4,PROJLIB)
LOC_CHECK_LIBS(proj,pj_get_def,External PROJ.4,$PROJLIB,PROJLIB,,,)
fi
# With PROJ share directory
LOC_CHECK_SHARE_PATH(proj,External PROJ.4,PROJSHARE)
LOC_CHECK_SHARE_PATH(proj,External PROJ,PROJSHARE)
if test -z "$PROJSHARE" ; then
AC_MSG_WARN([*** External PROJ.4 directory not specified; default will be used])
AC_MSG_WARN([*** External PROJ directory not specified; default will be used])
PROJSHARE=/usr/share/proj
fi
......@@ -673,7 +742,7 @@ if test "$cross_compiling" = "yes" ; then
AC_MSG_CHECKING([for epsg])
AC_MSG_RESULT([unknown (cross-compiling)])
else
LOC_CHECK_SHARE(epsg,External PROJ.4,$PROJSHARE,[
LOC_CHECK_SHARE(epsg,External PROJ,$PROJSHARE,[
AC_MSG_WARN([*** Unable to locate PROJ data files.])
])
fi
......@@ -1937,4 +2006,12 @@ LOC_MSG_USE(Regex support,USE_REGEX)
LOC_MSG_USE(SQLite support,USE_SQLITE)
LOC_MSG_USE(TIFF support,USE_TIFF)
LOC_MSG_USE(X11 support,USE_X11)
LOC_MSG_USE(Zstandard support,USE_ZSTD)
LOC_MSG()
# remove when the new PROJ API is stable
if test $PROJ4API = 0 ; then
AC_MSG_RESULT([ using new PROJ 5+ API])
else
AC_MSG_RESULT([ using old PROJ 4 API])
fi
LOC_MSG()
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
from grass.script.core import read_command
output = """cat
OBJECTID
WAKE_ZIPCO
PERIMETER
ZIPCODE_
ZIPCODE_ID
ZIPNAME
ZIPNUM
ZIPCODE
NAME
SHAPE_Leng
SHAPE_Area
"""
class TestDbColumns(TestCase):
invect = 'zipcodes'
mapset = '$GISDBASE/$LOCATION_NAME/PERMANENT/sqlite/sqlite.db'
@classmethod
def setUpClass(cls):
cls.runModule('db.connect', flags='c')
def test_dbcols(self):
cols = read_command('db.columns', table=self.invect,
database=self.mapset)
self.assertEqual(first=cols, second=output)
if __name__ == '__main__':
test()
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
from grass.script.core import read_command
class TestDbCopy(TestCase):
invect = 'zipcodes'
orig_mapset = '$GISDBASE/$LOCATION_NAME/PERMANENT/sqlite/sqlite.db'
outable = 'my_' + invect
@classmethod
def setUpClass(cls):
cls.runModule('db.connect', flags='c')
@classmethod
def tearDownClass(cls):
cls.runModule('db.droptable', table=cls.outable, flags='f',
database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db')
def test_fromtable(self):
self.runModule('db.copy', from_database=self.orig_mapset,
from_table=self.invect, to_table=self.outable,
overwrite=True)
orig = read_command('db.select', table=self.invect,
database=self.orig_mapset)
new = read_command('db.select', table=self.outable)
self.assertEqual(first=orig, second=new)
def test_select(self):
self.runModule('db.copy', from_database=self.orig_mapset,
to_table=self.outable, overwrite=True,
select="SELECT * from {inp} WHERE NAME='RALEIGH'".format(inp=self.invect))
orig = read_command('db.select', database=self.orig_mapset,
sql="SELECT * from {inp} WHERE NAME='RALEIGH'".format(inp=self.invect))
new = read_command('db.select', table=self.outable)
self.assertEqual(first=orig, second=new)
def test_where(self):
self.runModule('db.copy', from_database=self.orig_mapset,
to_table=self.outable, overwrite=True,
from_table=self.invect, where="NAME='RALEIGH'")
orig = read_command('db.select', database=self.orig_mapset,
sql="SELECT * from {inp} WHERE NAME='RALEIGH'".format(inp=self.invect))
new = read_command('db.select', table=self.outable)
self.assertEqual(first=orig, second=new)
if __name__ == '__main__':
test()
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 14 09:43:55 2017
@author: lucadelu
"""
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
from grass.script.core import read_command
output="""table:zipcodes
description:
insert:?
delete:?
ncols:12
nrows:44
column:cat
description:
type:INTEGER
len:20
scale:0
precision:0
default:
nullok:yes
select:?
update:?
column:OBJECTID
description:
type:INTEGER
len:20
scale:0
precision:0
default:
nullok:yes
select:?
update:?
column:WAKE_ZIPCO
description:
type:DOUBLE PRECISION
len:20
scale:0
precision:0
default:
nullok:yes
select:?
update:?
column:PERIMETER
description:
type:DOUBLE PRECISION
len:20
scale:0
precision:0
default:
nullok:yes
select:?
update:?
column:ZIPCODE_
description:
type:DOUBLE PRECISION
len:20
scale:0
precision:0
default:
nullok:yes
select:?
update:?
column:ZIPCODE_ID
description:
type:DOUBLE PRECISION
len:20
scale:0
precision:0
default:
nullok:yes
select:?
update:?
column:ZIPNAME
description:
type:CHARACTER
len:15
scale:0
precision:0
default:
nullok:yes
select:?
update:?
column:ZIPNUM
description:
type:DOUBLE PRECISION
len:20
scale:0
precision:0
default:
nullok:yes
select:?
update:?
column:ZIPCODE
description:
type:CHARACTER
len:30
scale:0
precision:0
default:
nullok:yes
select:?
update:?
column:NAME
description:
type:CHARACTER
len:30
scale:0
precision:0
default:
nullok:yes
select:?
update:?
column:SHAPE_Leng
description:
type:DOUBLE PRECISION
len:20
scale:0
precision:0
default:
nullok:yes
select:?
update:?
column:SHAPE_Area
description:
type:DOUBLE PRECISION
len:20
scale:0
precision:0
default:
nullok:yes
select:?
update:?
"""
outcol="""ncols: 12
nrows: 44
Column 1: cat:INTEGER:20
Column 2: OBJECTID:INTEGER:20
Column 3: WAKE_ZIPCO:DOUBLE PRECISION:20
Column 4: PERIMETER:DOUBLE PRECISION:20
Column 5: ZIPCODE_:DOUBLE PRECISION:20
Column 6: ZIPCODE_ID:DOUBLE PRECISION:20
Column 7: ZIPNAME:CHARACTER:15
Column 8: ZIPNUM:DOUBLE PRECISION:20
Column 9: ZIPCODE:CHARACTER:30
Column 10: NAME:CHARACTER:30
Column 11: SHAPE_Leng:DOUBLE PRECISION:20
Column 12: SHAPE_Area:DOUBLE PRECISION:20
"""
class TestDbCopy(TestCase):
invect = 'zipcodes'
mapset = '$GISDBASE/$LOCATION_NAME/PERMANENT/sqlite/sqlite.db'
@classmethod
def setUpClass(cls):
cls.runModule('db.connect', flags='c')
def test_describe(self):
cols = read_command('db.describe', table=self.invect,
database=self.mapset)
self.assertEqual(first=cols, second=output)
def test_columns(self):
cols = read_command('db.describe', table=self.invect, flags='c',
database=self.mapset)
self.assertEqual(first=cols, second=outcol)
if __name__ == '__main__':
test()
......@@ -91,7 +91,7 @@ int db__driver_open_database(dbHandle * handle)
status = G_mkdir(db.name);
if (status != 0) { /* mkdir failed */
db_d_append_error(_("Unable create DBF database: %s"), name);
db_d_append_error(_("Unable to create DBF database: %s"), name);
db_d_report_error();
return DB_FAILED;
}
......
......@@ -198,12 +198,12 @@ int describe_table(OGRLayerH hLayer, dbTable **table, cursor *c)
case OFTDate:
case OFTTime:
case OFTDateTime:
sqlType = DB_SQL_TYPE_CHARACTER;
size = OGR_Fld_GetWidth(hFieldDefn);
if (size == 0) {
G_warning(_("column '%s', type 'string': unknown width -> stored as varchar(250) "
"some data may be lost"), fieldName);
size = 250;
if (size > 0) {
sqlType = DB_SQL_TYPE_CHARACTER;
}
else {
sqlType = DB_SQL_TYPE_TEXT;
}
precision = 0;
break;
......
......@@ -96,6 +96,9 @@ int db__driver_execute_immediate(dbString * sql)
}
else {
if ((cols[i].type != OFTInteger ||
#if GDAL_VERSION_NUM >= 2000000
cols[i].type != OFTInteger64 ||
#endif
cols[i].type != OFTReal) && *(cols[i].value) == '\'') {
value = G_strchg(cols[i].value, '\'', ' ');
G_strip(value);
......
......@@ -144,6 +144,13 @@ int db__driver_fetch(dbCursor * cn, int position, int *more)
value->i = OGR_F_GetFieldAsInteger(c->hFeature, i);
break;
#if GDAL_VERSION_NUM >= 2000000
case OFTInteger64:
/* test for integer overflow ? */
value->i = OGR_F_GetFieldAsInteger64(c->hFeature, i);
break;
#endif
case OFTReal:
value->d = OGR_F_GetFieldAsDouble(c->hFeature, i);
break;
......
......@@ -149,4 +149,4 @@ driver documentation</a></li>
</ul>
<p>
<i>Last changed: $Date: 2018-07-15 20:38:37 +0200 (Sun, 15 Jul 2018) $</i>
<i>Last changed: $Date: 2018-07-13 11:36:07 +0200 (Fri, 13 Jul 2018) $</i>