• Daniel Skogquist Åborg

    Daniel Skogquist Åborg

    1 year ago
    Hi! Is there a built in case/when statement?
    Daniel Skogquist Åborg
    1 replies
    Copy to Clipboard
  • tapac

    tapac

    1 year ago
    Hello, everyone! It was a long time since the last release and I want to apologize for the silence on the slack and github. It was very hard two months for me personally (a lot of work on main projects and almost no time and energy to do something with Exposed). Today I want to announce Exposed 0.29.1 release with a lot of bugfixes and few features. I want to thank the community for a lot of attention and PRs. There are several huge PRs those I have to check and as they can break backward compatibility we have to prepare smooth plan of migration. Also, I have unfinished branches with R2DBC and Exposed Intellij IDEA plugin, so stay tuned!
    tapac
    1 replies
    Copy to Clipboard
  • e

    Endre Deak

    1 year ago
    Sorry if this was asked previously, tried to find but no result. I know that I can execute raw SQL with Exposed, and I also know that currently there’s no support for
    UNION
    . I need
    UNION
    in my query, so I was wondering if I could wrap an SQL statement (something like
    SELECT 1 AS idx UNION ALL SELECT 2 UNION ALL SELECT 3
    ) and then I could use this expression to join to another table?
    e
    Joel
    2 replies
    Copy to Clipboard
  • Kuba Petržílka

    Kuba Petržílka

    1 year ago
    Hi, why would one prefer Exposed over JOOQ? I hear some complains about lot of boilerplate code needed in case of Exposed. Can you sum up what are the key benefits of using Exposed?
    Kuba Petržílka
    e
    +2
    11 replies
    Copy to Clipboard
  • d

    Das135

    1 year ago
    Hello. I have two questions:1. Does Exposed suport sequence
    autoincrement
    insert for MSSQL?
    I have column in Table defined like this:
    val id: Column<Long> = long("id").autoIncrement("users_seq")
    
    override val primaryKey: PrimaryKey = PrimaryKey(id)
    And when inserting object (without defined inc column) I get this error:
    com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert the value NULL into column 'id', table ''; column does not allow nulls. INSERT fails.
    2. How to store NULL value to
    varbinary(max)
    MSSQL column with Exposed? I have this column type:
    val image = binary("image", Int.MAX_VALUE).nullable()
    When trying to insert null value, I get error:
    Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
    d
    tapac
    7 replies
    Copy to Clipboard
  • t

    Tarun Chawla

    1 year ago
    Am getting this continuous warnings related to cleanup:
    Feb 13, 2021 5:28:37 PM com.impossibl.postgres.jdbc.ThreadedHousekeeper$HousekeeperReference cleanup
    WARNING: Cleaning up leaked result-set
    Allocation occurred @
      at org.jetbrains.exposed.sql.statements.jdbc.JdbcPreparedStatementImpl.executeQuery(JdbcPreparedStatementImpl.kt:21)
      at org.jetbrains.exposed.sql.Query.executeInternal(Query.kt:79)
      at org.jetbrains.exposed.sql.Query.executeInternal(Query.kt:15)
      at org.jetbrains.exposed.sql.statements.Statement.executeIn$exposed_core(Statement.kt:61)
      at org.jetbrains.exposed.sql.Transaction.exec(Transaction.kt:129)
    Due to this elephant sql is complaining about too many multiple connections. Am using exposed version 0.29.1 and latest pgjdbc-ng:0.8.6. Please help me understand the issue and share any code snippet if any. Am opening db connection like below:
    fun getDBConn(): Database? {
        if (DBConnection == null) {
          synchronized(this) {
            if (DBConnection == null) {
              try {
                DBConnection = DataBaseConnection.connectWithDb(
                  Config.DB_URL,
                  Config.DB_DRIVER,
                  Config.DB_USERNAME,
                  Config.DB_PASSWORD
                )
              } catch (e: Exception) {
                println("error while connecting to db $e")
                return null
              }
            }
          }
        }
        return DBConnection
      }
    t
    hichem fazai
    2 replies
    Copy to Clipboard
  • Kuba Petržílka

    Kuba Petržílka

    1 year ago
    Hi everyone, I have a question: For a clomun defined as
    timestamptz
    in postgres I used
    timstamp(...)
    (
    Column<Instant>
    from Java Time API extension for Exposed) and when I persist a record it uses my current timezone, but I would like to get it persisted in GMT so that I dont have to do that math when comparing the values while looking into the DB (I want
    2021-02-14 15:06:07.66052+00
    instead of
    2021-02-14 16:06:07.66052+01
    ) how do I enforce this?
    Kuba Petržílka
    s
    +1
    7 replies
    Copy to Clipboard
  • Kuba Petržílka

    Kuba Petržílka

    1 year ago
    I m facing the same issue like this one:https://stackoverflow.com/questions/65002107/how-can-i-call-a-sequence-nextval-using-kotlin-exposed Is there a way how to get nextval from sequence without making it a part of some other query?
    Kuba Petržílka
    1 replies
    Copy to Clipboard
  • e

    Endre Deak

    1 year ago
    Is there a nice and easy way to go through a query and make sure there are no duplicated table names in there?
    e
    Joel
    2 replies
    Copy to Clipboard
  • Mark

    Mark

    1 year ago
    Hey, using Dao is it possible to have a
    Entity#new
    that does
    INSERT IGNORE INTO
    instead of just
    INSERT INTO
    ?
    Mark
    1 replies
    Copy to Clipboard