LCOV - code coverage report
Current view: top level - clients/odbc/driver - SQLGetStmtOption.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 17 0.0 %
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             :  * SQLGetStmtOption()
      25             :  * CLI Compliance: deprecated in ODBC 3.0 (replaced by SQLGetStmtAttr())
      26             :  * Provided here for old (pre ODBC 3.0) applications and driver managers.
      27             :  *
      28             :  * Author: Martin van Dinther, Sjoerd Mullender
      29             :  * Date  : 30 aug 2002
      30             :  *
      31             :  **********************************************************************/
      32             : 
      33             : #include "ODBCGlobal.h"
      34             : #include "ODBCStmt.h"
      35             : #include "ODBCUtil.h"
      36             : 
      37             : SQLRETURN SQL_API
      38             : SQLGetStmtOption(SQLHSTMT StatementHandle,
      39             :                  SQLUSMALLINT Option,
      40             :                  SQLPOINTER ValuePtr)
      41             : {
      42           0 :         ODBCStmt *stmt = (ODBCStmt *) StatementHandle;
      43           0 :         SQLULEN v;
      44           0 :         SQLRETURN r;
      45             : 
      46             : #ifdef ODBCDEBUG
      47           0 :         ODBCLOG("SQLGetStmtOption %p %s %p\n",
      48             :                 StatementHandle, translateStmtOption(Option),
      49             :                 ValuePtr);
      50             : #endif
      51             : 
      52           0 :         if (!isValidStmt(stmt))
      53             :                  return SQL_INVALID_HANDLE;
      54             : 
      55           0 :         clearStmtErrors(stmt);
      56             : 
      57             :         /* only the ODBC 1.0 and ODBC 2.0 options */
      58           0 :         switch (Option) {
      59           0 :         case SQL_ASYNC_ENABLE:
      60             :         case SQL_CONCURRENCY:
      61             :         case SQL_CURSOR_TYPE:
      62             :         case SQL_NOSCAN:
      63             :         case SQL_QUERY_TIMEOUT:
      64             :         case SQL_RETRIEVE_DATA:
      65             :         case SQL_SIMULATE_CURSOR:
      66             :         case SQL_USE_BOOKMARKS:
      67             :         case SQL_ROW_NUMBER:
      68             :                 /* SQLGetStmtAttr returns 64 bit value, but we need to
      69             :                  * return 32 bit value */
      70           0 :                 r = MNDBGetStmtAttr(stmt, Option, &v, 0, NULL);
      71           0 :                 if (SQL_SUCCEEDED(r))
      72           0 :                         WriteData(ValuePtr, (SQLUINTEGER) v, SQLUINTEGER);
      73             :                 return r;
      74           0 :         case SQL_BIND_TYPE:
      75             :         case SQL_KEYSET_SIZE:
      76             :         case SQL_MAX_LENGTH:
      77             :         case SQL_MAX_ROWS:
      78             :         case SQL_ROWSET_SIZE:
      79             : /*              case SQL_GET_BOOKMARKS: is deprecated in ODBC 3.0+ */
      80             :                 /* use mapping as described in ODBC 3.0 SDK Help */
      81           0 :                 return MNDBGetStmtAttr(stmt, Option, ValuePtr, 0, NULL);
      82           0 :         default:
      83             :                 /* Invalid attribute/option identifier */
      84           0 :                 addStmtError(stmt, "HY092", NULL, 0);
      85           0 :                 break;
      86             :         }
      87             : 
      88           0 :         return SQL_ERROR;
      89             : }

Generated by: LCOV version 1.14