Reputation: 475
I'm working in Java and trying to determine something like so:
I have a SqlParameterSource with an array named "ids" in it. I need to determine what type these ids are in, for example numeric or varchar. I specify that earlier in the code with for example:
return con.createArrayOf("varchar")
or
return con.createArrayOf("numeric")
I have tried this:
if (parametersource.getSqlType("ids") == something) {
// do something
}
else {
//do something else
}
I can't figure out how to do this. getSqlType seems to return an int but I don't know what to compare it to to get the correct comparison. There is another method named getTypeName but I don't get how this works.
Upvotes: 0
Views: 804
Reputation: 475
I solved it with:
parameterSource.getValue("objtype").toString();
Fetches the value from "objtype" which I set in my ParameterSource alongside my array to make my end goal easier.
Thanks friends, I love you all. :)
Upvotes: 1
Reputation: 486
If you're talking about Spring SqlParameterSource,try parametersource.getTypeName("ids")
which is inherited from AbstractSqlParameterSource
Upvotes: 0