/* * Move the input table to the top of the selection list. */ public static void setPriority(java.util.Vector <Object> inputList, String inputTable) { String tableName; int i; if (inputList == null) { return; } for (i = 0; i < inputList.size(); i++) { tableName = (String)inputList.elementAt(i); if (tableName.equals(inputTable)) { if (i > 0) { inputList.removeElementAt(i); inputList.insertElementAt(tableName, 0); } break; } } }
public bool addRow(TsRow row, bool sortRows) { int i; bool sortUp = true; TsRow sortRow; if (!sortRows) { rows.addElement(row); return(true); } if (orderType != (String)null) { if (orderType.startsWith("DESC")) { sortUp = false; } } /* * Pass the list of ORDER BY columns to the new row to enable * compareTo method. */ row.setOrderBy(orderByColumns); if (rows.size() > 0) { /* * Insert or append the row depending upon the ORDER BY * conditions and a comparison of the new and the existing row. */ if (sortUp) { for (i = rows.size() - 1; i > -1; i--) { sortRow = (TsRow)rows.elementAt(i); if (row.compareTo(sortRow) < 0) { continue; } if (row.compareTo(sortRow) == 0 & distinct) { return(true); } if (i == rows.size() - 1) { rows.addElement(row); } else { rows.insertElementAt(row, i + 1); } return(true); } } else { for (i = rows.size() - 1; i > -1; i--) { sortRow = (TsRow)rows.elementAt(i); if (row.compareTo(sortRow) > 0) { continue; } if (row.compareTo(sortRow) == 0 & distinct) { return(true); } if (i == rows.size() - 1) { rows.addElement(row); } else { rows.insertElementAt(row, i + 1); } return(true); } } rows.insertElementAt(row, 0); return(true); } rows.addElement(row); if ((fetchsize > 0) && (rows.size() >= fetchsize)) { return(false); } return(true); }