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 : * SQLSetStmtOption() 25 : * CLI Compliance: deprecated in ODBC 3.0 (replaced by SQLSetStmtAttr()) 26 : * Provided here for old (pre ODBC 3.0) applications and driver managers. 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 : 36 : SQLRETURN SQL_API 37 : SQLSetStmtOption(SQLHSTMT StatementHandle, 38 : SQLUSMALLINT Option, 39 : SQLULEN ValuePtr) 40 : { 41 0 : ODBCStmt *stmt = (ODBCStmt *) StatementHandle; 42 : 43 : #ifdef ODBCDEBUG 44 0 : ODBCLOG("SQLSetStmtOption %p %s " ULENFMT "\n", 45 : StatementHandle, translateStmtOption(Option), 46 : ULENCAST ValuePtr); 47 : #endif 48 : 49 0 : if (!isValidStmt(stmt)) 50 : return SQL_INVALID_HANDLE; 51 : 52 0 : clearStmtErrors(stmt); 53 : 54 0 : switch (Option) { 55 : /* only the ODBC 1.0 and ODBC 2.0 options */ 56 0 : case SQL_ROWSET_SIZE: 57 0 : Option = SQL_ATTR_ROW_ARRAY_SIZE; 58 : /* fall through */ 59 0 : case SQL_QUERY_TIMEOUT: 60 : case SQL_MAX_ROWS: 61 : case SQL_NOSCAN: 62 : case SQL_MAX_LENGTH: 63 : case SQL_ASYNC_ENABLE: 64 : case SQL_BIND_TYPE: 65 : case SQL_CURSOR_TYPE: 66 : case SQL_CONCURRENCY: 67 : case SQL_KEYSET_SIZE: 68 : case SQL_SIMULATE_CURSOR: 69 : case SQL_RETRIEVE_DATA: 70 : case SQL_USE_BOOKMARKS: 71 : /* use mapping as described in ODBC 3.0 SDK Help */ 72 0 : return MNDBSetStmtAttr(stmt, 73 : Option, 74 : (SQLPOINTER) (uintptr_t) ValuePtr, 75 : SQL_NTS); 76 0 : default: 77 : /* Invalid attribute/option identifier */ 78 0 : addStmtError(stmt, "HY092", NULL, 0); 79 0 : break; 80 : } 81 : 82 0 : return SQL_ERROR; 83 : }