GRASS 8 Programmer's Manual 8.6.0dev(2026)-1d1e47ad9d
Loading...
Searching...
No Matches
d_close_cur.c
Go to the documentation of this file.
1/*!
2 * \file db/dbmi_driver/d_close_cur.c
3 *
4 * \brief DBMI Library (driver) - close cursor
5 *
6 * (C) 1999-2008 by the GRASS Development Team
7 *
8 * This program is free software under the GNU General Public
9 * License (>=v2). Read the file COPYING that comes with GRASS
10 * for details.
11 *
12 * \author Joel Jones (CERL/UIUC), Radim Blazek
13 */
14
15#include <stdlib.h>
16#include <grass/dbmi.h>
17#include "macros.h"
18#include "dbstubs.h"
19
20/*!
21 \brief Close cursor
22
23 \return DB_OK on success
24 \return DB_FAILED on failure
25 */
27{
29 dbToken token;
30 int stat;
31
32 /* get the arg(s) */
33 DB_RECV_TOKEN(&token);
34 cursor = (dbCursor *)db_find_token(token);
35 if (cursor == NULL) {
36 db_error("** invalid cursor **");
37 return DB_FAILED;
38 }
39
40 /* call the procedure */
42
43 /* get rid of the cursor */
44 db_drop_token(token);
47 db_free(cursor); /* ?? */
48
49 /* send the return code */
50 if (stat != DB_OK) {
52 return DB_OK;
53 }
55
56 /* no results */
57 return DB_OK;
58}
#define NULL
Definition ccmath.h:32
int db_d_close_cursor(void)
Close cursor.
Definition d_close_cur.c:26
Main header of GRASS DataBase Management Interface.
int dbToken
Definition dbmi.h:145
#define DB_FAILED
Definition dbmi.h:72
#define DB_OK
Definition dbmi.h:71
int(* db_driver_close_cursor)(dbCursor *)
dbAddress db_find_token(dbToken)
Find token.
void db_free_cursor(dbCursor *)
Free allocated dbCursor.
Definition cursor.c:51
void db_free(void *)
Free allocated memory.
void db_drop_token(dbToken)
Drop token.
void db_error(const char *)
Report error message.
void db__drop_cursor_from_driver_state(dbCursor *)
Drop cursor from driver state.
#define DB_SEND_SUCCESS()
Definition macros.h:13
#define DB_RECV_TOKEN(x)
Definition macros.h:219
#define DB_SEND_FAILURE()
Definition macros.h:18