Commit 58744a69 authored by Nico Mack's avatar Nico Mack

Fixed an issue with queries returning a single value and failing to

update result vector.
parent 0479ec85
......@@ -379,6 +379,26 @@ public class SqlExecutor extends Executor {
return columnTypes;
}
// ---------------------------------------------------------------------------
private void setVector(VectorVariable<?> vector, int columnIndex) {
// Suspend notification of input change listeners while populating vector
vector.suspendListenerNotification(true);
vector.clear();
for (Object[] values : columnValues) {
Object value = values[columnIndex];
vector.add(value);
}
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Result <- {} = {}", vector.getName(), vector.getValue()); //$NON-NLS-1$
}
vector.suspendListenerNotification(false);
vector.notifyInputChangeListeners();
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Class Body *
......@@ -488,33 +508,24 @@ public class SqlExecutor extends Executor {
if (variable instanceof VectorVariable) {
VectorVariable<?> vector = (VectorVariable<?>) variable;
// Suspend notification of input change listeners while populating vector
variable.suspendListenerNotification(true);
vector.clear();
for (Object[] values : columnValues) {
Object value = values[index];
vector.add(value);
}
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Result <- {} = {}", variable.getName(), variable.getValue()); //$NON-NLS-1$
}
variable.suspendListenerNotification(false);
vector.notifyInputChangeListeners();
this.setVector(vector, index);
} else {
LOGGER.warn("Query returned multiple rows but specified variable {} is scalar!", variable.getName()); //$NON-NLS-1$
}
} else {
// Column value is a scalar
if (columnValues.size() > 0) {
if (!columnValues.isEmpty()) {
Object[] values = columnValues.get(0);
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Result <- {} = {}", variable.getName(), values[index]); //$NON-NLS-1$
}
variable.setValueFromObject(values[index]);
if (variable instanceof VectorVariable) {
VectorVariable<?> vector = (VectorVariable<?>) variable;
this.setVector(vector, index);
} else {
variable.setValueFromObject(values[index]);
}
} else {
LOGGER.info("Query returned no results!"); //$NON-NLS-1$
if (variable instanceof VectorVariable) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment