1 28 29 package com.caucho.db.sql; 30 31 import java.sql.SQLException ; 32 33 36 class IntOrder extends Order { 37 private int _column; 38 39 IntOrder(int column) 40 { 41 _column = column; 42 } 43 44 47 public int compare(SelectResult result, int indexA, int indexB) 48 throws SQLException 49 { 50 result.setRow(indexA); 51 52 int valueA = result.getInt(_column); 53 if (result.wasNull()) 54 valueA = Integer.MIN_VALUE; 55 56 result.setRow(indexB); 57 58 int valueB = result.getInt(_column); 59 if (result.wasNull()) 60 valueB = Integer.MIN_VALUE; 61 62 if (valueA < valueB) 63 return isAscending() ? -1 : 1; 64 else if (valueA == valueB) 65 return 0; 66 else 67 return isAscending() ? 1 : -1; 68 } 69 } 70 | Popular Tags |