[GRASS-dev] Unexpected "v.db.select separator=newline" output

Hi,

using

  GRASS 7.0.svn (2013)
  libgis Revision: 56211
  libgis Date: 2013-05-12 14:07:51 +0300 (Sun, 12 May 2013)

the following isn't really expected, right?

  v.db.select mangrove_sites_coordinates_latest col=cat,wrspr
separator=newline | head

catnewlinewrspr
1newline161043
2newline161043
3newline161043
4newline161043
5newline161043
6newline161043
7newline161043
8newline161043
9newline160043

As well as when using the "-v" flag

  v.db.select -v mangrove_sites_coordinates_latest col=cat,wrspr vs=tab
separator=tab | head

cat 1
wrspr 161043
tab
cat 2
wrspr 161043
tab
cat 3
wrspr 161043
tab
cat 4

Cheers, Nikos

Hi,

2013/6/4 Nikos Alexandris <nik@nikosalexandris.net>:

        v.db.select mangrove_sites_coordinates_latest col=cat,wrspr
separator=newline | head

catnewlinewrspr
1newline161043
2newline161043

should be fixed in r56593. Martin

Martin Landa wrote:

Hi,

2013/6/4 Nikos Alexandris <nik@nikosalexandris.net>:
> v.db.select mangrove_sites_coordinates_latest

col=cat,wrspr

>
> separator=newline | head
>
> catnewlinewrspr
> 1newline161043
> 2newline161043

should be fixed in r56593. Martin

Thank you for your time Martin,

it works with

g.version -r
GRASS 7.0.svn (2013)
libgis Revision: 56211
libgis Date: 2013-05-12 14:07:51 +0300 (Sun, 12 May 2013)

:slight_smile:

However, the "-v" flag is still broken, e.g.:

v.db.select -cv mangrove_sites_coordinates_latest col=cat,wrspr
separator=space vs=comma | head

1
161043
comma
2
161043
comma
3
161043
comma
4

Cheers, N

Martin Landa wrote:

> Hi,

Nikos Alexandris:

> > v.db.select mangrove_sites_coordinates_latest col=cat,wrspr
> > separator=newline | head

> > catnewlinewrspr
> > 1newline161043
> > 2newline161043

> should be fixed in r56593. Martin

Thank you for your time Martin,
it works with

g.version -r
GRASS 7.0.svn (2013)
libgis Revision: 56211
libgis Date: 2013-05-12 14:07:51 +0300 (Sun, 12 May 2013)

Sorry, that should be

g.version -g | grep rev
revision=56593M

Nikos

Hi,

2013/6/4 Nikos Alexandris <nik@nikosalexandris.net>:

However, the "-v" flag is still broken, e.g.:

v.db.select -cv mangrove_sites_coordinates_latest col=cat,wrspr
separator=space vs=comma | head

1
161043
comma

ops, I overlooked this issue, should be fixed in r56597. Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

On Wednesday 05 of June 2013 11:14:05 Martin Landa wrote:

Hi,

2013/6/4 Nikos Alexandris <nik@nikosalexandris.net>:
> However, the "-v" flag is still broken, e.g.:
>
> v.db.select -cv mangrove_sites_coordinates_latest col=cat,wrspr
> separator=space vs=comma | head
>
> 1
> 161043
> comma

ops, I overlooked this issue, should be fixed in r56597. Martin

Do I really need to recompile the complete stuff? Yesterday it didn't work
with a single "make" inside the "v.db.select" nor inside the complete "vector"
category?

Will do tonight I guess.

Thanks, Nikos

On Wednesday 05 of June 2013 12:16:30 Nikos Alexandris wrote:

Do I really need to recompile the complete stuff? Yesterday it didn't work
with a single "make" inside the "v.db.select" nor inside the complete
"vector" category?

...em, "directory" that was to be.

N

2013/6/5 Nikos Alexandris <nik@nikosalexandris.net>:

Do I really need to recompile the complete stuff? Yesterday it didn't work
with a single "make" inside the "v.db.select" nor inside the complete "vector"
category?

running `make` from `v.db.select` is enough (assuming that you don't
use `make install`). Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Nikos Alexandris:

> Do I really need to recompile the complete stuff? Yesterday it didn't
> work with a single "make" inside the "v.db.select" nor inside the complete
> "vector" category?

Martin Landa wrote:

running `make` from `v.db.select` is enough (assuming that you don't
use `make install`). Martin

Right, I don't "make install". Hmm, I'll give it a quick try...

Thanks, N

On Wednesday 05 of June 2013 12:22:41 Nikos Alexandris wrote:

Nikos Alexandris:
> > Do I really need to recompile the complete stuff? Yesterday it didn't
> > work with a single "make" inside the "v.db.select" nor inside the
> > complete
> > "vector" category?

Martin Landa wrote:
> running `make` from `v.db.select` is enough (assuming that you don't
> use `make install`). Martin

Right, I don't "make install". Hmm, I'll give it a quick try...

Nope!

# just did...
/geo/osgeo/src/grass_trunk/vector/v.db.select$ make

gcc -g -O2 -I/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/include -I/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-gnu/include
-D_FILE_OFFSET_BITS=64 -I/usr/local/include -I/usr/local/include -
DPACKAGE=\""grassmods"\" -I/usr/include/postgresql -
I/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-gnu/include -
I/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-gnu/include -o
OBJ.x86_64-unknown-linux-gnu/main.o -c main.c
main.c: In function ‘main’:
main.c:180:2: warning: format not a string literal and no format arguments [-
Wformat-security]
: && gcc -L/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-gnu/lib -
L/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-gnu/lib -Wl,--export-
dynamic -Wl,-rpath-link,/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/lib -o /geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/bin/v.db.select OBJ.x86_64-unknown-linux-gnu/main.o -
lgrass_vector.7.0.svn -lgrass_dbmiclient.7.0.svn -lgrass_dbmibase.7.0.svn -
lgrass_gis.7.0.svn -lm
if [ "/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/bin/v.db.select" != "" ] ; then
GISRC=/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/demolocation/.grassrc70 GISBASE=/geo/osgeo/src/grass_trunk/dist.x86_64-
unknown-linux-gnu PATH="/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/bin:/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-gnu/bin:$PATH"
PYTHONPATH="/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/etc/python:/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/etc/python:$PYTHONPATH"
LD_LIBRARY_PATH="/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/bin:/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/lib:/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/lib:/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/lib:/usr/local/lib" LC_ALL=C /geo/osgeo/src/grass_trunk/dist.x86_64-
unknown-linux-gnu/bin/v.db.select --html-description < /dev/null | grep -v
'</body>\|</html>' > v.db.select.tmp.html ; fi
VERSION_NUMBER=7.0.svn VERSION_DATE=2013 \
        python /geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/tools/mkhtml.py v.db.select > /geo/osgeo/src/grass_trunk/dist.x86_64-
unknown-linux-gnu/docs/html/v.db.select.html
VERSION_NUMBER=7.0.svn /geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/tools/g.html2man.py /geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/docs/html/v.db.select.html /geo/osgeo/src/grass_trunk/dist.x86_64-unknown-
linux-gnu/docs/man/man1/v.db.select.1
rm v.db.select.tmp.html

# revision?
g.version -g

version=7.0.svn
date=2013
revision=56593M
build_date=2013-05-05

Will check tonight. Thanks, N

On 05/06/13 11:14, Martin Landa wrote:

Hi,

2013/6/4 Nikos Alexandris<nik@nikosalexandris.net>:

However, the "-v" flag is still broken, e.g.:

v.db.select -cv mangrove_sites_coordinates_latest col=cat,wrspr
separator=space vs=comma | head

1
161043
comma

ops, I overlooked this issue, should be fixed in r56597. Martin

I think what Nikos is trying to get as a result would rather need a change such as this:

Index: main.c

--- main.c (révision 56597)
+++ main.c (copie de travail)
@@ -264,7 +264,10 @@
    }
    else {
        if (!v_flag->answer)
- fprintf(stdout, "\n");
+ if(vs)
+ fprintf(stdout, "%s", vs);
+ else
+ fprintf(stdout, "\n");
        else if (vs)
      fprintf(stdout, "%s\n", vs);
    }

which gives you:

> v.db.select hospitals col=cat vs=,
cat
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,

Just needs some cleanup to get rid of the last ',' at the end.

Moritz

Nikos Alexandris:

>> ...the "-v" flag is still broken, e.g.:
>> v.db.select -cv mangrove_sites_coordinates_latest col=cat,wrspr
>> separator=space vs=comma | head

>> 1
>> 161043
>> comma

Martin Landa wrote:

> ...should be fixed in r56597. Martin

Moritz Lennert wrote:

I think what Nikos is trying to get as a result would rather need a
change such as this:

Index: main.c

--- main.c (révision 56597)
+++ main.c (copie de travail)
@@ -264,7 +264,10 @@
    }
    else {
        if (!v_flag->answer)
- fprintf(stdout, "\n");
+ if(vs)
+ fprintf(stdout, "%s", vs);
+ else
+ fprintf(stdout, "\n");
        else if (vs)
      fprintf(stdout, "%s\n", vs);
    }

which gives you:
> v.db.select hospitals col=cat vs=,

cat
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,2
9,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54
,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,
104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,
123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,
142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,

Just needs some cleanup to get rid of the last ',' at the end.

Volltreffer! That's what I was thinking about. Though the initial intention
of the "-v" flag is something else?

Mercis, N

Hi,

2013/6/5 Nikos Alexandris <nik@nikosalexandris.net>:

Volltreffer! That's what I was thinking about. Though the initial intention
of the "-v" flag is something else?

yes, `vs` works only when `-v` is given. Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Nikos Alexandris:

> Volltreffer! That's what I was thinking about. Though the initial
> intention of the "-v" flag is something else?

Martin Landa wrote:

yes, `vs` works only when `-v` is given. Martin

Sure.

I meant if the "-v vs=" was about gaining another output format than the one I
think/need and Moritz correctly demonstrated?

Thanks, N

@Martin

so, recompiled everything, and revision 56597M works fine with "-v vs=" as
well. It is nice that any string (literally) can be used as a "vs=" (tested
various stuff). This vertical output seems good for alternative reporting
style. Yet, the "-v vs=comma" doesn't really make much sense, does it?

--%<---
v.db.select -cv wrs2_tiles_of_interest_testing col=cat vs=comma | head
1167
,
1179
,
2782
,
2789
,
8240
,
--->%--

@Moritz & all

I'd still prefer to have an (extra?) option to get what you demonstrated so a
"cats" output can be used without shell magic to feed other modules.

Kindest regards, N