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

Generated by: LCOV version 1.14