Beispiel #1
0
 /**
  * Get or generate a default value for the given column.
  *
  * @param session the session
  * @param column the column
  * @return the value
  */
 public Value getDefaultValue(Session session, Column column) {
   Expression defaultExpr = column.getDefaultExpression();
   Value v;
   if (defaultExpr == null) {
     v = column.validateConvertUpdateSequence(session, null);
   } else {
     v = defaultExpr.getValue(session);
   }
   return column.convert(v);
 }
Beispiel #2
0
 protected Row createRow(Expression[] expr, int rowId) {
   Row newRow = table.getTemplateRow();
   for (int i = 0, len = columns.length; i < len; i++) {
     Column c = columns[i];
     int index = c.getColumnId();
     Expression e = expr[i];
     if (e != null) {
       // e can be null (DEFAULT)
       try {
         Value v = c.convert(e.getValue(session));
         newRow.setValue(index, v);
       } catch (DbException ex) {
         throw setRow(ex, rowId, getSQL(expr));
       }
     }
   }
   return newRow;
 }