LCOV - code coverage report
Current view: top level - clients/odbc/driver - SQLMoreResults.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 12 19 63.2 %
Date: 2024-11-11 20:03:36 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             :  * SQLMoreResults()
      25             :  * CLI Compliance: ODBC (Microsoft)
      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             : SQLMoreResults(SQLHSTMT StatementHandle)
      38             : {
      39           7 :         ODBCStmt *stmt = (ODBCStmt *) StatementHandle;
      40           7 :         long timeout;
      41             : 
      42             : #ifdef ODBCDEBUG
      43           7 :         ODBCLOG("SQLMoreResults %p\n", StatementHandle);
      44             : #endif
      45             : 
      46           7 :         if (!isValidStmt(stmt))
      47             :                  return SQL_INVALID_HANDLE;
      48             : 
      49           7 :         clearStmtErrors(stmt);
      50             : 
      51           7 :         if (stmt->State < EXECUTED0)
      52             :                 return SQL_NO_DATA;
      53             : 
      54           7 :         switch (mapi_next_result(stmt->hdl)) {
      55           6 :         case MOK:
      56           6 :                 stmt->State = stmt->queryid >= 0 ? (stmt->State == EXECUTED0 ? PREPARED0 : PREPARED1) : INITED;
      57           6 :                 return SQL_NO_DATA;
      58           0 :         case MERROR:
      59             :                 /* General error */
      60           0 :                 addStmtError(stmt, "HY000", mapi_error_str(stmt->Dbc->mid), 0);
      61           0 :                 return SQL_ERROR;
      62           0 :         case MTIMEOUT:
      63             :                 /* Connection timeout expired / Communication link failure */
      64           0 :                 timeout = msetting_long(stmt->Dbc->settings, MP_REPLY_TIMEOUT);
      65           0 :                 addStmtError(stmt, timeout > 0 ? "HYT01" : "08S01", mapi_error_str(stmt->Dbc->mid), 0);
      66           0 :                 return SQL_ERROR;
      67           1 :         default:
      68           1 :                 return ODBCInitResult(stmt);
      69             :         }
      70             : }

Generated by: LCOV version 1.14