File tree Expand file tree Collapse file tree 3 files changed +34
-17
lines changed Expand file tree Collapse file tree 3 files changed +34
-17
lines changed Original file line number Diff line number Diff line change @@ -257,26 +257,31 @@ MySQL_ArtResultSet::isBeforeFirstOrAfterLast() const
257
257
}
258
258
/* }}} */
259
259
260
+ /* {{{ MySQL_ArtResultSet::absolute() -I-
261
+ _new_pos: Seek the passed position on the ResultSet. If _new_pos is negative,
262
+ it will count from last to beginning.
260
263
261
- /* {{{ MySQL_ArtResultSet::absolute() -I- */
264
+ return: true if position is a valid row, false if it pasted last or beginnin
265
+ */
262
266
bool
263
- MySQL_ArtResultSet::absolute (const int row )
267
+ MySQL_ArtResultSet::absolute (const int _row )
264
268
{
265
269
CPP_ENTER (" MySQL_ArtResultSet::absolute" );
266
270
checkValid ();
271
+ const int64_t row = _row;
267
272
if (row > 0 ) {
268
- if (row > ( int ) num_rows) {
273
+ if (row > num_rows) {
269
274
afterLast ();
270
275
} else {
271
276
row_position = row;
272
277
seek ();
273
278
return true ;
274
279
}
275
280
} else if (row < 0 ) {
276
- if (( -row) > ( int ) num_rows) {
281
+ if (-row > num_rows) {
277
282
beforeFirst ();
278
283
} else {
279
- row_position = num_rows - (- row) + 1 ;
284
+ row_position = num_rows + row + 1 ;
280
285
seek ();
281
286
return true ;
282
287
}
Original file line number Diff line number Diff line change @@ -126,27 +126,33 @@ MySQL_Prepared_ResultSet::~MySQL_Prepared_ResultSet()
126
126
}
127
127
/* }}} */
128
128
129
+ /* {{{ MySQL_Prepared_ResultSet::absolute() -I-
130
+ _new_pos: Seek the passed position on the ResultSet. If _new_pos is negative,
131
+ it will count from last to beginning.
129
132
130
- /* {{{ MySQL_Prepared_ResultSet::absolute() -I- */
133
+ return: true if position is a valid row, false if it pasted last or beginnin
134
+ */
131
135
bool
132
- MySQL_Prepared_ResultSet::absolute (const int new_pos )
136
+ MySQL_Prepared_ResultSet::absolute (const int _new_pos )
133
137
{
134
138
CPP_ENTER (" MySQL_Prepared_ResultSet::absolute" );
135
139
checkValid ();
136
140
checkScrollable ();
137
- if (new_pos > 0 ) {
138
- if (new_pos > (int ) num_rows) {
141
+ const int64_t new_pos = _new_pos;
142
+ if (new_pos > 0 )
143
+ {
144
+ if (new_pos > num_rows) {
139
145
row_position = num_rows + 1 ; /* after last row */
140
146
} else {
141
147
row_position = new_pos;
142
148
seek ();
143
149
return true ;
144
150
}
145
151
} else if (new_pos < 0 ) {
146
- if (( -new_pos) > ( int ) num_rows || (new_pos == std::numeric_limits< int >:: min ()) ) {
152
+ if (-new_pos > num_rows) {
147
153
row_position = 0 ; /* before first new_pos */
148
154
} else {
149
- row_position = num_rows - (- new_pos) + 1 ;
155
+ row_position = num_rows + new_pos + 1 ;
150
156
seek ();
151
157
return true ;
152
158
}
Original file line number Diff line number Diff line change @@ -95,26 +95,32 @@ MySQL_ResultSet::~MySQL_ResultSet()
95
95
/* }}} */
96
96
97
97
98
- /* {{{ MySQL_ResultSet::absolute() -I- */
98
+ /* {{{ MySQL_ResultSet::absolute() -I-
99
+ _new_pos: Seek the passed position on the ResultSet. If _new_pos is negative,
100
+ it will count from last to beginning.
101
+
102
+ return: true if position is a valid row, false if it pasted last or beginnin
103
+ */
99
104
bool
100
- MySQL_ResultSet::absolute (const int new_pos )
105
+ MySQL_ResultSet::absolute (const int _new_pos )
101
106
{
102
107
CPP_ENTER (" MySQL_ResultSet::absolute" );
103
108
checkValid ();
104
109
checkScrollable ();
110
+ const int64_t new_pos = _new_pos;
105
111
if (new_pos > 0 ) {
106
- if (new_pos > ( int ) num_rows) {
112
+ if (new_pos > num_rows) {
107
113
row_position = num_rows + 1 ; /* after last row */
108
114
} else {
109
- row_position = (my_ulonglong) new_pos; /* the cast is inspected and is valid */
115
+ row_position = new_pos;
110
116
seek ();
111
117
return true ;
112
118
}
113
119
} else if (new_pos < 0 ) {
114
- if ((-new_pos) > ( int ) num_rows || (new_pos == std::numeric_limits< int >:: min ()) ) {
120
+ if ((-new_pos) > num_rows) {
115
121
row_position = 0 ; /* before first new_pos */
116
122
} else {
117
- row_position = num_rows - (- new_pos) + 1 ;
123
+ row_position = num_rows + new_pos + 1 ;
118
124
seek ();
119
125
return true ;
120
126
}
You can’t perform that action at this time.
0 commit comments