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

Generated by: LCOV version 1.14