c_listdb.c

Go to the documentation of this file.
00001 #include <grass/dbmi.h>
00002 #include "macros.h"
00003 
00010 int
00011 db_list_databases (dbDriver *driver, dbString *path, int npaths, dbHandle **handles, int *count)
00012 {
00013     int ret_code;
00014     int i;
00015     dbHandle *h;
00016 
00017 /* start the procedure call */
00018     db__set_protocol_fds (driver->send, driver->recv);
00019     DB_START_PROCEDURE_CALL(DB_PROC_LIST_DATABASES);
00020 
00021 /* arguments */
00022     DB_SEND_STRING_ARRAY(path, npaths);
00023 
00024 /* get the return code for the procedure call */
00025     DB_RECV_RETURN_CODE(&ret_code);
00026 
00027     if (ret_code != DB_OK)
00028         return ret_code; /* ret_code SHOULD == DB_FAILED */
00029 
00030 /* results */
00031     DB_RECV_INT(count);
00032     h = db_alloc_handle_array(*count);
00033     for (i = 0; i < *count; i++)
00034     {
00035         DB_RECV_HANDLE (&h[i]);
00036     }
00037     *handles = h;
00038 
00039     return DB_OK;
00040 }

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