GRASS Programmer's Manual  6.4.1(2011)
d_finddb.c
Go to the documentation of this file.
00001 
00015 #include <stdlib.h>
00016 #include <grass/dbmi.h>
00017 #include "macros.h"
00018 #include "dbstubs.h"
00019 
00026 int db_d_find_database(void)
00027 {
00028     dbHandle handle;
00029     int found;
00030     int stat;
00031 
00032     /* get the arg(s) */
00033     db_init_handle(&handle);
00034     DB_RECV_HANDLE(&handle);
00035 
00036     /* call the procedure */
00037     stat = db_driver_find_database(&handle, &found);
00038 
00039 
00040     /* send the return code */
00041     if (stat != DB_OK) {
00042         db_free_handle(&handle);
00043         DB_SEND_FAILURE();
00044         return DB_OK;
00045     }
00046     DB_SEND_SUCCESS();
00047 
00048     /* send results */
00049     DB_SEND_INT(found);
00050     if (found) {
00051         DB_SEND_HANDLE(&handle);
00052     }
00053     db_free_handle(&handle);
00054     return DB_OK;
00055 }
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines