• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mybatis / ibatis-2 / 730

28 Dec 2025 10:16PM UTC coverage: 65.615% (+0.5%) from 65.146%
730

push

github

web-flow
Update README.md

1602 of 2802 branches covered (57.17%)

5053 of 7701 relevant lines covered (65.61%)

0.66 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

9.88
/src/main/java/com/ibatis/sqlmap/engine/type/ResultGetterImpl.java
1
/*
2
 * Copyright 2004-2025 the original author or authors.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *    https://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package com.ibatis.sqlmap.engine.type;
17

18
import com.ibatis.sqlmap.client.extensions.ResultGetter;
19

20
import java.math.BigDecimal;
21
import java.net.URL;
22
import java.sql.Array;
23
import java.sql.Blob;
24
import java.sql.Clob;
25
import java.sql.Date;
26
import java.sql.Ref;
27
import java.sql.ResultSet;
28
import java.sql.SQLException;
29
import java.sql.Time;
30
import java.sql.Timestamp;
31
import java.util.Calendar;
32
import java.util.Map;
33

34
/**
35
 * A ResultGetter implementation.
36
 */
37
public class ResultGetterImpl implements ResultGetter {
38

39
  /** The rs. */
40
  private ResultSet rs;
41

42
  /** The name. */
43
  private String name;
44

45
  /** The index. */
46
  private int index;
47

48
  /**
49
   * Creates an instance for a PreparedStatement and column index.
50
   *
51
   * @param resultSet
52
   *          - the result set
53
   * @param columnIndex
54
   *          - the column index
55
   */
56
  public ResultGetterImpl(ResultSet resultSet, int columnIndex) {
×
57
    this.rs = resultSet;
×
58
    this.index = columnIndex;
×
59
  }
×
60

61
  /**
62
   * Creates an instance for a PreparedStatement and column name.
63
   *
64
   * @param resultSet
65
   *          - the result set
66
   * @param columnName
67
   *          - the column index
68
   */
69
  public ResultGetterImpl(ResultSet resultSet, String columnName) {
1✔
70
    this.rs = resultSet;
1✔
71
    this.name = columnName;
1✔
72
  }
1✔
73

74
  @Override
75
  public Array getArray() throws SQLException {
76
    if (name != null) {
×
77
      return rs.getArray(name);
×
78
    }
79
    return rs.getArray(index);
×
80
  }
81

82
  @Override
83
  public BigDecimal getBigDecimal() throws SQLException {
84
    if (name != null) {
×
85
      return rs.getBigDecimal(name);
×
86
    }
87
    return rs.getBigDecimal(index);
×
88
  }
89

90
  @Override
91
  public Blob getBlob() throws SQLException {
92
    if (name != null) {
×
93
      return rs.getBlob(name);
×
94
    }
95
    return rs.getBlob(index);
×
96
  }
97

98
  @Override
99
  public boolean getBoolean() throws SQLException {
100
    if (name != null) {
×
101
      return rs.getBoolean(name);
×
102
    }
103
    return rs.getBoolean(index);
×
104
  }
105

106
  @Override
107
  public byte getByte() throws SQLException {
108
    if (name != null) {
×
109
      return rs.getByte(name);
×
110
    }
111
    return rs.getByte(index);
×
112
  }
113

114
  @Override
115
  public byte[] getBytes() throws SQLException {
116
    if (name != null) {
×
117
      return rs.getBytes(name);
×
118
    }
119
    return rs.getBytes(index);
×
120
  }
121

122
  @Override
123
  public Clob getClob() throws SQLException {
124
    if (name != null) {
×
125
      return rs.getClob(name);
×
126
    }
127
    return rs.getClob(index);
×
128
  }
129

130
  @Override
131
  public Date getDate() throws SQLException {
132
    if (name != null) {
×
133
      return rs.getDate(name);
×
134
    }
135
    return rs.getDate(index);
×
136
  }
137

138
  @Override
139
  public Date getDate(Calendar cal) throws SQLException {
140
    if (name != null) {
×
141
      return rs.getDate(name, cal);
×
142
    }
143
    return rs.getDate(index, cal);
×
144
  }
145

146
  @Override
147
  public double getDouble() throws SQLException {
148
    if (name != null) {
×
149
      return rs.getDouble(name);
×
150
    }
151
    return rs.getDouble(index);
×
152
  }
153

154
  @Override
155
  public float getFloat() throws SQLException {
156
    if (name != null) {
×
157
      return rs.getFloat(name);
×
158
    }
159
    return rs.getFloat(index);
×
160
  }
161

162
  @Override
163
  public int getInt() throws SQLException {
164
    if (name != null) {
1!
165
      return rs.getInt(name);
1✔
166
    }
167
    return rs.getInt(index);
×
168
  }
169

170
  @Override
171
  public long getLong() throws SQLException {
172
    if (name != null) {
×
173
      return rs.getLong(name);
×
174
    }
175
    return rs.getLong(index);
×
176
  }
177

178
  @Override
179
  public Object getObject() throws SQLException {
180
    if (name != null) {
×
181
      return rs.getObject(name);
×
182
    }
183
    return rs.getObject(index);
×
184
  }
185

186
  @Override
187
  public Object getObject(Map map) throws SQLException {
188
    if (name != null) {
×
189
      return rs.getObject(name, map);
×
190
    }
191
    return rs.getObject(index, map);
×
192
  }
193

194
  @Override
195
  public Ref getRef() throws SQLException {
196
    if (name != null) {
×
197
      return rs.getRef(name);
×
198
    }
199
    return rs.getRef(index);
×
200
  }
201

202
  @Override
203
  public short getShort() throws SQLException {
204
    if (name != null) {
×
205
      return rs.getShort(name);
×
206
    }
207
    return rs.getShort(index);
×
208
  }
209

210
  @Override
211
  public String getString() throws SQLException {
212
    if (name != null) {
1!
213
      return rs.getString(name);
1✔
214
    }
215
    return rs.getString(index);
×
216
  }
217

218
  @Override
219
  public Time getTime() throws SQLException {
220
    if (name != null) {
×
221
      return rs.getTime(name);
×
222
    }
223
    return rs.getTime(index);
×
224
  }
225

226
  @Override
227
  public Time getTime(Calendar cal) throws SQLException {
228
    if (name != null) {
×
229
      return rs.getTime(name);
×
230
    }
231
    return rs.getTime(index);
×
232
  }
233

234
  @Override
235
  public Timestamp getTimestamp() throws SQLException {
236
    if (name != null) {
×
237
      return rs.getTimestamp(name);
×
238
    }
239
    return rs.getTimestamp(index);
×
240
  }
241

242
  @Override
243
  public Timestamp getTimestamp(Calendar cal) throws SQLException {
244
    if (name != null) {
×
245
      return rs.getTimestamp(name, cal);
×
246
    }
247
    return rs.getTimestamp(index, cal);
×
248
  }
249

250
  @Override
251
  public URL getURL() throws SQLException {
252
    if (name != null) {
×
253
      return rs.getURL(name);
×
254
    }
255
    return rs.getURL(index);
×
256
  }
257

258
  @Override
259
  public boolean wasNull() throws SQLException {
260
    return rs.wasNull();
×
261
  }
262

263
  @Override
264
  public ResultSet getResultSet() {
265
    return rs;
×
266
  }
267

268
  @Override
269
  public int getColumnIndex() {
270
    return index;
×
271
  }
272

273
  @Override
274
  public String getColumnName() {
275
    return name;
×
276
  }
277
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc