Download Latest Version v4.1.1 source code.zip (3.1 MB)
Email in envelope

Get an email when there's a new version of Ktorm

Home / v3.6.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2023-01-27 2.9 kB
v3.6.0 source code.tar.gz 2023-01-27 2.9 MB
v3.6.0 source code.zip 2023-01-27 3.0 MB
Totals: 3 Items   5.9 MB 0

Infrastructure

  • Upgrade Kotlin version to 1.7.22, support latest JDK versions (min 8, max 19)
  • Support Java 9 modular [#421]

Support SQL Window Functions, by @michaelfyc in [#460]

Ktorm now supports SQL window functions, here is an example:

:::kotlin
database
    .from(Employees)
    .select(
        Employees.name,
        Employees.salary,
        Employees.departmentId,
        rank().over { partitionBy(Employees.departmentId).orderBy(Employees.salary.desc()) }
    )

Generated SQL:

:::sql
SELECT 
    "t_employee"."name" AS "t_employee_name", 
    "t_employee"."salary" AS "t_employee_salary", 
    "t_employee"."department_id" AS "t_employee_department_id", 
    RANK() OVER (PARTITION BY "t_employee"."department_id" ORDER BY "t_employee"."salary" DESC) 
FROM "t_employee"

Support Case-When DSL, by @zuisong in [#413]

Ktorm now supports case-when DSL, for example:

:::kotlin
database
    .from(Employees)
    .select(
        Employees.id,
        Employees.name,
        CASE(Employees.sex).WHEN(1).THEN("male").WHEN(2).THEN("female").ELSE("unknown").END()
    )

Generated SQL:

:::sql
SELECT 
    "t_employee"."id" AS "t_employee_id", 
    "t_employee"."name" AS "t_employee_name", 
    CASE "t_employee"."sex" WHEN 1 THEN 'male' WHEN 2 THEN 'female' ELSE 'unknown' END 
FROM "t_employee"

Other Optimizations & Bug Fixes

  • Support insert ... returning ... for SQLite, by @2938137849 in [#427]
  • Support SQL full join, by @KocproZ in [#419]
  • Support MySQL & PostgreSQL default keyword for insert statements to use column default values, by @lookup-cat in [#431]
  • Support SQL type casting syntax, by @svenallers in [#415]
  • Rename Query#totalRecords to Query#totalRecordsInAllPages for better understandability, the origin name is now deprecated
  • Disable entity sequence for tables that doesn’t bound to entities, legacy usages will get a warning after 3.6.0
  • DefaultMethodHandler to use the same class loader as the method's declaring class, by @brohacz in [#471]
  • Refactor combineConditions to avoid stack overflow errors [#328]
  • Fix SQLite syntax error for UNIONs with subqueries [#329]
  • Fix entity equality bug [#466]
  • Fix bugs [#386], [#400], [#405], [#432], [#433], [#457]

Break Changes

  • Refactor SqlExpressionVisitor and its subtypes from classes to interfaces for better coding flexibility.
  • Change SQL Server datetimeoffset's return type from Column<microsoft.sql.DateTimeOffset> to Column<java.time.OffsetDateTime>
Source: README.md, updated 2023-01-27