Hi,

I'm using ultraliteJ version: 12.0.1 ebf: 3605. I got a problem when I try to get the ordinal position of a duplicated column when the table on the query has an alias. Below I will give some examples to explain it more:

My query: "SELECT idState, idState as state2 FROM bzState s" -> If I try to use this sentence rs.getOrdinal("idState"); (after executing and fetching the row) I get the error -143 (column not found). And if I remove the table alias (in my case the 's' value) the getOrdinal works without a problem.

Is there a limitation on ultraliteJ on this case?

tks

asked 17 May '12, 15:08

Renato's gravatar image

Renato
2266614
accept rate: 0%

Your using the ResultSet interface, I guess.

What happens when you call

rs.getOrdinal("state2");

does this work as expected? I'm not aware if you can add table names here, too, such as rs.getOrdinal("s.idState");...

(18 May '12, 05:59) Volker Barth

The "rs.getOrdinal("state2");" works just fine with the table alias. If I use the "s.idState" I get the same error as before, but I have figure out a workaround. In the "getOrdinal" method, I have to use the prefix "<table_name>." to get the right position of the "idState".

So in this query "SELECT idState, idState as state2 FROM bzState s" If I want to get the position of the first column I must retrieve with "rs.getOrdinal("bzState.idState");".

I don't know why this happens, but for now I will have to use it.

(18 May '12, 13:03) Renato

Renato,

That would seem to be a problem with the UltraLite C runtime. I expect the same result would occur if you used ULResultSetSchema::GetCoulmnID in the UltraLite C++ API. (This is what UltraLiteJ on Android uses).

Another workaround I could suggest is changing your query to

SELECT idState as state1, idState as state2 FROM bzState s
You could then retrieve the position of the first column with
rs.getOrdinal("state1")

I will add the issue to a list to investigate, but it will be low priority since there are workarounds.

permanent link

answered 18 May '12, 13:55

Andy%20Quick's gravatar image

Andy Quick
2.2k2737
accept rate: 45%

Hello, I had the same problem, but in my case I needed a table alias to do a join. I fixed my problem changing the table alias for the name of table, for example:

SELECT bzState.idState, bzState.idState as state2 FROM bzState
permanent link

answered 10 May '13, 07:23

Helton%20Isac's gravatar image

Helton Isac
11
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×75
×60
×16

question asked: 17 May '12, 15:08

question was seen: 1,490 times

last updated: 10 May '13, 07:23