예제 #1
0
파일: Table.java 프로젝트: pologood/Lealone
 /**
  * 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);
 }
예제 #2
0
파일: Merge.java 프로젝트: pologood/Lealone
 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;
 }