GRASS 8 Programmer's Manual 8.6.0dev(2026)-8843f13794
Loading...
Searching...
No Matches
d_finddb.c
Go to the documentation of this file.
1/*!
2 * \file db/dbmi_driver/d_finddb.c
3 *
4 * \brief DBMI Library (driver) - find database
5 *
6 * SPDX-FileCopyrightText: 1999-2008 GRASS Development Team
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 *
9 * \author Joel Jones (CERL/UIUC), Radim Blazek
10 */
11
12#include <stdlib.h>
13#include <grass/dbmi.h>
14#include "macros.h"
15#include "dbstubs.h"
16
17/*!
18 \brief Find database
19
20 \return DB_OK on success
21 \return DB_FAILED on failure
22 */
24{
25 dbHandle handle;
26 int found;
27 int stat;
28
29 /* get the arg(s) */
30 db_init_handle(&handle);
31 DB_RECV_HANDLE(&handle);
32
33 /* call the procedure */
35
36 /* send the return code */
37 if (stat != DB_OK) {
38 db_free_handle(&handle);
40 return DB_OK;
41 }
43
44 /* send results */
46 if (found) {
47 DB_SEND_HANDLE(&handle);
48 }
49 db_free_handle(&handle);
50 return DB_OK;
51}
int db_d_find_database(void)
Find database.
Definition d_finddb.c:23
Main header of GRASS DataBase Management Interface.
#define DB_OK
Definition dbmi.h:69
int(* db_driver_find_database)(dbHandle *, int *)
void db_init_handle(dbHandle *)
Initialize handle (i.e database/schema)
Definition handle.c:20
void db_free_handle(dbHandle *)
Free dbHandle structure.
Definition handle.c:76
#define DB_SEND_INT(x)
Definition macros.h:82
#define DB_SEND_HANDLE(x)
Definition macros.h:126
#define DB_SEND_SUCCESS()
Definition macros.h:13
#define DB_RECV_HANDLE(x)
Definition macros.h:131
#define DB_SEND_FAILURE()
Definition macros.h:18