LCOV - code coverage report
Current view: top level - clients/odbc/driver - SQLExtendedFetch.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 16 0.0 %
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             :  * SQLExtendedFetch
      25             :  * CLI Compliance: Deprecated.
      26             :  * In ODBC 3.x, SQLExtendedFetch has been replaced by SQLFetchScroll.
      27             :  *
      28             :  * Author: Martin van Dinther, Sjoerd Mullender
      29             :  * Date  : 30 aug 2002
      30             :  *
      31             :  **********************************************************************/
      32             : 
      33             : #include "ODBCGlobal.h"
      34             : #include "ODBCStmt.h"
      35             : #include "ODBCUtil.h"
      36             : 
      37             : SQLRETURN SQL_API
      38             : SQLExtendedFetch(SQLHSTMT StatementHandle,
      39             :                  SQLUSMALLINT FetchOrientation,
      40             :                  SQLLEN FetchOffset,
      41             : #ifdef BUILD_REAL_64_BIT_MODE   /* note: only defined on Debian Lenny */
      42             :                  SQLUINTEGER  *RowCountPtr,
      43             : #else
      44             :                  SQLULEN *RowCountPtr,
      45             : #endif
      46             :                  SQLUSMALLINT *RowStatusArray)
      47             : {
      48           0 :         ODBCStmt *stmt = (ODBCStmt *) StatementHandle;
      49           0 :         SQLRETURN rc;
      50             : 
      51             : #ifdef ODBCDEBUG
      52           0 :         ODBCLOG("SQLExtendedFetch %p %s " LENFMT " %p %p\n",
      53             :                 StatementHandle,
      54             :                 translateFetchOrientation(FetchOrientation),
      55             :                 LENCAST FetchOffset, RowCountPtr,
      56             :                 RowStatusArray);
      57             : #endif
      58             : 
      59           0 :         if (!isValidStmt(stmt))
      60             :                  return SQL_INVALID_HANDLE;
      61             : 
      62           0 :         clearStmtErrors(stmt);
      63             : 
      64             :         /* check statement cursor state, query should be executed */
      65           0 :         if (stmt->State < EXECUTED0 || stmt->State == FETCHED) {
      66             :                 /* Function sequence error */
      67           0 :                 addStmtError(stmt, "HY010", NULL, 0);
      68           0 :                 return SQL_ERROR;
      69             :         }
      70           0 :         if (stmt->State == EXECUTED0) {
      71             :                 /* Invalid cursor state */
      72           0 :                 addStmtError(stmt, "24000", NULL, 0);
      73           0 :                 return SQL_ERROR;
      74             :         }
      75             : 
      76           0 :         rc = MNDBFetchScroll(stmt, FetchOrientation, FetchOffset,
      77             :                              RowStatusArray);
      78             : 
      79           0 :         if (SQL_SUCCEEDED(rc) || rc == SQL_NO_DATA)
      80           0 :                 stmt->State = EXTENDEDFETCHED;
      81             : 
      82           0 :         if (SQL_SUCCEEDED(rc) && RowCountPtr) {
      83             : #ifdef BUILD_REAL_64_BIT_MODE   /* note: only defined on Debian Lenny */
      84             :                 WriteValue(RowCountPtr, (SQLUINTEGER) stmt->rowSetSize);
      85             : #else
      86           0 :                 WriteValue(RowCountPtr, (SQLULEN) stmt->rowSetSize);
      87             : #endif
      88             :         }
      89             : 
      90             :         return rc;
      91             : }

Generated by: LCOV version 1.14