Fork me on GitHub
#sql
<
2021-06-21
>
Ben Sless17:06:11

Looks like my builder macro worked. So now for some more black magic - can I make any assumptions regarding the order in which the columns return? getObject(String) is slower than getObject(int)

seancorfield17:06:23

@ben.sless Well, the columns are in a particular order — the “natural” query order — but your builder can’t know that without going into the ResultSetMetaData and getting the column names (which seems to be part of what you are trying to avoid).

Ben Sless17:06:24

Maybe I can do it once then cache the result, unless that can theoretically change every time I run the query? My queries are pretty static, if it makes any difference

seancorfield17:06:16

The order should match the query.

Ben Sless17:06:36

tell me about it

seancorfield17:06:09

select’ing explicit column names is going to be better/faster than * (which requires some level of introspection).

seancorfield17:06:31

(on both sides of the SQL/JDBC boundary!)

Ben Sless17:06:03

I'm aiming at minimal friction with the existing code base

Ben Sless17:06:22

But it looks like * returns the columns in the order they are specified when creating the table

Ben Sless17:06:47

cooking with gas / 10