Hi Moritz,<br><br>Yes... that one works too; I overlooked it. Now its more clear for me how it works.<br><br>Thanks,<br>Jaime<br><br><b><i>Moritz Lennert <mlennert@club.worldonline.be></i></b> escribió:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> On 20/03/08 14:31, Jaime Carrera wrote:<br>> Hi Markus and Moritz,<br>> <br>> Thanks for your suggestions; I tried another loop (the one from v.in.db) <br>> and gave the result that I needed. Below are my "experiments":<br>> The first db_fetch loop (exits after one interaction): I have to "cheat" <br>> to be able to get all the records from the database:<br>> <br>> while(1){<br>> if(db_fetch (&cursor, DB_NEXT, &more) != DB_OK)<br>> return(-1);<br>> nodeprop=db_get_value_as_double(dbvalue,ctype);<br>> printf("node prop= %.2f\n",nodeprop);<br>> count++;<br>> if(count<12699) /* use
max(cat) value for this one, just testing*/<br>> more=0;<br>> if ( more) break;<br>> }<br>> <br>> Now, using the loop as used in v.in.db I get what I need, without <br>> "cheating':<br>> <br>> while ( db_fetch (&cursor, DB_NEXT, &more ) == DB_OK && more ) {<br>> nodeprop=db_get_value_as_double(dbvalue,ctype);<br>> printf("node prop= %.2f\n",nodeprop);<br>> }<br>> <br>> There are two differences: on the first loop more==1 immediately, and <br>> thus exits the loop; while on the second one the loop is exptecting <br>> more==1. Another difference is the != or == DB_OK part.<br>> <br>> What I can gather from this, is that the first loop is more appropriate <br>> to queries done on a category basis, but not for fetching an entire table.<br><br>I don't really understand the first one. Why do you break if more==1 ? <br>Instead of<br><br>if(count<12699) /* use max(cat) value for
this one, just testing*/<br> more=0;<br>if ( more) break;<br><br>Shouldn't this just be<br><br>if(!more) break;<br><br>?<br><br>Moritz<br></blockquote><br><p> 
<hr size=1><br><font face="Verdana" size="-2">¡Capacidad ilimitada de almacenamiento en tu correo!<br>No te preocupes más por el espacio de tu cuenta con Correo Yahoo!:<br>
http://correo.espanol.yahoo.com/</font>