LCOV - code coverage report
Current view: top level - clients/odbc/driver - SQLGetEnvAttr.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 10 22 45.5 %
Date: 2024-10-07 21:21:43 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 (that's 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             :  * SQLGetEnvAttr()
      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 "ODBCEnv.h"
      34             : #include "ODBCUtil.h"
      35             : 
      36             : 
      37             : SQLRETURN SQL_API
      38             : SQLGetEnvAttr(SQLHENV EnvironmentHandle,
      39             :               SQLINTEGER Attribute,
      40             :               SQLPOINTER ValuePtr,
      41             :               SQLINTEGER BufferLength,
      42             :               SQLINTEGER *StringLengthPtr)
      43             : {
      44          41 :         ODBCEnv *env = (ODBCEnv *) EnvironmentHandle;
      45             : 
      46             : #ifdef ODBCDEBUG
      47          41 :         ODBCLOG("SQLGetEnvAttr %p %s %p %d %p\n",
      48             :                 EnvironmentHandle,
      49             :                 translateEnvAttribute(Attribute),
      50             :                 ValuePtr, (int) BufferLength,
      51             :                 StringLengthPtr);
      52             : #endif
      53             : 
      54          41 :         (void) BufferLength;    /* Stefan: unused!? */
      55          41 :         (void) StringLengthPtr; /* Stefan: unused!? */
      56             : 
      57          41 :         if (!isValidEnv(env))
      58             :                 return SQL_INVALID_HANDLE;
      59             : 
      60          41 :         clearEnvErrors(env);
      61             : 
      62          41 :         switch (Attribute) {
      63          41 :         case SQL_ATTR_ODBC_VERSION:
      64          41 :                 WriteData(ValuePtr, env->sql_attr_odbc_version, SQLINTEGER);
      65          41 :                 break;
      66           0 :         case SQL_ATTR_OUTPUT_NTS:
      67           0 :                 WriteData(ValuePtr, SQL_TRUE, SQLINTEGER);
      68           0 :                 break;
      69           0 :         case SQL_ATTR_CONNECTION_POOLING:
      70           0 :                 WriteData(ValuePtr, SQL_CP_OFF, SQLUINTEGER);
      71           0 :                 break;
      72           0 :         case SQL_ATTR_CP_MATCH:
      73             :                 /* TODO: implement this function and corresponding behavior */
      74             : 
      75             :                 /* for now return error */
      76             :                 /* Driver does not support this function */
      77           0 :                 addEnvError(env, "IM001", NULL, 0);
      78           0 :                 return SQL_ERROR;
      79           0 :         default:
      80             :                 /* Invalid attribute/option identifier */
      81           0 :                 addEnvError(env, "HY092", NULL, 0);
      82           0 :                 return SQL_ERROR;
      83             :         }
      84             : 
      85             :         return SQL_SUCCESS;
      86             : }

Generated by: LCOV version 1.14