GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
db/dbmi_base/connect.c File Reference

DBMI Library (base) - connect to DB. More...

#include <grass/gis.h>
#include <grass/dbmi.h>
Include dependency graph for db/dbmi_base/connect.c:

Go to the source code of this file.

Functions

int db_set_connection (dbConnection *connection)
 Set default DB connection settings. More...
 
int db_get_connection (dbConnection *connection)
 Get default DB connection settings for the current mapset. More...
 

Detailed Description

DBMI Library (base) - connect to DB.

(C) 1999-2009, 2011 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.

Author
Joel Jones (CERL/UIUC), Radim Blazek
Doxygenized by Martin Landa <landa.martin gmail.com> (2011)

Definition in file db/dbmi_base/connect.c.

Function Documentation

◆ db_get_connection()

int db_get_connection ( dbConnection connection)

Get default DB connection settings for the current mapset.

Parameters
[out]connectionpointer to dbConnection to be modified
Returns
DB_OK
DB_FAILED

Definition at line 73 of file db/dbmi_base/connect.c.

References _db_connection::databaseName, DB_FAILED, db_get_login2(), DB_OK, _db_connection::driverName, G_getenv_nofatal2(), G_VAR_MAPSET, G_zero(), _db_connection::group, _db_connection::hostName, NULL, _db_connection::password, _db_connection::port, _db_connection::schemaName, and _db_connection::user.

◆ db_set_connection()

int db_set_connection ( dbConnection connection)

Set default DB connection settings.

This function sets environmental variables as DB_DRIVER, DB_DATABASE, DB_SCHEMA, DB_GROUP.

Parameters
connectionpointer to dbConnection with default settings
Returns
DB_OK

Definition at line 28 of file db/dbmi_base/connect.c.

References _db_connection::databaseName, DB_OK, _db_connection::driverName, G_setenv2(), G_unsetenv2(), G_VAR_MAPSET, _db_connection::group, and _db_connection::schemaName.

Referenced by db_set_default_connection().