c_listdb.c

Go to the documentation of this file.
00001 
00015 #include <grass/dbmi.h>
00016 #include "macros.h"
00017 
00030 int db_list_databases(dbDriver * driver, dbString * path, int npaths,
00031                       dbHandle ** handles, int *count)
00032 {
00033     int ret_code;
00034     int i;
00035     dbHandle *h;
00036 
00037     /* start the procedure call */
00038     db__set_protocol_fds(driver->send, driver->recv);
00039     DB_START_PROCEDURE_CALL(DB_PROC_LIST_DATABASES);
00040 
00041     /* arguments */
00042     DB_SEND_STRING_ARRAY(path, npaths);
00043 
00044     /* get the return code for the procedure call */
00045     DB_RECV_RETURN_CODE(&ret_code);
00046 
00047     if (ret_code != DB_OK)
00048         return ret_code;        /* ret_code SHOULD == DB_FAILED */
00049 
00050     /* results */
00051     DB_RECV_INT(count);
00052     h = db_alloc_handle_array(*count);
00053     for (i = 0; i < *count; i++) {
00054         DB_RECV_HANDLE(&h[i]);
00055     }
00056     *handles = h;
00057 
00058     return DB_OK;
00059 }

Generated on Thu Jul 16 13:20:15 2009 for GRASS Programmer's Manual by  doxygen 1.5.6