The local variable abc is never read...!!!!!!!!!
Hi ..pardon me for this stupid and amateur question...
but like when we want certain variables to be declared and somehow we dont use them...what is the standard way of suppressing this warning...is there one prescribed in specifications..?
Comment out the declaration.
> Comment out the declaration.
Yuk! Yuk! Bad!
Delete it. If it isn't needed, get rid of it. If you're keeping it there because you might need it later, delete it anyway and recover it from your version control system when the time comes. You do use a version control system don't you?!
well thats what i cant do....i mean i have to declare the variable ....it could be one of those reqts like you have to get all the values returned by a resultset in the proper order.....though you may not use one of them.....so you have to do something like
int temp=rs.getInt("val");
and you would not be using this temp anywhere but you have to get it from the resultSet
> well thats what i cant do....i mean i have to declare
> the variable ....it could be one of those reqts like
> you have to get all the values returned by a
> resultset in the proper order.....though you may not
> use one of them.....so you have to do something like
>
>
> int temp=rs.getInt("val");
>
> and you would not be using this temp anywhere but you
> have to get it from the resultSet
do
rs.getInt("val");
instead of
int temp = rs.getInt("val");
Edit: Although nothing requires you to read the column. If you don't need it don't read it, or better yet leave it out of the query altogether.
> > Comment out the declaration.
>
> Yuk! Yuk! Bad!
>
> Delete it. If it isn't needed, get rid of it. If
> you're keeping it there because you might need
> it later, delete it anyway and recover it from your
> version control system when the time comes. You
> do use a version control system don't you?!
It's called sarcasm! ;-)
> int temp=rs.getInt("val");
>
> and you would not be using this temp anywhere but you
> have to get it from the resultSet
just delete it, why get data from resultset which you don't need.
> well thats what i cant do....i mean i have to declare
> the variable ....it could be one of those reqts like
> you have to get all the values returned by a
> resultset in the proper order.....though you may not
> use one of them.....so you have to do something like
>
>
> int temp=rs.getInt("val");
>
> and you would not be using this temp anywhere but you
> have to get it from the resultSet
Like george said, if the variable is never read, it's useless! What you're saying makes no sense.
> > > Comment out the declaration.
> >
> > Yuk! Yuk! Bad!
> >
> > Delete it. If it isn't needed, get rid of it. If
> > you're keeping it there because you might
> need
> > it later, delete it anyway and recover it from
> your
> > version control system when the time comes. You
> > do use a version control system don't you?!
>
> It's called sarcasm! ;-)
Oh really? How incredibly interesting
:-)
> well thats what i cant do....i mean i have to declare
> the variable ....it could be one of those reqts like
> you have to get all the values returned by a
> resultset in the proper order.....though you may not
> use one of them.....so you have to do something like
>
>
> int temp=rs.getInt("val");
>
> and you would not be using this temp anywhere but you
> have to get it from the resultSet
Guess your compiler must be lying to you about it never being read, then
well okie correct me if i am wrong....dont you have to read all the values returned by a resultset....more so in the order they are returned by the resultset ..?
> well okie correct me if i am wrong....dont you have
> to read all the values returned by a
> resultset....more so in the order they are returned
> by the resultset ..?
Ok. You're wrong. Even if you did have to, you could read them without bothering to assign them to anything
> > well okie correct me if i am wrong....dont you
> have
> > to read all the values returned by a
> > resultset....more so in the order they are
> returned
> > by the resultset ..?
>
> Ok. You're wrong. Even if you did have to, you could
> read them without bothering to assign them to anything
See reply four, which had already covered both points, and added a third (remove it from the query).
> > > well okie correct me if i am wrong....dont you
> > have
> > > to read all the values returned by a
> > > resultset....more so in the order they are
> > returned
> > > by the resultset ..?
> >
> > Ok. You're wrong. Even if you did have to, you
> could
> > read them without bothering to assign them to
> anything
>
> See reply four, which had already covered both
> points, and added a third (remove it from the query).
Oh yeh!
> well okie correct me if i am wrong....dont you have
> to read all the values returned by a
> resultset....more so in the order they are returned
> by the resultset ..?
I think what you are getting at the bold caption is the phrase in the API doc that says that you should read each column only once and in the order that they are returned, as the Driver is not required to provide anything more flexibility than that.
That does not mean that you need to read every column, though.
hmm okie that was exactly what the confusion was..!!!
that means we can skip the columns but yet have to maintain the order
thanks :)
> hmm okie that was exactly what the confusion
> was..!!!
> that means we can skip the columns but yet have to
> maintain the order
>
> thanks :)
Not necessarily have to, but definately should. Most Drivers give you full flexibilty to read multiple times and in any order you want to, but they are not required to.