| Author |
rs.getString index start @ 1
|
Ramdas Sawant
Ranch Hand
Joined: Aug 08, 2005
Posts: 51
|
|
|
Just wondering, why the index starts at 1 while using "java.sql.ResultSet.getString()" from JDBC API
|
If you think you can, you can. If you think you can't, you are right.
|
 |
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
|
|
Ramdas Sawant wrote:Just wondering, why the index starts at 1 while using "java.sql.ResultSet.getString()" from JDBC API
Ok, then where should it start from ? Just do not get confused with array index and tables column index.
|
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
|
 |
Ramdas Sawant
Ranch Hand
Joined: Aug 08, 2005
Posts: 51
|
|
|
What I really meant is why there is lack of consistency... What could have happened if table col index starts at 0 ??
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
It's a design decision, probably inspired by stored procedures in database systems that also start at 1. It's not that big of a deal as long as you remember the different offset.
Offtopic: if you want inconsistency, check out Calendar.JANUARY and Calendar.SUNDAY. Same class, two different offsets.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Ramdas Sawant
Ranch Hand
Joined: Aug 08, 2005
Posts: 51
|
|
Thanks Rob... Just made sure there is no computer science fundamental involved here
|
 |
 |
|
|
subject: rs.getString index start @ 1
|
|
|