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

Generated by: LCOV version 1.14