Review main Merged

83209[FEATURE] Add new expression methods to ExpressionBuilder

Stefan Bürk CR +2 V +2 Expert +1896 −1 updated 03/08/24, 08:34

Commit message

This change adds additional helpful expression methods
to the TYPO3 ExpressionBuilder to allow building more
advanced database queries with cross database vendor
support for supported vendors.

These expression are required for advanced query
building and prepare the future implementation of an
`Common Table Expression` builder API, but can be
helpful in other scopes as well.

This change adds `ExpressionBuilder`

* `->as()` alias a value, field value or
  sub-expression `foo AS identifier`.
* `->concat()` concatenate multiple static
  values or field data into one string.
* `->castVarchar()` allows casting a field or value
   to varchar type with dynamic length.
* `->castInt()` allows casting a field or value to
   integer type.
* `->repeat()` create a string value with x-times
  repeated value.
* `->space()` create a string value with x-times
  of spaces.
* `->left()` create an expression returning a
  sub string of specified length from the left
  side.
* `->right()` create an expression returning a
  sub string of specified length from the right
  side, where sub-expressions can be used for
  length and value.
* `->leftPad()` pad a value or expression to a
  specific length and fill up with specified padding
  value on the left side.
* `->rightPad()` pad a value or expression to
  a specific length and fill up with specified
  padding value on the right side.

The patch covers the implementations with functional
tests.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Anja Leichsenring +1
    • Christian Kuhn +1
    • Benni Mack +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • Anja Leichsenring +1
    • Christian Kuhn +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 7

Review log 2339

Show 714 earlier messages
  1. Stefan Bürk uploaded patch set 1 03/05/24, 09:32

  2. core-ci voted on patch set 1 V +1 03/05/24, 09:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53926

  3. Stefan Bürk uploaded patch set 2 V +1 03/05/24, 12:08

  4. core-ci voted on patch set 2 V -1 03/05/24, 12:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53940

  5. Stefan Bürk uploaded patch set 3 V -1 03/05/24, 12:28

  6. core-ci voted on patch set 3 V +1 03/05/24, 12:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53941

  7. Stefan Bürk uploaded patch set 4 V +1 03/05/24, 16:10

  8. core-ci voted on patch set 4 V +1 03/05/24, 16:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53966

  9. Stefan Bürk uploaded patch set 5 V +1 03/06/24, 14:36

  10. core-ci voted on patch set 5 V +1 03/06/24, 14:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54042

  11. Stefan Bürk uploaded patch set 6 V +1 03/06/24, 15:34

  12. core-ci voted on patch set 6 V +1 03/06/24, 15:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54047

  13. Stefan Bürk uploaded patch set 7 V +1 03/06/24, 16:09

  14. core-ci voted on patch set 7 V +1 03/06/24, 16:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54049

  1. Stefan Bürk uploaded patch set 8 V +1 03/06/24, 18:44

  2. Stefan Bürk rebased onto patch set 9 03/06/24, 18:44

  3. core-ci voted on patch set 9 V -1 03/06/24, 18:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54066

  4. core-ci voted on patch set 8 V +1 03/06/24, 18:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54065

  5. Chris Müller uploaded patch set 10 V -1 03/06/24, 19:30

  6. core-ci voted on patch set 10 V +1 03/06/24, 19:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54071

  7. Stefan Bürk uploaded patch set 11 V +1 03/07/24, 18:20

  8. Stefan Bürk updated the commit message in patch set 12 03/07/24, 18:21

  9. core-ci voted on patch set 11 V +1 03/07/24, 18:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54169

  10. Stefan Bürk uploaded patch set 13 03/07/24, 18:29

  11. core-ci voted on patch set 12 V +1 03/07/24, 18:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54171

  12. core-ci voted on patch set 13 V +1 03/07/24, 18:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54177

  13. core-ci commented on patch set 13 03/07/24, 19:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54181

  14. Marvin Buchmann commented on patch set 13 03/07/24, 19:32

    ExpressionBuilder.php:514

    a expression -> an expression

    ExpressionBuilder.php:572

    therefor -> therefore

    ExpressionBuilder.php:584

    a integer -> an integer

    ExpressionBuilder.php:617

    a error -> an error

    ExpressionBuilder.php:617

    a invalid type -> an invalid type

    ExpressionBuilder.php:665

    a SQL -> an SQL

    ExpressionBuilder.php:704

    $numberOfRepeates -> $numberOfRepeats

    ExpressionBuilder.php:836

    a integer -> an integer

    ExpressionBuilder.php:897

    a integer -> an integer

    ExpressionBuilder.php:1117

    cutts -> cuts

    QueryBuilder.php:1163

    a expression -> an expression

    Feature-103309-AddMoreExpressionMethodsToExpressionBuilder.rst:16

    since -> for

    Feature-103309-AddMoreExpressionMethodsToExpressionBuilder.rst:21

    a alias -> an alias

    Feature-103309-AddMoreExpressionMethodsToExpressionBuilder.rst:63

    a argument -> an argument

    Feature-103309-AddMoreExpressionMethodsToExpressionBuilder.rst:124

    Unquoted value or expression part to concatenated with the other parts -> Unquoted values or expression parts to concatenate with each other

    Feature-103309-AddMoreExpressionMethodsToExpressionBuilder.rst:184

    prefered -> preferred

    Feature-103309-AddMoreExpressionMethodsToExpressionBuilder.rst:240

    prefered -> preferred

    Feature-103309-AddMoreExpressionMethodsToExpressionBuilder.rst:575

    complexer -> more complex

    ExpressionBuilderTest.php:984

    concetination -> concatenation

    ExpressionBuilderTest.php:1112

    double point -> colon

    ExpressionBuilderTest.php:1118

    time -> times (all occurences in this method with a greater value than 1)

    ExpressionBuilderTest.php:1277

    one spaces -> one space (all occurences in this method with 'one')

    ExpressionBuilderTest.php:1417

    to -> too

    ExpressionBuilderTest.php:1423

    to -> too

    ExpressionBuilderTest.php:1458

    to -> too

    ExpressionBuilderTest.php:1464

    to -> too

    ExpressionBuilderTest.php:1500

    to -> too

    ExpressionBuilderTest.php:1506

    to -> too

    ExpressionBuilderTest.php:1562

    to -> too

    ExpressionBuilderTest.php:1568

    to -> too
  15. Christian Kuhn uploaded patch set 14 V +1 03/07/24, 21:02

  16. Christian Kuhn commented on patch set 14 03/07/24, 21:09

    ExpressionBuilder.php:514 Reply

    Done

    ExpressionBuilder.php:572 Reply

    Done

    ExpressionBuilder.php:584 Reply

    Done

    ExpressionBuilder.php:617 Reply

    Done

    ExpressionBuilder.php:617 Reply

    Done

    ExpressionBuilder.php:665 Reply

    Done

    ExpressionBuilder.php:704 Reply

    Done

    ExpressionBuilder.php:836 Reply

    Done

    ExpressionBuilder.php:897 Reply

    Done

    ExpressionBuilder.php:1117 Reply

    Done

    QueryBuilder.php:1163 Reply

    Done

    Feature-103309-AddMoreExpressionMethodsToExpressionBuilder.rst:16 Reply

    Done

    Feature-103309-AddMoreExpressionMethodsToExpressionBuilder.rst:21 Reply

    Done

    Feature-103309-AddMoreExpressionMethodsToExpressionBuilder.rst:63 Reply

    Done

    Feature-103309-AddMoreExpressionMethodsToExpressionBuilder.rst:124 Reply

    Done

    Feature-103309-AddMoreExpressionMethodsToExpressionBuilder.rst:184 Reply

    Done

    Feature-103309-AddMoreExpressionMethodsToExpressionBuilder.rst:240 Reply

    Done

    Feature-103309-AddMoreExpressionMethodsToExpressionBuilder.rst:575 Reply

    Done

    ExpressionBuilderTest.php:984 Reply

    Done

    ExpressionBuilderTest.php:1112 Reply

    Done

    ExpressionBuilderTest.php:1118 Reply

    Done

    ExpressionBuilderTest.php:1277 Reply

    Done

    ExpressionBuilderTest.php:1417 Reply

    Done

    ExpressionBuilderTest.php:1423 Reply

    Done

    ExpressionBuilderTest.php:1458 Reply

    Done

    ExpressionBuilderTest.php:1464 Reply

    Done

    ExpressionBuilderTest.php:1500 Reply

    Done

    ExpressionBuilderTest.php:1506 Reply

    Done

    ExpressionBuilderTest.php:1562 Reply

    Done

    ExpressionBuilderTest.php:1568 Reply

    Done
  17. Christian Kuhn uploaded patch set 15 03/07/24, 21:09

  18. Christian Kuhn voted on patch set 15 CR +1 V +1 03/07/24, 21:09

  19. core-ci voted on patch set 14 V +1 03/07/24, 21:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54195

  20. core-ci voted on patch set 15 V +1 03/07/24, 21:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54197

  21. Oliver Klee voted on patch set 15 V +1 03/07/24, 23:22

  22. Benni Mack voted on patch set 15 CR +1 V +1 03/08/24, 06:56

  23. Anja Leichsenring voted on patch set 15 CR +1 V +1 03/08/24, 08:25

  24. Stefan Bürk voted on patch set 15 CR +2 V +2 03/08/24, 08:34

  25. Stefan Bürk merged patch set 16 03/08/24, 08:34