[GRASS5] db_get_value_...

Jáchym Čepický jachym.cepicky at centrum.cz
Tue Jan 31 14:08:16 EST 2006


Hallo, 
I try do get some data (double, string) from database column and I'm not able to manage this. What is the best place (module/file), where to look at the code, how to do this?
I try following:

double height;
int cat;
int point = 0;
char sql[1024];
...


cat = Vect_get_line_cat(&In, point, Clist->field);
db_init_string(&sql);
sprintf(query, "SELECT %s FROM %s WHERE %s = %d",
                        hcolumn->answer, Fi->table, Fi->key, cat);
printf("%s", query);
# SELECT height FROM strom WHERE cat = 1

db_append_string(&sql, query);

db_open_select_cursor(driver, &sql, &cursor, DB_SEQUENTIAL)
table = db_get_cursor_table(&cursor);
hdbcolumn = db_get_table_column(table, 0);/* first column */
value = db_get_column_value(hdbcolumn);
height = db_get_value_as_double(value, db_get_column_host_type(hdbcolumn));

printf("%f",height);
# 0.0

height will allways get 0.0 value. There is only one point in the file of category 1. Height column is of type double. I can not find, where the problem could be :-/

Thanks for help

Jachym




--
Jachym Cepicky
e-mail: jachym.cepicky at centrum.cz
URL: http://les-ejk.cz
GPG: http://les-ejk.cz/gnupg_public_key/
-----------------------------------------
OFFICE:
Department of Geoinformation Technologies
LDF MZLU v Brně
Zemědělská 3
613 00 Brno
e-mail: xcepicky at node.mendelu.cz
URL: http://mapserver.mendelu.cz
Tel.: +420 545 134 514




More information about the grass-dev mailing list