| GRASS Programmer's Manual
    6.5.svn(2014)-r66266
    | 
Vector library - field(layer) related fns. More...
#include <stdlib.h>#include <stdio.h>#include <string.h>#include <grass/glocale.h>#include <grass/gis.h>#include <grass/dbmi.h>#include <grass/Vect.h>#include <gdal_version.h>#include <ogr_api.h>
Go to the source code of this file.
| Functions | |
| struct dblinks * | Vect_new_dblinks_struct (void) | 
| Create and init new dblinks ctructure.  More... | |
| void | Vect_reset_dblinks (struct dblinks *p) | 
| Reset dblinks structure.  More... | |
| int | Vect_map_add_dblink (struct Map_info *Map, int number, const char *name, const char *table, const char *key, const char *db, const char *driver) | 
| Add new db connection to Map_info structure.  More... | |
| int | Vect_map_del_dblink (struct Map_info *Map, int field) | 
| Delete db connection from Map_info structure.  More... | |
| int | Vect_map_check_dblink (struct Map_info *Map, int field) | 
| Check if db connection exists in dblinks structure.  More... | |
| int | Vect_check_dblink (struct dblinks *p, int field) | 
| Check if db connection exists in dblinks structure.  More... | |
| int | Vect_add_dblink (struct dblinks *p, int number, const char *name, const char *table, const char *key, const char *db, const char *driver) | 
| Add new db connection to dblinks structure.  More... | |
| struct field_info * | Vect_default_field_info (struct Map_info *Map, int field, const char *field_name, int type) | 
| Get default information about link to database for new dblink.  More... | |
| struct field_info * | Vect_get_dblink (struct Map_info *Map, int link) | 
| Get information about link to database.  More... | |
| struct field_info * | Vect_get_field (struct Map_info *Map, int field) | 
| Get information about link to database.  More... | |
| int | Vect_read_dblinks (struct Map_info *Map) | 
| Read dblinks to existing structure.  More... | |
| int | Vect_write_dblinks (struct Map_info *Map) | 
| Write dblinks to file.  More... | |
| char * | Vect_subst_var (const char *in, struct Map_info *Map) | 
| Substitute variable in string.  More... | |
| void | Vect_set_db_updated (struct Map_info *Map) | 
| Rewrite 'dbln' file.  More... | |
Vector library - field(layer) related fns.
Higher level functions for reading/writing/manipulating vectors.
TODO: see Vect_read_dblinks; activate auto-FID detection once OGR_L_GetFIDColumn() is working or solution found if FID not available
(C) 2001-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 field.c.
| int Vect_add_dblink | ( | struct dblinks * | p, | 
| int | number, | ||
| const char * | name, | ||
| const char * | table, | ||
| const char * | key, | ||
| const char * | db, | ||
| const char * | driver | ||
| ) | 
Add new db connection to dblinks structure.
| p | pointer to existing dblinks structure | 
| number | layer number | 
| name | layer name | 
| key | key name | 
| db | database name | 
| driver | driver name | 
Definition at line 214 of file field.c.
References G_debug(), G_store(), G_warning(), NULL, and Vect_check_dblink().
Referenced by Vect_map_add_dblink(), and Vect_read_dblinks().
Check if db connection exists in dblinks structure.
| p | pointer to existing dblinks structure | 
| field | layer number | 
Definition at line 185 of file field.c.
References G_debug().
Referenced by Vect_add_dblink(), and Vect_map_check_dblink().
| struct field_info* Vect_default_field_info | ( | struct Map_info * | Map, | 
| int | field, | ||
| const char * | field_name, | ||
| int | type | ||
| ) | 
Get default information about link to database for new dblink.
| Map | vector map | 
| field | layer number | 
| field_name | layer name | 
| type | how many tables are linked to map: GV_1TABLE / GV_MTABLE | 
Definition at line 278 of file field.c.
References buf, buf2, db_get_connection(), db_set_default_connection(), G__getenv2(), G_debug(), G_fatal_error(), G_store(), G_warning(), NULL, and sprintf().
Referenced by Vect_copy(), Vect_copy_table_by_cats(), Vect_copy_tables(), and Vect_rename().
| struct field_info* Vect_get_dblink | ( | struct Map_info * | Map, | 
| int | link | ||
| ) | 
Get information about link to database.
Variables are substituted by values, link is index to array of dblinks
| Map | vector map | 
| link | link id | 
Definition at line 364 of file field.c.
References G_debug(), G_store(), G_warning(), malloc(), NULL, and Vect_subst_var().
Referenced by wxdigit.IVDigit::DeleteSelectedLines(), wxdigit.IVDigit::InitCats(), Vect_copy(), Vect_copy_tables(), Vect_delete(), Vect_get_field(), and Vect_rename().
| struct field_info* Vect_get_field | ( | struct Map_info * | Map, | 
| int | field | ||
| ) | 
Get information about link to database.
Variables are substituted by values, field is number of requested field
| Map | vector map | 
| field | layer number | 
Definition at line 404 of file field.c.
References G_debug(), NULL, and Vect_get_dblink().
Referenced by wxdigit.IVDigit::CopyCats(), G_sites_get_fields(), G_sites_open_old(), IL_vector_input_data_2d(), NetA_get_node_costs(), NetA_init_timetable_from_db(), Vect_copy_table_by_cats(), Vect_get_column_names(), Vect_get_column_names_types(), Vect_get_column_types(), Vect_net_build_graph(), Vect_rename(), and Vect_set_varray_from_db().
| int Vect_map_add_dblink | ( | struct Map_info * | Map, | 
| int | number, | ||
| const char * | name, | ||
| const char * | table, | ||
| const char * | key, | ||
| const char * | db, | ||
| const char * | driver | ||
| ) | 
Add new db connection to Map_info structure.
| Map | vector map | 
| number | layer number | 
| name | layer name | 
| table | table name | 
| key | key name | 
| db | database name | 
| driver | driver name | 
Definition at line 86 of file field.c.
References G_warning(), Vect_add_dblink(), and Vect_write_dblinks().
Referenced by Vect_copy(), Vect_copy_table_by_cats(), Vect_copy_tables(), and Vect_rename().
Check if db connection exists in dblinks structure.
| Map | vector map | 
| field | layer number | 
Definition at line 171 of file field.c.
References Vect_check_dblink().
Delete db connection from Map_info structure.
| Map | vector map | 
| field | layer number | 
Definition at line 125 of file field.c.
References G_debug(), G_warning(), and Vect_write_dblinks().
Referenced by Vect_rename().
| struct dblinks* Vect_new_dblinks_struct | ( | void | ) | 
Create and init new dblinks ctructure.
| void | 
Definition at line 45 of file field.c.
References NULL.
Referenced by Vect__open_old(), and Vect_open_new().
| int Vect_read_dblinks | ( | struct Map_info * | Map | ) | 
Read dblinks to existing structure.
Variables are not substituted by values.
| Map | vector map | 
Definition at line 431 of file field.c.
References buf, db_auto_print_errors(), db_close_cursor(), db_close_database_shutdown_driver(), db_init_string(), db_open_select_cursor(), db_set_string(), db_start_driver_open_database(), driver, FALSE, fclose(), fd, file, G_chop(), G_debug(), G_fatal_error(), G_free_tokens(), G_getl2(), G_number_of_tokens(), G_tokenize(), G_warning(), NULL, sprintf(), Vect_add_dblink(), and Vect_reset_dblinks().
Referenced by Vect__open_old().
| void Vect_reset_dblinks | ( | struct dblinks * | p | ) | 
Reset dblinks structure.
| p | pointer to existing dblinks structure | 
Definition at line 66 of file field.c.
Referenced by Vect_read_dblinks().
| void Vect_set_db_updated | ( | struct Map_info * | Map | ) | 
Rewrite 'dbln' file.
Should be used by GRASS modules which update database tables, so that other applications know that tables were changed and can reload data.
| Map | vector map | 
Definition at line 801 of file field.c.
References G_fatal_error(), G_mapset(), and Vect_write_dblinks().
| char* Vect_subst_var | ( | const char * | in, | 
| struct Map_info * | Map | ||
| ) | 
Substitute variable in string.
| in | current string | 
| Map | vector map | 
Definition at line 741 of file field.c.
References buf, G_debug(), G_free(), G_store(), G_str_replace(), NULL, and sprintf().
Referenced by Vect_copy(), Vect_copy_table_by_cats(), Vect_copy_tables(), Vect_get_dblink(), and Vect_rename().
| int Vect_write_dblinks | ( | struct Map_info * | Map | ) | 
Write dblinks to file.
| Map | vector map | 
Definition at line 690 of file field.c.
References buf, fclose(), fd, file, G_debug(), G_warning(), NULL, and sprintf().
Referenced by V1_close_nat(), Vect_map_add_dblink(), Vect_map_del_dblink(), and Vect_set_db_updated().