GRASS 8 Programmer's Manual 8.6.0dev(2026)-4bb960b182
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 * SPDX-FileCopyrightText: 1999-2008 GRASS Development Team
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 *
9 * \author Joel Jones (CERL/UIUC), Radim Blazek
10 */
11
12#include <stdlib.h>
13#include <grass/dbmi.h>
14#include "macros.h"
15#include "dbstubs.h"
16
17/*!
18 \brief Close cursor
19
20 \return DB_OK on success
21 \return DB_FAILED on failure
22 */
24{
26 dbToken token;
27 int stat;
28
29 /* get the arg(s) */
30 DB_RECV_TOKEN(&token);
31 cursor = (dbCursor *)db_find_token(token);
32 if (cursor == NULL) {
33 db_error("** invalid cursor **");
34 return DB_FAILED;
35 }
36
37 /* call the procedure */
39
40 /* get rid of the cursor */
41 db_drop_token(token);
44 db_free(cursor); /* ?? */
45
46 /* send the return code */
47 if (stat != DB_OK) {
49 return DB_OK;
50 }
52
53 /* no results */
54 return DB_OK;
55}
#define NULL
Definition ccmath.h:32
int db_d_close_cursor(void)
Close cursor.
Definition d_close_cur.c:23
Main header of GRASS DataBase Management Interface.
int dbToken
Definition dbmi.h:143
#define DB_FAILED
Definition dbmi.h:70
#define DB_OK
Definition dbmi.h:69
int(* db_driver_close_cursor)(dbCursor *)
dbAddress db_find_token(dbToken)
Find token.
void db_free_cursor(dbCursor *)
Free allocated dbCursor.
Definition cursor.c:48
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