-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates for Julia 0.7 #40
Conversation
circle.yml
Outdated
mkdir jlmnt | ||
hdiutil mount -readonly -mountpoint jlmnt julia.dmg | ||
cp -a jlmnt/*.app/Contents/Resources/julia ~/ | ||
echo 'PATH=$HOME/bin:$PATH' >> $BASH_ENV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got this from https://discuss.circleci.com/t/how-to-add-a-path-to-path-in-circle-2-0/11554/10, but it doesn't appear to be working properly, hence the failures on Circle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to source
bashrc, like in that link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But also I think you could either just not use $PATH, or do an install to whatever directory brew is using
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually you need that to be `echo 'export PATH=$HOME/bin:$PATH' >> $BASH_ENV
The export is important
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoooooops. Added export
and source
, but either I'm still derping or modifying the path isn't the right solution.
Previously I tried symlinking the executable to /usr/local/bin
but it couldn't find it there, and I tried symlinking to /usr/bin
but got a permissions error, even with sudo
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well just reference Julia by path then?
ed05c16
to
f29fb98
Compare
src/LibPQ.jl
Outdated
@@ -3,6 +3,7 @@ module LibPQ | |||
export status, reset!, execute, clear, fetch!, prepare, | |||
num_columns, num_rows, num_params, num_affected_rows | |||
|
|||
using Compat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please import specific things rather than everything
src/parsing.jl
Outdated
@@ -252,7 +252,7 @@ end | |||
## arrays | |||
# numeric arrays never have double quotes and always use ',' as a separator | |||
function parse_numeric_array(eltype::Type{T}, str::AbstractString) where T | |||
eq_ind = searchindex(str, '=') | |||
eq_ind = something(findfirst(isequal('='), str), 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just change the eq_ind > 0
check to eq_ind !== nothing
and avoid the something
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On 0.6, this returns 0 rather than nothing
when there's no match. something
is just a more concise way to handle both versions at once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhh, so this is for cross-version support. Maybe make a comment showing that we can change it when we drop 0.6
test/runtests.jl
Outdated
using Compat: Test | ||
|
||
import Compat: @__MODULE__ | ||
using Compat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please be specific about Compat imports
end | ||
|
||
return arr | ||
end | ||
|
||
function array_size(str) | ||
ndims = findfirst(c -> c != '{', str) - 1 | ||
ndims = something(findfirst(c -> c != '{', str), 0) - 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe remove the something
and throw an error on nothing
(like "Invalid PostgreSQL array literal '$str'")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also through an error when this is < 0 on 0.6 then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah keep it as is, I understand better after #40 (comment)
src/datastreams.jl
Outdated
|
||
# this should change to be whatever custom pgtype conversion function we invent | ||
map!(parameters, values(row)) do val | ||
map!(parameters, collect(values(row))) do val |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why collect
now? What changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that values
returns a Tuple
rather than an array, which hits a MethodError
from map!
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make this a loop assigning to parameters
instead then. Don't want to allocate an extra vector for each row.
9f2cc88
to
38af842
Compare
Also add a finalizer for Result that calls `close`. `clear!` has been moved to the Distributed stdlib package as of Julia v0.7. The `cleared` field of the `Result` type has been removed in favor of a general `isopen` method for `Result`s.
docs/src/index.md
Outdated
@@ -15,12 +15,12 @@ using LibPQ, DataStreams, NamedTuples | |||
conn = LibPQ.Connection("dbname=postgres") | |||
result = execute(conn, "SELECT typname FROM pg_type WHERE oid = 16") | |||
data = Data.stream!(result, NamedTuple) | |||
clear!(result) | |||
close(result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can stop recommending this by default now that finalizers exist
Doctests are failing on 0.7 |
Fixed. |
docs/src/index.md
Outdated
|
||
# the same but with parameters | ||
result = execute(conn, "SELECT typname FROM pg_type WHERE oid = \$1", ["16"]) | ||
data = Data.stream!(result, NamedTuple) | ||
clear!(result) | ||
close(result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You missed this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D'oh!
We no longer need to recommend explicitly calling `close` on `Result`s and we only want to load NamedTuples on 0.6.
Work in progress, opening now then I'll add commits incrementally.Fixes #39, #25, #37, #38