postgres-async-driver icon indicating copy to clipboard operation
postgres-async-driver copied to clipboard

Data access by field index is broken in PgRow.

Open daemas opened this issue 9 years ago • 3 comments

PgRow's get***(int index) methods are broken because the order of columns is messed up in PgRow.columns and PgRow.pgColumns.

daemas avatar Oct 10 '16 17:10 daemas

It worked for me in version 0.6, but after upgrading to a newer version it stopped working. I think this happened because of the replacement of LinkedHashMap with a HashMap in PgConnection class to store information about columns. LinkedHashMap guarantees the order of the inserted elements, while HashMap does not, according to Java specification.

daemas avatar Oct 10 '16 18:10 daemas

I can confirm @daemas findings. I was indeed able to fix this issue by changing the HashMap back to a LinkedHashMap in PgConnection.getColumns().

RyanHoldren avatar Aug 07 '17 23:08 RyanHoldren

https://github.com/alaisi/postgres-async-driver/pull/51

RyanHoldren avatar Aug 13 '17 03:08 RyanHoldren