パッケージ org.nkjmlab.sorm4j.sql

インタフェース SelectBuilder

    • メソッドの詳細

      • and

        static SelectBuilder.Condition and​(Object... conds)

        Creates AND condition with concatenating arguments.

        For example,

         and("id=?", "name=?") returns "id=? and name=?"
         
        パラメータ:
        conds - condition in String or Condition
        戻り値:
      • as

        static String as​(String col,
                         String alias)

        Creates AS alias.

        For example,

         as("avg(score)", "avg_score")  returns "avg(score) as avg_score"
         
      • or

        static SelectBuilder.Condition or​(Object... conds)

        Creates OR condition with concatenating arguments.

        For example,

         or("id=?", "name=?") returns "id=? or name=?"
         
      • buildSql

        String buildSql()
        Creates a select SQL statement from the objects.
        戻り値:
      • distinct

        SelectBuilder distinct()
        Add distinct keyword to SQL.
      • from

        SelectBuilder from​(String table)
        Create from clause.

         from("player") returns "from player"
         
        パラメータ:
        table -
        戻り値:
      • groupBy

        SelectBuilder groupBy​(String... columns)
        Create group by clause.
        パラメータ:
        columns -
        戻り値:
      • having

        SelectBuilder having​(String expr)
        Create having clause.
        パラメータ:
        expr -
        戻り値:
      • limit

        SelectBuilder limit​(int limit)
        Create limit clause.
        パラメータ:
        limit -
        戻り値:
      • limit

        SelectBuilder limit​(int limit,
                            int offset)
        Create limit clause with offset.
        パラメータ:
        limit -
        戻り値:
      • orderBy

        SelectBuilder orderBy​(String column,
                              String ascOrDesc)
        Create order by clause.
        パラメータ:
        column -
        ascOrDesc -
        戻り値:
      • select

        SelectBuilder select​(String... columns)
        Create select clause. The default value is "*".

        For example,

         select("id","name","age") returns "select id, name, age"
         
        パラメータ:
        columns -
        戻り値:
      • toPrettyString

        String toPrettyString()
        Create prettified string.
        戻り値:
      • toPrettyString

        String toPrettyString​(boolean prettyPrint)
        Create prettified or plain string.
        パラメータ:
        prettyPrint -
        戻り値:
      • where

        SelectBuilder where​(String expr)
        Create where clause.
        パラメータ:
        expr -
        戻り値: