|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-ddeab64dbf
|
DBMI Library (client) - select records from table. More...
#include <stdlib.h>#include <string.h>#include <grass/gis.h>#include <grass/dbmi.h>#include <grass/glocale.h>
Go to the source code of this file.
Functions | |
| int | db_select_int (dbDriver *driver, const char *tab, const char *col, const char *where, int **pval) |
| Select array of ordered integers from table/column. | |
| int | db_select_value (dbDriver *driver, const char *tab, const char *key, int id, const char *col, dbValue *val) |
| Select one (first) value from table/column for key/id. | |
| int | db_select_CatValArray (dbDriver *driver, const char *tab, const char *key, const char *col, const char *where, dbCatValArray *cvarr) |
| Select pairs key/value to array, values are sorted by key (must be integer) | |
| void | db_CatValArray_sort (dbCatValArray *arr) |
| Sort key/value array by key. | |
| int | db_CatValArray_sort_by_value (dbCatValArray *arr) |
| Sort key/value array by value. | |
| int | db_CatValArray_get_value (dbCatValArray *arr, int key, dbCatVal **cv) |
| Find value by key. | |
| int | db_CatValArray_get_value_int (dbCatValArray *arr, int key, int *val) |
| Find value (integer) by key. | |
| int | db_CatValArray_get_value_double (dbCatValArray *arr, int key, double *val) |
| Find value (double) by key. | |
DBMI Library (client) - select records from table.
(C) 1999-2008 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file db/dbmi_client/select.c.
| int db_CatValArray_get_value | ( | dbCatValArray * | arr, |
| int | key, | ||
| dbCatVal ** | cv | ||
| ) |
Find value by key.
| arr | dbCatValArray (key/value array) | |
| key | key value | |
| [out] | cv | dbCatVal structure (key/value) to store within |
Definition at line 469 of file db/dbmi_client/select.c.
| int db_CatValArray_get_value_double | ( | dbCatValArray * | arr, |
| int | key, | ||
| double * | val | ||
| ) |
Find value (double) by key.
| arr | dbCatValArray (key/value array) | |
| key | key value | |
| [out] | val | found value (double) |
Definition at line 519 of file db/dbmi_client/select.c.
References DB_FAILED, DB_OK, G_debug(), and NULL.
Referenced by IL_vector_input_data_2d(), NetA_get_node_costs(), Vect_net_build_graph(), and Vect_net_ttb_build_graph().
| int db_CatValArray_get_value_int | ( | dbCatValArray * | arr, |
| int | key, | ||
| int * | val | ||
| ) |
Find value (integer) by key.
| arr | dbCatValArray (key/value array) | |
| key | key value | |
| [out] | val | found value (integer) |
Definition at line 494 of file db/dbmi_client/select.c.
References DB_FAILED, DB_OK, and NULL.
Referenced by IL_vector_input_data_2d(), Vect_net_build_graph(), and Vect_net_ttb_build_graph().
| void db_CatValArray_sort | ( | dbCatValArray * | arr | ) |
Sort key/value array by key.
| [in,out] | arr | dbCatValArray (key/value array) |
Definition at line 421 of file db/dbmi_client/select.c.
Referenced by db_select_CatValArray().
| int db_CatValArray_sort_by_value | ( | dbCatValArray * | arr | ) |
Sort key/value array by value.
| [in,out] | arr | dbCatValArray (key/value array) |
Definition at line 434 of file db/dbmi_client/select.c.
References DB_C_TYPE_DATETIME, DB_C_TYPE_DOUBLE, DB_C_TYPE_INT, DB_C_TYPE_STRING, DB_FAILED, and DB_OK.
Referenced by Vedit_bulk_labeling().
| int db_select_CatValArray | ( | dbDriver * | driver, |
| const char * | tab, | ||
| const char * | key, | ||
| const char * | col, | ||
| const char * | where, | ||
| dbCatValArray * | cvarr | ||
| ) |
Select pairs key/value to array, values are sorted by key (must be integer)
| driver | DB driver | |
| tab | table name | |
| key | key column name | |
| col | value column name | |
| where | where statement | |
| [out] | cvarr | dbCatValArray to store within |
Definition at line 273 of file db/dbmi_client/select.c.
References _, db_append_string(), DB_C_TYPE_DATETIME, DB_C_TYPE_DOUBLE, DB_C_TYPE_INT, DB_C_TYPE_STRING, db_CatValArray_alloc(), db_CatValArray_sort(), db_close_cursor(), db_fetch(), db_free_string(), db_get_column_sqltype(), db_get_column_value(), db_get_cursor_table(), db_get_num_rows(), db_get_string(), db_get_table_column(), db_get_value_double(), db_get_value_int(), db_get_value_string(), db_init_string(), DB_NEXT, DB_OK, db_open_select_cursor(), DB_SEQUENTIAL, db_set_string(), db_sqltype_to_Ctype(), G_asprintf(), G_debug(), G_free(), G_warning(), _db_value::isNull, malloc(), NULL, and _db_value::t.
Referenced by IL_vector_input_data_2d(), NetA_get_node_costs(), Vect_net_build_graph(), and Vect_net_ttb_build_graph().
| int db_select_int | ( | dbDriver * | driver, |
| const char * | tab, | ||
| const char * | col, | ||
| const char * | where, | ||
| int ** | pval | ||
| ) |
Select array of ordered integers from table/column.
| driver | DB driver | |
| tab | table name | |
| col | column name | |
| where | where statement | |
| [out] | pval | array of ordered integer values |
Definition at line 103 of file db/dbmi_client/select.c.
References _, count, DB_C_TYPE_DOUBLE, DB_C_TYPE_INT, DB_C_TYPE_STRING, db_close_cursor(), db_fetch(), db_free_string(), db_get_column_sqltype(), db_get_column_value(), db_get_cursor_table(), db_get_table_column(), db_get_value_double(), db_get_value_int(), db_get_value_string(), db_init_string(), DB_NEXT, DB_OK, db_open_select_cursor(), DB_SEQUENTIAL, db_set_string(), db_sqltype_to_Ctype(), G_asprintf(), G_debug(), G_free(), G_malloc, G_realloc, G_warning(), and NULL.
Referenced by Vect_cats_set_constraint(), Vect_set_varray_from_db(), and Vect_write_ascii().
| int db_select_value | ( | dbDriver * | driver, |
| const char * | tab, | ||
| const char * | key, | ||
| int | id, | ||
| const char * | col, | ||
| dbValue * | val | ||
| ) |
Select one (first) value from table/column for key/id.
| driver | DB driver | |
| tab | table name | |
| key | key column name | |
| id | identifier in key column | |
| col | name of column to select the value from | |
| [out] | val | dbValue to store within |
Definition at line 207 of file db/dbmi_client/select.c.
References _, count, db_close_cursor(), db_copy_value(), db_fetch(), db_free_string(), db_get_column_value(), db_get_cursor_table(), db_get_table_column(), db_init_string(), DB_NEXT, DB_OK, db_open_select_cursor(), DB_SEQUENTIAL, db_set_string(), G_asprintf(), G_free(), G_warning(), G_zero(), and NULL.
Referenced by Gp_load_sites_thematic(), Gv_load_vect_thematic(), and Vect_write_ascii().