GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
handle.c File Reference

DBMI Library (base) - handle management. More...

#include <stdlib.h>
#include <grass/dbmi.h>
Include dependency graph for handle.c:

Go to the source code of this file.

Functions

void db_init_handle (dbHandle *handle)
 Initialize handle (i.e database/schema) More...
 
int db_set_handle (dbHandle *handle, const char *dbName, const char *dbSchema)
 Set handle (database and schema name) More...
 
const char * db_get_handle_dbname (dbHandle *handle)
 Get handle database name. More...
 
const char * db_get_handle_dbschema (dbHandle *handle)
 Get handle schema name. More...
 
void db_free_handle (dbHandle *handle)
 Free dbHandle structure. More...
 
void db_free_handle_array (dbHandle *handle, int count)
 Free array of handles. More...
 
dbHandledb_alloc_handle_array (int count)
 Allocate array of handles. More...
 

Detailed Description

DBMI Library (base) - handle management.

(C) 1999-2009 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Joel Jones (CERL/UIUC), Radim Blazek

Definition in file handle.c.

Function Documentation

◆ db_alloc_handle_array()

dbHandle* db_alloc_handle_array ( int  count)

Allocate array of handles.

Parameters
countnumber of handles in the array
Returns
pointer to first dbHandle in the array

Definition at line 109 of file handle.c.

References count, db_calloc(), and db_init_handle().

◆ db_free_handle()

void db_free_handle ( dbHandle handle)

Free dbHandle structure.

Parameters
handlepointer to dbHandle

Definition at line 79 of file handle.c.

References db_free_string(), _db_handle::dbName, and _db_handle::dbSchema.

Referenced by db_d_create_database(), db_d_delete_database(), db_d_find_database(), db_d_open_database(), db_find_database(), and db_free_handle_array().

◆ db_free_handle_array()

void db_free_handle_array ( dbHandle handle,
int  count 
)

Free array of handles.

Parameters
handlepointer to first dbHandle in the array
countnumber of handles in the array

Definition at line 91 of file handle.c.

References count, db_free(), and db_free_handle().

◆ db_get_handle_dbname()

const char* db_get_handle_dbname ( dbHandle handle)

Get handle database name.

Parameters
handlepointer to dbHandle
Returns
pointer to string with database name

Definition at line 57 of file handle.c.

References db_get_string(), and _db_handle::dbName.

Referenced by db_d_open_database(), and db_find_database().

◆ db_get_handle_dbschema()

const char* db_get_handle_dbschema ( dbHandle handle)

Get handle schema name.

Parameters
handlepointer to dbHandle
Returns
pointer to string with schema name

Definition at line 69 of file handle.c.

References db_get_string(), and _db_handle::dbSchema.

Referenced by db_d_open_database(), and db_find_database().

◆ db_init_handle()

void db_init_handle ( dbHandle handle)

Initialize handle (i.e database/schema)

Parameters
handlepointer to dbHandle to be initialized

Definition at line 23 of file handle.c.

References db_init_string(), _db_handle::dbName, and _db_handle::dbSchema.

Referenced by db_alloc_handle_array(), db_d_create_database(), db_d_delete_database(), db_d_find_database(), db_d_open_database(), and db_start_driver_open_database().

◆ db_set_handle()

int db_set_handle ( dbHandle handle,
const char *  dbName,
const char *  dbSchema 
)

Set handle (database and schema name)

Parameters
handlepointer to dbHandle
dbNamedatabase name
dbSchemaschema name
Returns
DB_OK on success
DB_FAILED on failure

Definition at line 39 of file handle.c.

References DB_OK, db_set_string(), _db_handle::dbName, and _db_handle::dbSchema.

Referenced by db_find_database(), and db_start_driver_open_database().