field.c File Reference

#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 dependency graph for field.c:

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, char *name, char *table, char *key, char *db, 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, char *name, char *table, char *key, char *db, char *driver)
 add new db connection to dblinks structure
struct field_info * Vect_default_field_info (struct Map_info *Map, int field, 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, variables are substituted by values, link is index to array of dblinks
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
int Vect_read_dblinks (struct Map_info *Map)
 read dblinks to existing structure, variables are not substituted by values
int Vect_write_dblinks (struct Map_info *Map)
 write dblinks to file
char * Vect_subst_var (char *in, struct Map_info *Map)
 substitute variable in string
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


Function Documentation

int Vect_add_dblink ( struct dblinks *  p,
int  number,
char *  name,
char *  table,
char *  key,
char *  db,
char *  driver 
)

add new db connection to dblinks structure

Returns:
0 OK; -1 error
Parameters:
pointer to existing dblinks structure

Definition at line 185 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

Returns:
1 dblink for field exists; 0 dblink does not exist for field
Parameters:
pointer to existing dblinks structure, field number

Definition at line 162 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,
char *  field_name,
int  type 
) [read]

get default information about link to database for new dblink

Returns:
pointer to new field_info structure
Parameters:
pointer to map structure, category field

Definition at line 231 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

Returns:
pointer to new field_info structure
Parameters:
pointer Map_info structure, link number

Definition at line 308 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

Returns:
pointer to new field_info structure or NULL
Parameters:
pointer Map_info structure, field number

Definition at line 343 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,
char *  name,
char *  table,
char *  key,
char *  db,
char *  driver 
)

add new db connection to Map_info structure

Returns:
0 OK; -1 error
Parameters:
pointer to existing Map structure

Definition at line 70 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

Returns:
1 dblink for field exists; 0 dblink does not exist for field
Parameters:
pointer to Map structure, field number

Definition at line 150 of file field.c.

References Vect_check_dblink().

int Vect_map_del_dblink ( struct Map_info *  Map,
int  number 
)

delete db connection from Map_info structure

Returns:
0 deleted, -1 error
Parameters:
pointer to existing Map structure, field number

Definition at line 106 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

Returns:
pointer to new dblinks structure
Parameters:
void 

Definition at line 36 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

Returns:
number of links read or -1 on error
Parameters:
pointer to map structure

Definition at line 367 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

Returns:
void
Parameters:
pointer to existing dblinks structure

Definition at line 57 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

Parameters:
pointer to map

Definition at line 662 of file field.c.

References Vect_write_dblinks().

chart * Vect_subst_var ( char *  in,
struct Map_info *  Map 
)

substitute variable in string

Returns:
pointer to new string
Parameters:
pointer to map

Definition at line 615 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

Returns:
0 OK, -1 on error
Parameters:
pointer to map name, pointer to mapset name, pointer to dblinks structure

Definition at line 570 of file field.c.

Referenced by V1_close_nat(), Vect_map_add_dblink(), Vect_map_del_dblink(), and Vect_set_db_updated().


Generated on Sun Apr 6 17:32:47 2008 for GRASS by  doxygen 1.5.5