Beispiel #1
0
 @Override
 public SqlNode transformSelectSqlNode(SqlNode sqlNode, SelectOptions options) {
   if (sqlNode == null) {
     throw new DomaNullPointerException("sqlNode");
   }
   if (options == null) {
     throw new DomaNullPointerException("options");
   }
   SqlNode transformed = sqlNode;
   if (SelectOptionsAccessor.isCount(options)) {
     transformed = toCountCalculatingSqlNode(sqlNode);
   }
   long offset = SelectOptionsAccessor.getOffset(options);
   long limit = SelectOptionsAccessor.getLimit(options);
   if (offset >= 0 || limit >= 0) {
     transformed = toPagingSqlNode(transformed, offset, limit);
   }
   SelectForUpdateType forUpdateType = SelectOptionsAccessor.getForUpdateType(options);
   if (forUpdateType != null) {
     String[] aliases = SelectOptionsAccessor.getAliases(options);
     if (!supportsSelectForUpdate(forUpdateType, false)) {
       switch (forUpdateType) {
         case NORMAL:
           throw new JdbcException(Message.DOMA2023, getName());
         case WAIT:
           throw new JdbcException(Message.DOMA2079, getName());
         case NOWAIT:
           throw new JdbcException(Message.DOMA2080, getName());
         default:
           AssertionUtil.assertUnreachable();
       }
     }
     if (aliases.length > 0) {
       if (!supportsSelectForUpdate(forUpdateType, true)) {
         switch (forUpdateType) {
           case NORMAL:
             throw new JdbcException(Message.DOMA2024, getName());
           case WAIT:
             throw new JdbcException(Message.DOMA2081, getName());
           case NOWAIT:
             throw new JdbcException(Message.DOMA2082, getName());
           default:
             AssertionUtil.assertUnreachable();
         }
       }
     }
     int waitSeconds = SelectOptionsAccessor.getWaitSeconds(options);
     transformed = toForUpdateSqlNode(transformed, forUpdateType, waitSeconds, aliases);
   }
   return transformed;
 }
Beispiel #2
0
 protected AutoModifyQuery(EntityType<E> entityType) {
   AssertionUtil.assertNotNull(entityType);
   this.entityType = entityType;
 }