* @return the result of executing the statement
*/
Result getResult(Session session) {
Result resultOut = null;
RowSetNavigator generatedNavigator = null;
PersistentStore store = baseTable.getRowStore(session);
if (generatedIndexes != null) {
resultOut = Result.newUpdateCountResult(generatedResultMetaData,
0);
generatedNavigator = resultOut.getChainedResult().getNavigator();
}
if (isSimpleInsert) {
Type[] colTypes = baseTable.getColumnTypes();
Object[] data = getInsertData(session, colTypes,
insertExpression.nodes[0].nodes);
return insertSingleRow(session, store, data);
}
RowSetNavigator newDataNavigator = queryExpression == null
? getInsertValuesNavigator(session)
: getInsertSelectNavigator(session);
if (newDataNavigator.getSize() > 0) {
insertRowSet(session, generatedNavigator, newDataNavigator);
}
if (baseTable.triggerLists[Trigger.INSERT_AFTER].length > 0) {
baseTable.fireTriggers(session, Trigger.INSERT_AFTER,
newDataNavigator);
}
if (resultOut == null) {
resultOut = new Result(ResultConstants.UPDATECOUNT,
newDataNavigator.getSize());
} else {
resultOut.setUpdateCount(newDataNavigator.getSize());
}
return resultOut;
}