1 /*********************************************************************
2 *
3 * unixODBC Cursor Library
4 *
5 * Created by Nick Gorham
6 * (nick@lurcher.org).
7 *
8 * copyright (c) 1999 Nick Gorham
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 **********************************************************************
25 *
26 * $Id: SQLSetPos.c,v 1.4 2009/02/18 17:59:18 lurcher Exp $
27 *
28 * $Log: SQLSetPos.c,v $
29 * Revision 1.4 2009/02/18 17:59:18 lurcher
30 * Shift to using config.h, the compile lines were making it hard to spot warnings
31 *
32 * Revision 1.3 2007/11/13 15:04:57 lurcher
33 * Fix 64 bit cursor lib issues
34 *
35 * Revision 1.2 2002/11/19 18:52:28 lurcher
36 *
37 * Alter the cursor lib to not require linking to the driver manager.
38 *
39 * Revision 1.1.1.1 2001/10/17 16:40:15 lurcher
40 *
41 * First upload to SourceForge
42 *
43 * Revision 1.1.1.1 2000/09/04 16:42:52 nick
44 * Imported Sources
45 *
46 * Revision 1.1 1999/09/19 22:22:51 ngorham
47 *
48 *
49 * Added first cursor library work, read only at the moment and only works
50 * with selects with no where clause
51 *
52 *
53 **********************************************************************/
54
55 #include <config.h>
56 #include "cursorlibrary.h"
57
CLSetPos(SQLHSTMT statement_handle,SQLSETPOSIROW irow,SQLUSMALLINT foption,SQLUSMALLINT flock)58 SQLRETURN CLSetPos(
59 SQLHSTMT statement_handle,
60 SQLSETPOSIROW irow,
61 SQLUSMALLINT foption,
62 SQLUSMALLINT flock )
63 {
64 CLHSTMT cl_statement = (CLHSTMT) statement_handle;
65
66 /*
67 * this is implemented by the cursor lib
68 */
69
70 if ( irow == 0 )
71 {
72 /*
73 * one day maybe, but what do you want, blood ?
74 */
75 cl_statement -> cl_connection -> dh.__post_internal_error( &cl_statement -> dm_statement -> error,
76 ERROR_HYC00, NULL,
77 cl_statement -> dm_statement -> connection ->
78 environment -> requested_version );
79 }
80 else if ( irow > cl_statement -> rowset_array_size )
81 {
82 cl_statement -> cl_connection -> dh.__post_internal_error( &cl_statement -> dm_statement -> error,
83 ERROR_S1107, NULL,
84 cl_statement -> dm_statement -> connection ->
85 environment -> requested_version );
86 }
87 else if ( foption != SQL_POSITION || flock != SQL_LOCK_NO_CHANGE )
88 {
89 cl_statement -> cl_connection -> dh.__post_internal_error( &cl_statement -> dm_statement -> error,
90 ERROR_HYC00, NULL,
91 cl_statement -> dm_statement -> connection ->
92 environment -> requested_version );
93 }
94
95 cl_statement -> cursor_pos = irow;
96
97 return SQL_SUCCESS;
98 }
99