LCOV - code coverage report
Current view: top level - clients/odbc/driver - SQLMoreResults.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 8 17 47.1 %
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             :  * 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           1 :         ODBCStmt *stmt = (ODBCStmt *) StatementHandle;
      40             : 
      41             : #ifdef ODBCDEBUG
      42           1 :         ODBCLOG("SQLMoreResults %p\n", StatementHandle);
      43             : #endif
      44             : 
      45           1 :         if (!isValidStmt(stmt))
      46             :                  return SQL_INVALID_HANDLE;
      47             : 
      48           1 :         clearStmtErrors(stmt);
      49             : 
      50           1 :         if (stmt->State < EXECUTED0)
      51             :                 return SQL_NO_DATA;
      52             : 
      53           1 :         switch (mapi_next_result(stmt->hdl)) {
      54           0 :         case MOK:
      55           0 :                 stmt->State = stmt->queryid >= 0 ? (stmt->State == EXECUTED0 ? PREPARED0 : PREPARED1) : INITED;
      56           0 :                 return SQL_NO_DATA;
      57           0 :         case MERROR:
      58             :                 /* General error */
      59           0 :                 addStmtError(stmt, "HY000", mapi_error_str(stmt->Dbc->mid), 0);
      60           0 :                 return SQL_ERROR;
      61           0 :         case MTIMEOUT:
      62             :                 /* Timeout expired / Communication link failure */
      63           0 :                 addStmtError(stmt, stmt->Dbc->sql_attr_connection_timeout ? "HYT00" : "08S01", mapi_error_str(stmt->Dbc->mid), 0);
      64           0 :                 return SQL_ERROR;
      65           1 :         default:
      66           1 :                 return ODBCInitResult(stmt);
      67             :         }
      68             : }

Generated by: LCOV version 1.14