Skip to content

Commit

Permalink
Add some documentation on asynchronous queries
Browse files Browse the repository at this point in the history
  • Loading branch information
iamed2 committed Jun 11, 2019
1 parent 5090c12 commit 69a7b61
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ LibPQ.jl is a Julia wrapper for the PostgreSQL `libpq` C library.
* UTF-8 client encoding
* Queries
* Create and execute queries with or without parameters
* Execute queries asynchronously
* Stream results using [Tables](https://github.com/JuliaData/Tables.jl)
* Configurably convert a variety of PostgreSQL types to corresponding Julia types (see the **Type Conversions** section of the docs)
* Prepared Statements
Expand Down
6 changes: 6 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ data = columntable(result)
result = execute(conn, "SELECT typname FROM pg_type WHERE oid = \$1", ["16"])
data = columntable(result)

# the same but asynchronously
async_result = async_execute(conn, "SELECT typname FROM pg_type WHERE oid = \$1", ["16"])
# do other things
result = fetch(async_result)
data = columntable(result)

close(conn)
```

Expand Down
3 changes: 3 additions & 0 deletions src/asyncresults.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ Calling `fetch` on the `AsyncResult` will return a [`Result`](@ref).
All keyword arguments are the same as [`execute`](@ref) and are passed to the created
`Result`.
Only one `AsyncResult` can be active on a [`Connection`](@ref) at once.
If multiple `AsyncResult`s use the same `Connection`, they will execute serially.
`async_execute` does not yet support [`Statement`](@ref)s.
`async_execute` optionally takes a `parameters` vector which passes query parameters as
Expand Down

0 comments on commit 69a7b61

Please sign in to comment.