GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-bea8435a9e
db/dbmi_client/handler.c
Go to the documentation of this file.
1 /*!
2  \file lib/db/dbmi_client/handler.c
3 
4  \brief DBMI Library (client) - standard error handlers
5 
6  (C) 2013 by the GRASS Development Team
7 
8  This program is free software under the GNU General Public License
9  (>=v2). Read the file COPYING that comes with GRASS for details.
10 
11  \author Martin Landa <landa.martin gmail.com>
12  */
13 
14 #include <grass/gis.h>
15 #include <grass/dbmi.h>
16 
17 static void error_handler_driver(void *p)
18 {
20 
21  driver = (dbDriver *)p;
24 }
25 
26 /*!
27  \brief Define standard error handler for open database connection
28 
29  This handler:
30  - close database connection
31  - shutdown db driver
32 
33  Note: It's recommended to call this routine after
34  db_start_driver_open_database().
35 
36  \param driver DB driver
37  */
39 {
40  G_add_error_handler(error_handler_driver, driver);
41 }
42 
43 /*!
44  \brief Remove error handler before closing the driver
45 
46  \param driver DB driver
47  */
49 {
50  G_remove_error_handler(error_handler_driver, driver);
51 }
void db_unset_error_handler_driver(dbDriver *driver)
Remove error handler before closing the driver.
void db_set_error_handler_driver(dbDriver *driver)
Define standard error handler for open database connection.
int db_shutdown_driver(dbDriver *)
Closedown the driver, and free the driver structure.
Definition: shutdown.c:36
int db_close_database(dbDriver *)
Close database connection.
Definition: c_closedb.c:26
void G_remove_error_handler(void(*)(void *), void *)
Remove existing error handler.
Definition: gis/handler.c:85
void G_add_error_handler(void(*)(void *), void *)
Add new error handler.
Definition: gis/handler.c:71
const struct driver * driver
Definition: driver/init.c:25
Definition: driver.h:21