Module org.jooq
Package org.jooq.impl

Interface QOM.QualifiedRowid

All Superinterfaces:
Field<RowId>, FieldOrConstraint, FieldOrRow, GroupField, Named, OrderField<RowId>, QueryPart, SelectField<RowId>, SelectFieldOrAsterisk, Serializable, Typed<RowId>
Enclosing class:
QOM

public static interface QOM.QualifiedRowid extends Field<RowId>
The ROWID operator.

Get a table.rowid reference from this table.

A rowid value describes the physical location of a row on the disk, which can be used as a replacement for a primary key in some situations - especially within a query, e.g. to self-join a table:

 -- Emulating this MySQL statement...
 DELETE FROM x ORDER BY x.y LIMIT 1

 -- ... in other databases
 DELETE FROM x
 WHERE x.rowid IN (
   SELECT x.rowid FROM x ORDER BY x.a LIMIT 1
 )
 

It is not recommended to use rowid values in client applications as actual row identifiers as the database system may move a row to a different physical location at any time, thus changing the rowid value. In general, use primary keys, instead.

  • Method Details

    • $table

      @NotNull default @NotNull Table<?> $table()
    • $arg1

      Table<?> $arg1()
    • $arg1

      @NotNull default Field<RowId> $arg1(Table<?> newArg1)
    • constructor

      @NotNull @NotNull Function1<? super Table<?>,​? extends Field<RowId>> constructor()
    • transform

      default <T> T transform(Function1<? super Table<?>,​? extends T> function)
    • $traverse

      default <T> T $traverse(Traverser<?,​T> traverser)
      Description copied from interface: QueryPart
      Traverser this QueryPart expression tree using a composable Traverser, producing a result.

      This offers a generic way to traverse expression trees to translate the tree to arbitrary other data structures. The simplest traversal would just count all the tree elements:

       int count = CUSTOMER.NAME.eq(1).$traverse(0, (i, p) -> i + 1);
       

      The same can be achieved by translating the JDK Collector API to the Traverser API using Traversers.collecting(Collector).

       CUSTOMER.NAME.eq(1).$traverse(Traversers.collecting(Collectors.counting()));
       

      Unlike a Collector, a Traverser is optimised for tree traversal, not stream traversal:

      • Is not designed for parallelism
      • It can Traverser.abort() traversal early when the result can be produced early (e.g. when running Traversers.containing(QueryPart), and a result has been found).
      • It can decide whether to Traverser.recurse() into a QueryPart subtree, or whether that is not necessary or even undesirable, e.g. to prevent entering new subquery scopes.
      • Unlike a Collector, which can use its Collector.accumulator() to accumulate each element only once, in tree traversal, it's desirable to be able to distinguish between accumulating an item Traverser.before() or Traverser.after() recursing into it. This is useful e.g. to wrap each tree node in XML opening and closing tags.
      Specified by:
      $traverse in interface QueryPart
    • $replace

      @NotNull default QueryPart $replace(Predicate<? super QueryPart> recurse, Function1<? super QueryPart,​? extends QueryPart> replacement)
      Description copied from interface: QueryPart
      Traverse a QueryPart hierarchy and recursively replace its elements by alternatives.
      Specified by:
      $replace in interface QueryPart
      Parameters:
      recurse - A predicate to decide whether to recurse into a QueryPart subtree.
      replacement - The replacement function. Replacement continues recursively until the function returns null or its input for any given input.