d_listdb.c

Go to the documentation of this file.
00001 #include <stdlib.h>
00002 #include <grass/dbmi.h>
00003 #include "macros.h"
00004 #include "dbstubs.h"
00005 
00012 int
00013 db_d_list_databases(void)
00014 {
00015     dbHandle *handles;
00016     dbString *path;
00017     int npaths;
00018     int i,count;
00019     int stat;
00020 
00021 /* arg(s) */
00022     DB_RECV_STRING_ARRAY (&path, &npaths);
00023 
00024 /* call the procedure */
00025     stat = db_driver_list_databases (path, npaths, &handles, &count);
00026     db_free_string_array (path, npaths);
00027 
00028 /* send the return code */
00029     if (stat != DB_OK)
00030     {
00031         DB_SEND_FAILURE();
00032         return DB_OK;
00033     }
00034     DB_SEND_SUCCESS();
00035 
00036 /* send results */
00037     DB_SEND_INT(count);
00038     for (i = 0; i < count; i++)
00039     {
00040         DB_SEND_HANDLE (&handles[i]);
00041     }
00042     db_free_handle_array (handles, count);
00043     return DB_OK;
00044 }

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