d_closedb.c

Go to the documentation of this file.
00001 #include <grass/dbmi.h>
00002 #include "macros.h"
00003 #include "dbstubs.h"
00004 
00011 int
00012 db_d_close_database()
00013 {
00014     int stat;
00015 
00016 /* no arg(s) */
00017 
00018 /* see if a database is open */
00019     if (!db__test_database_open())
00020     {
00021         db_error ("no database is open");
00022         DB_SEND_FAILURE();
00023         return DB_OK;
00024     };
00025 /* make sure all cursors are closed */
00026     db__close_all_cursors();
00027 
00028 /* call the procedure */
00029     stat = db_driver_close_database();
00030 
00031 /* send the return code */
00032     if (stat != DB_OK)
00033     {
00034         DB_SEND_FAILURE();
00035         return DB_OK;
00036     }
00037     DB_SEND_SUCCESS();
00038 
00039 /* clear the driver state */
00040     db__mark_database_closed ();
00041     db__init_driver_state();
00042 
00043 /* no results */
00044     return DB_OK;
00045 }

Generated on Sun Apr 6 17:31:38 2008 for GRASS by  doxygen 1.5.5