Skip to content

Implement dbSendQuery(immediate = TRUE) #272

Closed

Description

@krlmlr

This allows to:

Activity

  1. added this to the 1.2.2 milestone on Dec 26, 2020
  2. modified the milestones: 1.2.2, 1.2.3, 1.4.0 on Jan 2, 2021
  3. krlmlr commented on Sep 19, 2021

    @krlmlr
    MemberAuthor

    Proof of concept in the f-272-immediate branch, with two separate PqResultImpl classes. It feels easier to keep both behaviors in one class. We need to

    • Memoize sql argument so that PQsendQuery() can be called in bind()
    • Have a non-const cache
    • Call prepare() later (it can't return a PGresult*)
      • Call it in the constructor or not? Check what RMariaDB does, RSQLite also calls in the constructor
    • Test behavior with multiple queries and statements
    • Rethink when to call wait_for_data(), and when to query sockets

    Exploding join:

    names <- letters[1:21]
    
    sql <-
      paste0(
        "SELECT * FROM ",
        paste0("(SELECT 1 AS ", names, " UNION ALL SELECT 2 AS ", names, ") ", names, collapse = " CROSS JOIN\n")
      )
    writeLines(sql)
    #> SELECT * FROM (SELECT 1 AS a UNION ALL SELECT 2 AS a) a CROSS JOIN
    #> (SELECT 1 AS b UNION ALL SELECT 2 AS b) b CROSS JOIN
    #> (SELECT 1 AS c UNION ALL SELECT 2 AS c) c CROSS JOIN
    #> (SELECT 1 AS d UNION ALL SELECT 2 AS d) d CROSS JOIN
    #> (SELECT 1 AS e UNION ALL SELECT 2 AS e) e CROSS JOIN
    #> (SELECT 1 AS f UNION ALL SELECT 2 AS f) f CROSS JOIN
    #> (SELECT 1 AS g UNION ALL SELECT 2 AS g) g CROSS JOIN
    #> (SELECT 1 AS h UNION ALL SELECT 2 AS h) h CROSS JOIN
    #> (SELECT 1 AS i UNION ALL SELECT 2 AS i) i CROSS JOIN
    #> (SELECT 1 AS j UNION ALL SELECT 2 AS j) j CROSS JOIN
    #> (SELECT 1 AS k UNION ALL SELECT 2 AS k) k CROSS JOIN
    #> (SELECT 1 AS l UNION ALL SELECT 2 AS l) l CROSS JOIN
    #> (SELECT 1 AS m UNION ALL SELECT 2 AS m) m CROSS JOIN
    #> (SELECT 1 AS n UNION ALL SELECT 2 AS n) n CROSS JOIN
    #> (SELECT 1 AS o UNION ALL SELECT 2 AS o) o CROSS JOIN
    #> (SELECT 1 AS p UNION ALL SELECT 2 AS p) p CROSS JOIN
    #> (SELECT 1 AS q UNION ALL SELECT 2 AS q) q CROSS JOIN
    #> (SELECT 1 AS r UNION ALL SELECT 2 AS r) r CROSS JOIN
    #> (SELECT 1 AS s UNION ALL SELECT 2 AS s) s CROSS JOIN
    #> (SELECT 1 AS t UNION ALL SELECT 2 AS t) t CROSS JOIN
    #> (SELECT 1 AS u UNION ALL SELECT 2 AS u) u

    Created on 2021-09-19 by the reprex package (v2.0.1)

    Wait arbitrary time with pg_sleep() .

  4. added a commit that references this issue on Sep 25, 2021
  5. github-actions commented on Sep 26, 2022

    @github-actions
    Contributor

    This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

  6. locked and limited conversation to collaborators on Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions