GRASS Programmer's Manual 6.4.1(2011)
|
00001 00015 #include <grass/dbmi.h> 00016 #include "macros.h" 00017 #include "dbstubs.h" 00018 00025 int db_d_close_database(void) 00026 { 00027 int stat; 00028 00029 /* no arg(s) */ 00030 00031 /* see if a database is open */ 00032 if (!db__test_database_open()) { 00033 db_error("no database is open"); 00034 DB_SEND_FAILURE(); 00035 return DB_OK; 00036 }; 00037 /* make sure all cursors are closed */ 00038 db__close_all_cursors(); 00039 00040 /* call the procedure */ 00041 stat = db_driver_close_database(); 00042 00043 /* send the return code */ 00044 if (stat != DB_OK) { 00045 DB_SEND_FAILURE(); 00046 return DB_OK; 00047 } 00048 DB_SEND_SUCCESS(); 00049 00050 /* clear the driver state */ 00051 db__mark_database_closed(); 00052 db__init_driver_state(); 00053 00054 /* no results */ 00055 return DB_OK; 00056 }