GRASS Programmer's Manual
6.4.3(2013)-r
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Pages
handle.c
Go to the documentation of this file.
1
#include <stdlib.h>
2
#include <grass/dbmi.h>
3
10
void
db_init_handle
(dbHandle * handle)
11
{
12
db_init_string
(&handle->dbName);
13
db_init_string
(&handle->dbSchema);
14
}
15
22
int
db_set_handle
(dbHandle * handle,
const
char
*dbName,
const
char
*dbSchema)
23
{
24
int
stat;
25
26
stat =
db_set_string
(&handle->dbName, dbName);
27
if
(stat != DB_OK)
28
return
stat;
29
stat =
db_set_string
(&handle->dbSchema, dbSchema);
30
return
stat;
31
}
32
39
const
char
*
db_get_handle_dbname
(dbHandle * handle)
40
{
41
return
db_get_string
(&handle->dbName);
42
}
43
50
const
char
*
db_get_handle_dbschema
(dbHandle * handle)
51
{
52
return
db_get_string
(&handle->dbSchema);
53
}
54
61
void
db_free_handle
(dbHandle * handle)
62
{
63
db_free_string
(&handle->dbName);
64
db_free_string
(&handle->dbSchema);
65
}
66
73
void
db_free_handle_array
(dbHandle * handle,
int
count)
74
{
75
int
i;
76
77
if
(handle) {
78
for
(i = 0; i < count; i++)
79
db_free_handle
(&handle[i]);
80
db_free
(handle);
81
}
82
}
83
90
dbHandle *
db_alloc_handle_array
(
int
count)
91
{
92
int
i;
93
dbHandle *handle;
94
95
handle = (dbHandle *)
db_calloc
(count,
sizeof
(dbHandle));
96
if
(handle)
97
for
(i = 0; i < count; i++)
98
db_init_handle
(&handle[i]);
99
return
handle;
100
}
lib
db
dbmi_base
handle.c
Generated on Sat Oct 5 2013 12:11:08 for GRASS Programmer's Manual by
1.8.4