24 #include "local_proto.h" 38 G_debug(1,
"V1_close_nat(): name = %s mapset= %s", Map->
name,
59 char *env =
getenv(
"GRASS_VECTOR_TEMPORARY");
62 if (Map->
temporary == TEMPORARY_MAP_ENV && env) {
67 G_debug(1,
"V1_close_nat(): temporary map <%s> TO BE MOVED TO" 73 if (access(path_map, 0) != 0 &&
G_mkdir(path_map) != 0)
75 path_map, strerror(errno));
79 G_debug(1,
"V1_close_nat(): %s -> %s", path_tmp, path_map);
81 G_fatal_error(
_(
"Unable to copy '%s': %s"), path_tmp, strerror(errno));
83 #ifdef TEMPORARY_MAP_DB 91 G_debug(1,
"V1_close_nat(): copying attributes");
96 for (i = 0; i < ndblinks; i++) {
112 Map->
dblnk = dblinks;
121 G_debug(1,
"V1_close_nat(): temporary map <%s> TO BE DELETED", Map->
name);
125 G_debug(1,
"V1_close_nat(): temporary map <%s> IS NOT DELETED",
130 else if (Map->
temporary == TEMPORARY_MAP) {
131 G_debug(1,
"V1_close_nat(): temporary map <%s> TO BE DELETED", Map->
name);
142 #ifndef TEMPORARY_MAP_DB 155 for (i = 0; i < ndblinks; i++) {
159 if (driver ==
NULL) {
160 G_warning(
_(
"Unable to open database <%s> by driver <%s>"),
char * G_file_name(char *, const char *, const char *, const char *)
Builds full path names to GIS data files.
char * name
Map name (for 4.0)
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
int db_get_connection(dbConnection *)
Get default DB connection settings for the current mapset.
char * Vect__get_element_path(char *file_path, const struct Map_info *Map, const char *element)
Get map element full path (internal use only)
#define GV_DIRECTORY
Name of vector directory.
off_t size
Total size (in bytes)
void db_init_string(dbString *)
Initialize dbString.
char * table
Name of DB table.
void G_free(void *)
Free allocated memory.
dbDriver * db_start_driver_open_database(const char *, const char *)
Open driver/database connection.
int V1_close_nat(struct Map_info *Map)
Close vector map.
int db_set_string(dbString *, const char *)
Inserts string to dbString (enlarge string)
int Vect_add_dblink(struct dblinks *, int, const char *, const char *, const char *, const char *, const char *)
Add new DB connection to dblinks structure.
int Vect_get_num_dblinks(const struct Map_info *)
Get number of defined dblinks.
#define GV_MODE_RW
Read-write vector map open mode.
Layer (old: field) information.
#define VECT_OPEN(Map)
Check if vector map is open.
char * name
Layer name (optional)
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
int G_recursive_copy(const char *, const char *)
Copy recursively source directory to destination directory.
struct field_info * Vect_get_dblink(const struct Map_info *, int)
Get information about link to database.
struct dblinks * Vect_new_dblinks_struct(void)
Create and init new dblinks structure.
const struct driver * driver
void dig_file_free(struct gvfile *file)
Free struct gvfile.
char * mapset
Mapset name.
struct dig_head head
Header info.
off_t size
Coor file size.
struct dblinks * dblnk
Array of DB links.
char * driver
Name of DB driver ('sqlite', 'dbf', ...)
int Vect_write_dblinks(struct Map_info *)
Write dblinks to file.
FILE * file
File descriptor.
int db_copy_table(const char *, const char *, const char *, const char *, const char *, const char *)
Copy a table.
int temporary
Temporary map flag.
void G_warning(const char *,...) __attribute__((format(printf
int G_mkdir(const char *)
Creates a new directory.
int db_drop_table(dbDriver *, dbString *)
Drop table.
struct gvfile dig_fp
GV file pointer (native format only)
#define GV_MODE_WRITE
Write vector map open mode.
int Vect__write_head(const struct Map_info *)
Writes head information to text file (GV_HEAD_ELEMENT)
int dig__write_head(struct Map_info *)
int Vect_coor_info(const struct Map_info *, struct Coor_info *)
Update Coor_info structure.
int G_recursive_remove(const char *)
Recursively remove all files in given directory.
int G_debug(int, const char *,...) __attribute__((format(printf
char * key
Name of key column (usually 'cat')