• lenqnr

    lenqnr

    3 years ago
    How can I achieve
    UNION
    operator with Exposed DSL? I want to execute something like:
    SELECT MAX(views) FROM (
        SELECT views FROM articles WHERE user_id = 1
        UNION ALL
        SELECT views FROM comments WHERE user_id = 1
    ) as writings
    lenqnr
    tapac
    2 replies
    Copy to Clipboard
  • r

    runjorel

    3 years ago
    Does the DAO api allow for batch insert?
    r
    tapac
    3 replies
    Copy to Clipboard
  • r

    runjorel

    3 years ago
    How can I use a sub query in an update statement ? Contrived Example:
    UPDATE Users SET active=false WHERE id IN (SELECT user_id FROM deactivated)
    It seems the only option I have is
    inList
    but I am afraid if I call
    map{..}/toList()
    on my subquery it would materialize those results.
    r
    tapac
    3 replies
    Copy to Clipboard
  • r

    runjorel

    3 years ago
    Question about
    suspendedTransaction
    . Whenever I try to call another suspending function within a suspendingTransaction, I am getting an error about coroutine contexts. Is that not allowed?
    r
    tapac
    3 replies
    Copy to Clipboard
  • SrSouza

    SrSouza

    3 years ago
    Hi @tapac, you can tell me the difference between Blob and Binary columns? And in the future you add like a column for ByteReadPacket using Blob?
    SrSouza
    tapac
    4 replies
    Copy to Clipboard
  • b

    bitkid

    3 years ago
    Database.connect(datasource = HikariDataSource(poolConfig),
                manager = { ThreadLocalTransactionManager(it, Connection.TRANSACTION_REPEATABLE_READ, 0) })
    b
    9 replies
    Copy to Clipboard
  • tjohnn

    tjohnn

    3 years ago
    Hi, I am trying to do batch upsert with the help of this article https://medium.com/@OhadShai/first-steps-with-kotlin-exposed-cb361a9bf5ac but I get
    KotlinNullPointerException
    whenever I attempt to use it for inserting a new data which doesn't have an id, the id being null is the cause of the error based on what I see so far, the id is auto_increment so I cannot set it explicitly, is there a way for me to fix this or Am I doing something wrong?
    tjohnn
    r
    +1
    20 replies
    Copy to Clipboard
  • v

    vagarwala

    3 years ago
    hey @runjorel I’ve finally got it working nicely. thank you so much for your help, i really do appreciate it!
    v
    r
    4 replies
    Copy to Clipboard
  • r

    runjorel

    3 years ago
    I can’t seem to do a
    batchInsert
    for a
    List<T>
    because
    batchInsert
    will only accept a
    List<Any>
    . Anyone else with that issue?
    r
    tjohnn
    +1
    6 replies
    Copy to Clipboard
  • Hamza

    Hamza

    3 years ago
    PostgreSQL is giving me a couple of issues, and I'm not sure what the issue is. I have a simple main fuction at the moment with just connects to my database, and a transaction. i simple application is giving me the error
    Caused by: org.postgresql.util.PSQLException: This ResultSet is closed.
    which is quite curious
    Database.connect(
            url = "jdbc:<postgresql://localhost:5432/library>",
            user = "hm",
            password = "wouldn't u like to know",
            driver = "org.postgresql.Driver"
        )
    
        transaction {
            Books.select { Op.TRUE }.forEach(::println)
        }
    Hamza
    tapac
    6 replies
    Copy to Clipboard