GRASS Programmer's Manual  6.4.3(2013)-r
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
d_listdb.c
Go to the documentation of this file.
1 
15 #include <stdlib.h>
16 #include <grass/dbmi.h>
17 #include "macros.h"
18 #include "dbstubs.h"
19 
27 {
28  dbHandle *handles;
29  dbString *path;
30  int npaths;
31  int i, count;
32  int stat;
33 
34  /* arg(s) */
35  DB_RECV_STRING_ARRAY(&path, &npaths);
36 
37  /* call the procedure */
38  stat = db_driver_list_databases(path, npaths, &handles, &count);
39  db_free_string_array(path, npaths);
40 
41  /* send the return code */
42  if (stat != DB_OK) {
44  return DB_OK;
45  }
47 
48  /* send results */
49  DB_SEND_INT(count);
50  for (i = 0; i < count; i++) {
51  DB_SEND_HANDLE(&handles[i]);
52  }
53  db_free_handle_array(handles, count);
54  return DB_OK;
55 }