[CONJ-17] "No such column" when getting results by index without alias Created: 2013-02-02 Updated: 2018-07-17 Resolved: 2013-02-03 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | None |
| Affects Version/s: | 1.1.0 |
| Fix Version/s: | 1.1.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Keith Chew | Assignee: | Vladislav Vaintroub |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Tested on Windows and Linux |
||
| Description |
|
Query: Retrieve results using: Problem: public String getColumnName(final int column) throws SQLException { return results; then it works. This is because getColumnInformation(column).getName() returns "count I don't know the code deep enough to tell if the workaround above is the best way to address the issue, please advise. |
| Comments |
| Comment by Vladislav Vaintroub [ 2013-02-02 ] |
|
Hi, And .. what was actually the code leading to exception? Following test actually passes successfully to me (I use "count @Test |
| Comment by Vladislav Vaintroub [ 2013-02-02 ] |
|
After some thinkling.. yes, fixing it to be ConnectorJ compatible won't hurt anyone and would prevent surprises for the users. Thanks for your suggestion! |
| Comment by Keith Chew [ 2013-02-02 ] |
|
Hi Vladislav Hmm, getInt() is throwing the exception for me. I am using v1.1.0, are you using the unreleased v1.2.0? Also, I am using a prepared statement, can you try: PreparedStatement preparedStatement = connection.prepareStatement("select count if you think that makes a difference. Regards |
| Comment by Keith Chew [ 2013-02-02 ] |
|
Hi Vladislav OK, I think I know the problem. I am using p6spy (http://sourceforge.net/projects/p6spy/), which I believe is calling getColumnName() instead of getColumnLabel(). The workaround keeps p6spy happy, so will stick with it for now. Thanks again for your help. Regards |