#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>

Go to the source code of this file.
Functions | |
| struct dblinks * | Vect_new_dblinks_struct (void) |
| Create and init new dblinks ctructure. | |
| void | Vect_reset_dblinks (struct dblinks *p) |
| Reset dblinks structure. | |
| 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. | |
| int | Vect_map_del_dblink (struct Map_info *Map, int field) |
| Delete db connection from Map_info structure. | |
| int | Vect_map_check_dblink (struct Map_info *Map, int field) |
| Check if db connection exists in dblinks structure. | |
| int | Vect_check_dblink (struct dblinks *p, int field) |
| Check if db connection exists in dblinks structure. | |
| 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. | |
| 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. | |
| struct field_info * | Vect_get_dblink (struct Map_info *Map, int link) |
| Get information about link to database. | |
| struct field_info * | Vect_get_field (struct Map_info *Map, int field) |
| Get information about link to database. | |
| int | Vect_read_dblinks (struct Map_info *Map) |
| Read dblinks to existing structure. | |
| int | Vect_write_dblinks (struct Map_info *Map) |
| Write dblinks to file. | |
| char * | Vect_subst_var (const char *in, struct Map_info *Map) |
| Substitute variable in string. | |
| void | Vect_set_db_updated (struct Map_info *Map) |
| Rewrite 'dbln' file. | |
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 |
-1 error
Definition at line 210 of file field.c.
References Vect_check_dblink().
Referenced by Vect_map_add_dblink(), and Vect_read_dblinks().
| int Vect_check_dblink | ( | struct dblinks * | p, | |
| int | field | |||
| ) |
Check if db connection exists in dblinks structure.
| p | pointer to existing dblinks structure | |
| field | layer number |
0 dblink does not exist for field
Definition at line 181 of file field.c.
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 | |||
| ) | [read] |
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 274 of file field.c.
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 | |||
| ) | [read] |
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 360 of file field.c.
References Vect_subst_var().
Referenced by 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 | |||
| ) | [read] |
Get information about link to database.
Variables are substituted by values, field is number of requested field
| Map | vector map | |
| field | layer number |
NULL if not found
Definition at line 400 of file field.c.
References Vect_get_dblink().
Referenced by 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 |
-1 error
Definition at line 82 of file field.c.
References Vect_add_dblink(), and Vect_write_dblinks().
Referenced by Vect_copy(), Vect_copy_table_by_cats(), Vect_copy_tables(), and Vect_rename().
| int Vect_map_check_dblink | ( | struct Map_info * | Map, | |
| int | field | |||
| ) |
Check if db connection exists in dblinks structure.
| Map | vector map | |
| field | layer number |
0 dblink does not exist for field
Definition at line 167 of file field.c.
References Vect_check_dblink().
| int Vect_map_del_dblink | ( | struct Map_info * | Map, | |
| int | field | |||
| ) |
Delete db connection from Map_info structure.
| Map | vector map | |
| field | layer number |
-1 error
Definition at line 121 of file field.c.
References Vect_write_dblinks().
Referenced by Vect_rename().
| struct dblinks* Vect_new_dblinks_struct | ( | void | ) | [read] |
Create and init new dblinks ctructure.
| void |
Definition at line 41 of file field.c.
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 |
-1 on error
Definition at line 427 of file field.c.
References FALSE, 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 62 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 771 of file field.c.
References 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 718 of file field.c.
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 |
-1 on error
Definition at line 667 of file field.c.
Referenced by V1_close_nat(), Vect_map_add_dblink(), Vect_map_del_dblink(), and Vect_set_db_updated().
1.5.6