17 #include <grass/gis.h>
18 #include <grass/dbmi.h>
19 #include <grass/glocale.h>
31 if ((drv =
G__getenv2(
"DB_DRIVER", G_VAR_MAPSET)))
47 if ((drv =
G__getenv2(
"DB_DATABASE", G_VAR_MAPSET)))
63 if ((sch =
G__getenv2(
"DB_SCHEMA", G_VAR_MAPSET)))
79 if ((gr =
G__getenv2(
"DB_GROUP", G_VAR_MAPSET)))
94 dbConnection connection;
98 "Creating new default DB params with db_set_default_connection()");
103 if (strcmp(DB_DEFAULT_DRIVER,
"dbf") == 0) {
106 connection.driverName =
"dbf";
107 connection.databaseName =
"$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/";
113 else if (strcmp(DB_DEFAULT_DRIVER,
"sqlite") == 0) {
116 connection.driverName =
"sqlite";
122 connection.databaseName =
123 "$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db";
char * G_mapset(void)
current mapset name
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
char * G_store(const char *s)
Copy string to allocated memory.
const char * db_get_default_schema_name(void)
Get default schema name.
char * G__getenv2(const char *name, int loc)
Get environment variable from specific place.
int db_get_connection(dbConnection *connection)
get default db connection settings
char * G_location_path(void)
Get current location directory.
const char * db_get_default_driver_name(void)
Get default driver name.
int db_set_connection(dbConnection *connection)
set default db connection settings
const char * db_get_default_database_name(void)
Get default database name.
int db_set_default_connection(void)
Sets up database connection settings using GRASS default from dbmi.h.
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
int G_debug(int level, const char *msg,...)
Print debugging message.
const char * db_get_default_group_name(void)
Get default group name.
int G__make_mapset_element(const char *p_element)
Create element in the current mapset.
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.