columnIndex method missing from DBXResultSet

7 views
Skip to first unread message

Michael Roland

unread,
Aug 15, 2014, 4:21:59 PM8/15/14
to dbx...@googlegroups.com
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'.

Reply all
Reply to author
Forward
0 new messages