Decide on 0-based versus 1-based indexes
andygrove opened this issue · 3 comments
So far I've been mimicking ODBC/JDBC in using 1-based indexes in ResultSet and ResultSetMetaData.
I did this to ease the translation of existing ODBC/JDBC code but it feels dirty.
Realistically we will want idiomatic Rust ways of accessing this API using iterators so maybe this low-level API can remain ugly ... I am interested to hear what others think.
I think is better to stick to the idioms of each lang. In rust 0-based is the norm. Also, in rust is ok to do imperative style, not only depending in functional idioms like iterators.
In JDBC indexes for prepare statements started from 1. And it case me a lot of pain. But probably there was some reasoning about it - in SQL you can address columns by indexes, for example select name, status from info order by 1
would order by id
column.
I think that 0 based index is right choice, because you want to address array index from prepared statement and there should be no confusions.