LCOV - code coverage report
Current view: top level - clients/odbc/driver - SQLCloseCursor.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 5 7 71.4 %
Date: 2021-10-13 02:24:04 Functions: 0 0 -

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

Generated by: LCOV version 1.14