GRASS 8 Programmer's Manual 8.6.0dev(2026)-8843f13794
Loading...
Searching...
No Matches
temporal/lib/default_name.c
Go to the documentation of this file.
1/*!
2 \file lib/db/dbmi_base/default_name.c
3
4 \brief Temporal GIS Library (base) - default settings
5
6 SPDX-FileCopyrightText: 2012-2014 GRASS Development Team
7 SPDX-License-Identifier: GPL-2.0-or-later
8
9 \author Soeren Gebbert
10 Code is based on the dbmi library written by
11 Joel Jones (CERL/UIUC) and Radim Blazek
12 */
13
14#include <stdio.h>
15#include <stdlib.h>
16#include <string.h>
17#include <grass/gis.h>
18#include <grass/temporal.h>
19#include <grass/glocale.h>
20
21/*!
22 \brief Get default TGIS driver name
23
24 \return pointer to default TGIS driver name
25 */
27{
29}
30
31/*!
32 \brief Get default TGIS database name for the sqlite connection
33
34 The default name is $GISDBASE/$LOCATION_NAME/$MAPSET/tgis/sqlite.db
35
36 \return pointer to default TGIS database name
37 */
39{
40 char default_connection[2048];
41
42 snprintf(default_connection, 2048, "$GISDBASE/$LOCATION_NAME/$MAPSET/%s",
44
46}
47
48/*!
49 \brief Sets up TGIS database connection settings using GRASS default
50
51 \return returns DB_OK
52 */
54{
56 char db_name[2048];
58
59 snprintf(db_name, 2048, "%s", tmp);
60 G_free(tmp);
61
62 if (strcmp(TGISDB_DEFAULT_DRIVER, "sqlite") == 0) {
63 connection.driverName = "sqlite";
64 connection.databaseName = db_name;
66 }
67 else
69 _("Programmer error - only SQLite driver is currently supported"));
70
71 return DB_OK;
72}
#define DB_OK
Definition dbmi.h:69
void G_free(void *)
Free allocated memory.
Definition gis/alloc.c:145
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
char * G_store(const char *)
Copy string to allocated memory.
Definition strings.c:85
#define _(str)
Definition glocale.h:10
char * tgis_get_default_database_name(void)
Get default TGIS database name for the sqlite connection.
int tgis_set_default_connection(void)
Sets up TGIS database connection settings using GRASS default.
const char * tgis_get_default_driver_name(void)
Get default TGIS driver name.
int tgis_set_connection(dbConnection *connection)
Set Temporal GIS DB connection settings.
#define TGISDB_DEFAULT_SQLITE_PATH
Definition temporal.h:10
#define TGISDB_DEFAULT_DRIVER
Definition temporal.h:8