GRASS Programmer's Manual
6.4.2(2012)
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
c_finddb.c
Go to the documentation of this file.
1
15
#include <stdlib.h>
16
#include <grass/dbmi.h>
17
#include "
macros.h
"
18
29
int
db_find_database
(dbDriver *
driver
, dbHandle * handle,
int
*found)
30
{
31
int
ret_code;
32
int
stat;
33
dbHandle temp;
34
35
/* start the procedure call */
36
db__set_protocol_fds
(driver->send, driver->recv);
37
DB_START_PROCEDURE_CALL
(DB_PROC_FIND_DATABASE);
38
39
/* send the arguments to the procedure */
40
DB_SEND_HANDLE
(handle);
41
42
/* get the return code for the procedure call */
43
DB_RECV_RETURN_CODE
(&ret_code);
44
45
if
(ret_code != DB_OK)
46
return
ret_code;
/* ret_code SHOULD == DB_FAILED */
47
48
/* get results */
49
DB_RECV_INT
(found);
50
51
stat = DB_OK;
52
if
(*found) {
53
DB_RECV_HANDLE
(&temp);
54
stat =
db_set_handle
(handle,
55
db_get_handle_dbname
(&temp),
56
db_get_handle_dbschema
(&temp)
57
);
58
db_free_handle
(&temp);
59
}
60
return
stat;
61
}
lib
db
dbmi_client
c_finddb.c
Generated on Sun Mar 16 2014 05:07:42 for GRASS Programmer's Manual by
1.8.1.2