Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
resultset.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file resultset.h
1
/*
2
This file is part of libodbc++.
3
4
Copyright (C) 1999-2000 Manush Dodunekov <manush@stendahls.net>
5
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Library General Public
8
License as published by the Free Software Foundation; either
9
version 2 of the License, or (at your option) any later version.
10
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Library General Public License for more details.
15
16
You should have received a copy of the GNU Library General Public License
17
along with this library; see the file COPYING. If not, write to
18
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
Boston, MA 02111-1307, USA.
20
*/
21
22
#ifndef __ODBCXX_RESULTSET_H
23
#define __ODBCXX_RESULTSET_H
24
25
#include <
RDBC/odbc++/setup.h
>
26
#include <
RDBC/odbc++/types.h
>
27
#include <
RDBC/odbc++/errorhandler.h
>
28
#include <
RDBC/odbc++/statement.h
>
29
30
31
namespace
odbc {
32
33
class
ResultSetMetaData;
34
class
Statement;
35
class
Rowset;
36
38
class
ODBCXX_EXPORT
ResultSet
:
public
ErrorHandler
{
39
friend
class
Statement
;
40
friend
class
ResultSetMetaData
;
41
42
private
:
43
Statement
*
statement_
;
44
SQLHSTMT
hstmt_
;
45
bool
ownStatement_
;
46
47
48
int
currentFetchSize_
;
49
int
newFetchSize_
;
50
51
Rowset*
rowset_
;
52
SQLUSMALLINT*
rowStatus_
;
53
SQLUINTEGER
rowsInRowset_
;
54
55
//tells us if the columns are bound right now
56
bool
colsBound_
;
57
bool
streamedColsBound_
;
58
59
//the position in the rowset last time we did a bind
60
unsigned
int
bindPos_
;
61
62
//meta data - it's always there since we need info from it
63
ResultSetMetaData
*
metaData_
;
64
65
int
location_
;
66
67
bool
lastWasNull_
;
68
69
int
rowBeforeInsert_
;
70
int
locBeforeInsert_
;
71
72
ResultSet
(
Statement
* stmt,SQLHSTMT hstmt,
bool
ownStmt);
73
74
//driver info
75
const
DriverInfo*
_getDriverInfo
()
const
{
76
return
statement_->_getDriverInfo();
77
}
78
79
//private utils
80
void
_applyFetchSize();
81
//this makes sure there is a rowset
82
void
_resetRowset();
83
84
//this should be called before any call to SQLExtendedFetch
85
void
_prepareForFetch();
86
//this performs a possibly scrolled fetch with fetchType to rownum
87
void
_doFetch(
int
fetchType,
int
rowNum);
88
89
//this should be called after the position in the rowset changes
90
SQLRETURN _applyPosition(
int
mode
=SQL_POSITION);
91
92
//these bind/unbind all non-streamed columns
93
void
_bindCols();
94
void
_unbindCols();
95
96
//these bind/unbind all streamed columns
97
void
_bindStreamedCols();
98
void
_unbindStreamedCols();
99
100
//this sends all needed data from streamed columns
101
//to be called from insertRow and updateRow
102
void
_handleStreams(SQLRETURN
r
);
103
104
105
public
:
107
virtual
~
ResultSet
();
108
109
//remember to update DatabaseMetaData when changing those values
110
113
enum
{
115
CONCUR_READ_ONLY
,
117
CONCUR_UPDATABLE
118
};
119
120
123
enum
{
125
TYPE_FORWARD_ONLY
,
129
TYPE_SCROLL_INSENSITIVE
,
131
TYPE_SCROLL_SENSITIVE
132
};
133
140
bool
absolute(
int
row);
141
147
bool
relative(
int
rows
);
148
150
void
afterLast();
151
153
void
beforeFirst();
154
156
bool
isAfterLast();
157
159
bool
isBeforeFirst();
160
162
bool
isFirst();
163
166
bool
isLast();
167
172
int
getRow
();
173
177
bool
next
();
178
182
bool
previous();
183
187
bool
first();
188
192
bool
last();
193
199
void
moveToInsertRow();
200
204
void
moveToCurrentRow();
205
207
void
refreshRow();
208
210
void
deleteRow();
211
216
void
insertRow();
217
219
void
updateRow();
220
222
void
cancelRowUpdates();
223
227
ResultSetMetaData
*
getMetaData
() {
228
return
metaData_;
229
}
230
232
int
findColumn(
const
ODBCXX_STRING
& colName);
233
235
bool
rowDeleted();
236
238
bool
rowInserted();
239
241
bool
rowUpdated();
242
244
int
getType();
245
247
int
getConcurrency();
248
249
251
int
getFetchSize
() {
252
return
newFetchSize_;
253
}
254
256
void
setFetchSize(
int
fetchSize);
257
259
ODBCXX_STRING
getCursorName();
260
262
Statement
*
getStatement
() {
263
return
statement_;
264
}
265
269
double
getDouble(
int
idx
);
270
274
bool
getBoolean(
int
idx
);
275
279
signed
char
getByte(
int
idx
);
280
285
ODBCXX_BYTES
getBytes(
int
idx
);
286
290
Date
getDate(
int
idx
);
291
295
float
getFloat(
int
idx
);
296
300
int
getInt(
int
idx
);
301
305
Long getLong(
int
idx
);
306
310
short
getShort(
int
idx
);
311
315
ODBCXX_STRING
getString(
int
idx
);
316
320
Time
getTime(
int
idx
);
321
325
Timestamp
getTimestamp(
int
idx
);
326
330
double
getDouble(
const
ODBCXX_STRING
& colName);
331
335
bool
getBoolean(
const
ODBCXX_STRING
& colName);
336
340
signed
char
getByte(
const
ODBCXX_STRING
& colName);
341
342
346
ODBCXX_BYTES
getBytes(
const
ODBCXX_STRING
& colName);
347
351
Date
getDate(
const
ODBCXX_STRING
& colName);
352
356
float
getFloat(
const
ODBCXX_STRING
& colName);
357
361
int
getInt(
const
ODBCXX_STRING
& colName);
362
366
Long getLong(
const
ODBCXX_STRING
& colName);
367
371
short
getShort(
const
ODBCXX_STRING
& colName);
372
376
ODBCXX_STRING
getString(
const
ODBCXX_STRING
& colName);
377
381
Time
getTime(
const
ODBCXX_STRING
& colName);
382
386
Timestamp
getTimestamp(
const
ODBCXX_STRING
& colName);
387
388
396
ODBCXX_STREAM
* getAsciiStream(
int
idx
);
397
405
ODBCXX_STREAM
* getAsciiStream(
const
ODBCXX_STRING
& colName);
406
414
ODBCXX_STREAM
* getBinaryStream(
int
idx
);
415
423
ODBCXX_STREAM
* getBinaryStream(
const
ODBCXX_STRING
& colName);
424
428
bool
wasNull
() {
429
return
lastWasNull_;
430
}
431
436
void
updateDouble(
int
idx
,
double
val);
437
442
void
updateBoolean(
int
idx
,
bool
val);
443
448
void
updateByte(
int
idx
,
signed
char
val);
449
450
455
void
updateBytes(
int
idx
,
const
ODBCXX_BYTES
& val);
456
461
void
updateDate(
int
idx
,
const
Date
& val);
462
467
void
updateFloat(
int
idx
,
float
val);
468
473
void
updateInt(
int
idx
,
int
val);
474
479
void
updateLong(
int
idx
, Long val);
480
485
void
updateShort(
int
idx
,
short
val);
486
491
void
updateString(
int
idx
,
const
ODBCXX_STRING
& val);
492
497
void
updateTime(
int
idx
,
const
Time
& val);
498
503
void
updateTimestamp(
int
idx
,
const
Timestamp
& val);
504
508
void
updateNull(
int
idx
);
509
510
515
void
updateDouble(
const
ODBCXX_STRING
& colName,
double
val);
516
521
void
updateBoolean(
const
ODBCXX_STRING
& colName,
bool
val);
522
527
void
updateByte(
const
ODBCXX_STRING
& colName,
signed
char
val);
528
533
void
updateBytes(
const
ODBCXX_STRING
& colName,
534
const
ODBCXX_BYTES
& val);
535
536
541
void
updateDate(
const
ODBCXX_STRING
& colName,
const
Date
& val);
542
547
void
updateFloat(
const
ODBCXX_STRING
& colName,
float
val);
548
553
void
updateInt(
const
ODBCXX_STRING
& colName,
int
val);
554
559
void
updateLong(
const
ODBCXX_STRING
& colName, Long val);
560
565
void
updateShort(
const
ODBCXX_STRING
& colName,
short
val);
566
571
void
updateString(
const
ODBCXX_STRING
& colName,
const
ODBCXX_STRING
& val);
572
577
void
updateTime(
const
ODBCXX_STRING
& colName,
const
Time
& val);
578
583
void
updateTimestamp(
const
ODBCXX_STRING
& colName,
const
Timestamp
& val);
584
590
void
updateAsciiStream(
int
idx
,
ODBCXX_STREAM
*
s
,
int
len);
591
597
void
updateAsciiStream(
const
ODBCXX_STRING
& colName,
ODBCXX_STREAM
*
s
,
int
len);
598
599
605
void
updateBinaryStream(
int
idx
,
ODBCXX_STREAM
*
s
,
int
len);
606
612
void
updateBinaryStream(
const
ODBCXX_STRING
& colName,
ODBCXX_STREAM
*
s
,
int
len);
613
617
void
updateNull(
const
ODBCXX_STRING
& colName);
618
};
619
620
621
622
};
// namespace odbc
623
624
625
#endif // __ODBCXX_RESULTSET_H
RDBC
blob
master
include
RDBC
odbc++
resultset.h
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:48
using
1.8.2 with
sPHENIX GitHub integration