[GRASS-user] db_fetch questions

Markus Neteler neteler at osgeo.org
Thu Mar 20 06:05:24 EDT 2008


Jaime,

I don't know too much how this works but best it to look at
working implementations.

[neteler at markus vector]$ grep db_fetch */*
v.db.select/main.c:     if(db_fetch (&cursor, DB_NEXT, &more) != DB_OK)
v.digit/generate.c:    if ( db_fetch (&cursor, DB_NEXT, &more ) != DB_OK ) {
v.extrude/main.c:               if (db_fetch(&cursor, DB_NEXT, &more) != DB_OK)
v.extrude/main.c:               if (db_fetch(&cursor, DB_NEXT, &more) != DB_OK)
v.in.db/main.c:    while ( db_fetch (&cursor, DB_NEXT, &more ) ==
DB_OK && more ) {
v.label/main.c: if( db_fetch (&cursor, DB_NEXT, &more) != DB_OK ||
!more ) continue;
v.label.sa/labels.c:    if (db_fetch(&cursor, DB_NEXT, &more) != DB_OK || !more)
v.out.ogr/main.c:               if(db_fetch (&cursor, DB_NEXT, &more)
!= DB_OK) G_fatal_error (_("Unable to fetch data from table"));
v.out.svg/main.c:        if(db_fetch (&cursor, DB_NEXT, &more) != DB_OK) {
v.overlay/main.c:              if(db_fetch (&cursor, DB_NEXT, &more) != DB_OK)
v.patch/main.c:        if ( db_fetch (&cursor, DB_NEXT, &more ) != DB_OK ) {
v.reclass/main.c:               if(db_fetch (&cursor, DB_NEXT, &more)
!= DB_OK) {
v.to.db/query.c:                if(db_fetch (&cursor, DB_NEXT, &more) != DB_OK)

Sorry to be no better help. Please send me/us a text snippet for
http://download.osgeo.org/grass/grass6_progman/dbmilib.html
and/or
http://download.osgeo.org/grass/grass6_progman/c__fetch_8c.html#b2c3d32766529e8c3bdbfee218d9366c
to better document the behavior. We had once inherited the DBMI
completely undocumented...

Markus

On Thu, Mar 20, 2008 at 12:19 AM, Jaime Carrera
<jaicarrerahdez at yahoo.com> wrote:
> Hi list,
>
> My apologies if this question fits better in the developers list.
> I'm trying to understand how db_fetch works and why am getting a strange
> error.
> After a query is executed and db_open_select_cursor is used, db_fetch is
> used to fetch the data of the resultant query. AFAIK, db_fetch(&cursor,
> DB_NEXT, &more) fetches the data on a row by row basis; is this correct? My
> problem is that everything works fine on my program except the db_fetch
> loop, as the loop breaks after the first iteration (although my table has
> 3000 rows).
> Can someone help me to figure out why the loop breaks?
>
> Thanks,
>
> Jaime
>
>
>  ________________________________
>
> ¡Capacidad ilimitada de almacenamiento en tu correo!
> No te preocupes más por el espacio de tu cuenta con Correo Yahoo!:
>  http://correo.espanol.yahoo.com/
> _______________________________________________
>  grass-user mailing list
>  grass-user at lists.osgeo.org
>  http://lists.osgeo.org/mailman/listinfo/grass-user
>
>



-- 
Open Source Geospatial Foundation
http://www.osgeo.org/
http://www.grassbook.org/


More information about the grass-user mailing list