On 2015-03-01 04:41 PM, Paolo Bolzoni wrote: > Dear everyone, > > I find strange and confusing that bind indexes start from 1 (docs in > [1]) and instead column indexes start from 0 (doc in [2]). Is there > any technical reason or it is just an unlucky legacy?
I'm going to venture a guess here and go with "Unlucky Legacy", but it is not really confusing I think. Please note that column indices start from 1 too when you refer a column or field in the TCL/SQL - a design that might stem from the SQL standard. I observed the same in MySQL or MSSQL etc. (refer ELEMENT() or similar functions) - Only the SQLite API refers to the first column/Index as 0, but the API is a programming API and not a TCL and follows the base way all programming constructs (at least those I am familiar with) such as array indexing, bytes, pointers etc. do it. Where the API needs to refer to SQL/TCL constructs, such as in your example [1], the lines get blurry and the API adapts (which is far better than having the SQL adapt). I'm sure if we had the opportunity to redesign the SQL standard - it might look somewhat different.