After making some minor change to my code, my application started to behave in a most unexpected way. The seemingly innocuous change I made was to access data by field name rather than by a column number, as I was not sure the order in which the columns were returned by a fetch. So, I made the change from e.g. :-
Code: Select all
X = getValueValue(1)
Code: Select all
X = getValueByName("test")
Code: Select all
predicates
tryGetColumnNumberFromName : (string ColumnName) -> fieldIndex ColumnNumber
determ.
clauses
tryGetColumnNumberFromName(ColumnName) = ColumnNumber :-
columnNameNumber_fact(string::toLowerCase(ColumnName), ColumnNumber),
!.
tryGetColumnNumberFromName(ColumnName) = ColumnNumber :-
Max = numResultCols(),
ColumnNumber = std::fromTo(columnNumberRead + 1, Max),
ColumnNameOut = colAttribute_string(ColumnNumber,
odbc_native::sql_desc_name),
assert(columnNameNumber_fact(string::toLowerCase(ColumnName),
ColumnNumber)), %The variable ColumnName should have been ColumnNameOut
string::equalCaseNeutral(ColumnName, ColumnNameOut),
!,
columnNumberRead := ColumnNumber.
tryGetColumnNumberFromName(_ColumnName) = _ :-
columnNumberRead := numResultCols(),
fail.