I have been working with ResultSetList for several years and just today I find myself in the position of having to troubleshoot column names. First, I feel like I'm lucky for having today be the first time after so long.
I know I can just use int value positions in the RSL to get my data, but, it made me realize that there's no way to get the metadata like I can for a standard ResultSet.
I'm assuming that everyone just backs off to using the core ResultSet in those scenarios? That implies ALSO moving away from the stock DB Element as well, which is also somewhat annoying just to be able to interrogate the Column Names.
I get the benefits of having the slimmer RSL object, and I'll work around it, but it seems like an oversight to not include the scenario where someone might want/need to interrogate the underlying RS metadata.
I don't think there's a way to determine the column names from a
To get around this, I've created a studio element with a repeatable
setting, where one can can specify the column names they'd like
retrieved from the ResultSetList. I also Settings where the user can
specify the name of the ResultSetList and the row number they'd like to
Usually, the developer is writing the query in the Database Element, so
they know the names of the columns they want to access.
There isn't a way through the ResultSetList directly, I went through the JavaDocs and even peeked into the elements.jar itself and there's no built-in way to get at this.
I've built similar elements to what you're describing but am trying to stick with the stock elements for the folks that I am working with as much as possible because as we all know, no matter how many use cases you program to, the customer will always come up with some later on that weren't in the original spec and aren't accounted for. (And maybe you are following someone else into a project and they hard coded queries into their Elements and didn't leave the source code behind... but I digress)
The scenario in this case was that even though the query was explicitly naming columns as lowercase, the DB sever (DB2) was forcing the ResultSet to uppercase and ignoring the query syntax.
I solved the issue by guessing that was what was happening - but I hate guessing, even if I know I'm right.
I could also have extended the ResultSetList class to get at the underlying HashMap and ArrayList attributes to see into the data structures that way, but this post was mostly just an observation that it seems like having some helpful code-level validations tools would be very useful, especially around the topic of DB's.
yes, many years ago someone had the same issue with an Oracle DB. Column
names were coming back upper-case.