LCOV - code coverage report
Current view: top level - clients/odbc/driver - SQLNumParams.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 7 9 77.8 %
Date: 2024-04-26 00:35:57 Functions: 0 0 -

          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             :  * SQLNumParams()
      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             : 
      36             : SQLRETURN SQL_API
      37             : SQLNumParams(SQLHSTMT StatementHandle,
      38             :              SQLSMALLINT *ParameterCountPtr)
      39             : {
      40           1 :         ODBCStmt *stmt = (ODBCStmt *) StatementHandle;
      41             : 
      42             : #ifdef ODBCDEBUG
      43           1 :         ODBCLOG("SQLNumParams %p\n", StatementHandle);
      44             : #endif
      45             : 
      46           1 :         if (!isValidStmt(stmt))
      47             :                  return SQL_INVALID_HANDLE;
      48             : 
      49           1 :         clearStmtErrors(stmt);
      50             : 
      51             :         /* check statement cursor state, query should be prepared or executed */
      52           1 :         if (stmt->State == INITED) {
      53             :                 /* Function sequence error */
      54           0 :                 addStmtError(stmt, "HY010", NULL, 0);
      55           0 :                 return SQL_ERROR;
      56             :         }
      57             : 
      58           1 :         *ParameterCountPtr = stmt->ImplParamDescr->sql_desc_count;
      59           1 :         return SQL_SUCCESS;
      60             : }

Generated by: LCOV version 1.14