Line data Source code
1 : /* 2 : * SPDX-License-Identifier: MPL-2.0 3 : * 4 : * This Source Code Form is subject to the terms of the Mozilla Public 5 : * License, v. 2.0. If a copy of the MPL was not distributed with this 6 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 : * 8 : * Copyright 2024 MonetDB Foundation; 9 : * Copyright August 2008 - 2023 MonetDB B.V.; 10 : * Copyright 1997 - July 2008 CWI. 11 : */ 12 : 13 : /* 14 : * This code was created by Peter Harvey (mostly during Christmas 98/99). 15 : * This code is LGPL. Please ensure that this message remains in future 16 : * distributions and uses of this code (thats about all I get out of it). 17 : * - Peter Harvey pharvey@codebydesign.com 18 : * 19 : * This file has been modified for the MonetDB project. See the file 20 : * Copyright in this directory for more information. 21 : */ 22 : 23 : /********************************************************************** 24 : * SQLCloseCursor() 25 : * CLI Compliance: ISO 92 26 : * 27 : * Author: Martin van Dinther, Sjoerd Mullender 28 : * Date : 30 Aug 2002 29 : * 30 : **********************************************************************/ 31 : 32 : #include "ODBCGlobal.h" 33 : #include "ODBCStmt.h" 34 : 35 : SQLRETURN SQL_API 36 : SQLCloseCursor(SQLHSTMT StatementHandle) 37 : { 38 85 : ODBCStmt *stmt = (ODBCStmt *) StatementHandle; 39 : 40 : #ifdef ODBCDEBUG 41 85 : ODBCLOG("SQLCloseCursor %p\n", StatementHandle); 42 : #endif 43 : 44 85 : if (!isValidStmt(stmt)) 45 : return SQL_INVALID_HANDLE; 46 : 47 85 : clearStmtErrors(stmt); 48 : 49 : /* Check if the statement has a cursor (State = EXECUTED1) 50 : else this function should not have been called */ 51 85 : if (stmt->State < EXECUTED1) { 52 : /* Invalid cursor state */ 53 0 : addStmtError(stmt, "24000", NULL, 0); 54 0 : return SQL_ERROR; 55 : } 56 : 57 85 : return MNDBFreeStmt(stmt, SQL_CLOSE); 58 : }