The columnIndex method converts a column name to a column index.
DBXResultSet has several methods for getting column information. DBXRow duplicates some of these methods. The methods in DBXRow call the corresponding methods in DBXResultSet, except for columnIndex. columnIndex is available only on DBXRow. In order to use columnIndex, you have to fetch a row from a result set. This is inconvenient if you want to get a column index for use in a loop. You have to special case the first row from the result set.
DBXResultSet contains all the column descriptions. columnIndex should be implemented on DBXResultSet and referenced from DBXRow like the other column related methods in DBXRow. That way you can get a column index before fetching any rows.
Affected versions:
Pharo 3 DBXTalk 1.4.1
Pharo 2 DBXTalk 1.3
Operation Systems: Any that DBXTalk supports.
Original method
DBXRow>>columnIndex: aString
self resultSet columnDescriptions
withIndexDo: [:each :index | (each name sameAs: aString)
ifTrue: [^ index]].
OpenDBXDriverError signal: 'A column with that name was not found'.
--------------------
Replacement methods
DBXRow>>columnIndex: aString
^self resultSet columnIndex: aString
DBXResultSet>>columnIndex: aString
self columnDescriptions
withIndexDo: [:each :index | (each name sameAs: aString)
ifTrue: [^ index]].
OpenDBXDriverError signal: 'A column with that name was not found'.
--
You received this message because you are subscribed to the Google Groups "DBXTalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[hidden email].
For more options, visit
https://groups.google.com/d/optout.