Skip to content

Julia 0.6 fixes #1

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

Merged
merged 23 commits into from
Jul 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
420272a
updates for Julia v0.5 compatibility (mostly related to Strings warni…
Sep 22, 2016
bdc04cc
updates for Julia v0.5 compatibility (mostly related to Strings warni…
Sep 22, 2016
2c4ac45
updates for Julia v0.5 compatibility (mostly related to Strings warni…
Sep 22, 2016
6a20bfc
updates for Julia v0.5 compatibility (mostly related to Strings warni…
Sep 22, 2016
0fa9e58
updates for Julia v0.5 compatibility (mostly related to Strings warni…
Sep 22, 2016
f5988a9
Merge pull request #1 from amgad-naiem/pull-request/0fa9e58a
amgad-naiem Jul 12, 2017
cf49c1c
Added missing types definition + updated deplreciated
amgad-naiem Jul 12, 2017
a502bec
removed io seek unused functions + duplicate function
amgad-naiem Jul 12, 2017
9fedb2a
Removed duplicate function declarations
amgad-naiem Jul 12, 2017
47517f4
added missing type
amgad-naiem Jul 12, 2017
3ac14f7
Added missing type
amgad-naiem Jul 12, 2017
7c35b11
added more missing types
amgad-naiem Jul 12, 2017
b778a76
Fixed type alias declaration
amgad-naiem Jul 12, 2017
2c70626
Changed bytestring to unsafe_string
amgad-naiem Jul 12, 2017
57850c1
changed bytestring to unsafe_string
amgad-naiem Jul 12, 2017
38f5064
Fixed String to be AbstractString
amgad-naiem Jul 12, 2017
9cb502b
Fixed convert function redefinition warning
amgad-naiem Jul 12, 2017
55aa265
Fixed multiple type declarations
amgad-naiem Jul 12, 2017
d73923c
fixed getting byte array from strings
Jul 12, 2017
31cb7f1
fixed depreciated bytestring in test
Jul 13, 2017
adcbd94
Merge branch 'deprecated_bytestring_is' into julia-0.6-fixes
Jul 13, 2017
5e528f6
Fixed formatting
Jul 13, 2017
82441cd
added abstact type for julia 0.6 (with compat support)
Jul 13, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dbi_impl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function copy_from(db::PostgresDatabaseHandle, table::AbstractString,
return checkerrclear(PQgetResult(db.ptr))
end

hashsql(sql::AbstractString) = unsafe_string(string("__", hash(sql), "__"))
hashsql(sql::AbstractString) = String(string("__", hash(sql), "__"))

function getparamtypes(result::Ptr{PGresult})
nparams = PQnparams(result)
Expand Down
39 changes: 24 additions & 15 deletions src/libpq_common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ const PGF_BINARY = 1
# Skipping MacroDefinition: PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME)PQsetdbLogin(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME,NULL,NULL)
# Skipping MacroDefinition: PQfreeNotify(ptr)PQfreemem(ptr)
const PQnoPasswordSupplied = "fe_sendauth: no password supplied\n"
typealias _IO_lock_t Union{}
typealias va_list Cint
const _IO_lock_t = Union{}
const va_list = Cint
# typealias off_t __off_t
# typealias ssize_t __ssize_t
# typealias fpos_t _G_fpos_t
typealias Oid UInt32
const Oid = UInt32
# begin enum ConnStatusType
typealias ConnStatusType UInt32
const ConnStatusType = UInt32
const CONNECTION_OK = 0
const CONNECTION_BAD = 1
const CONNECTION_STARTED = 2
Expand All @@ -69,15 +69,15 @@ const CONNECTION_SSL_STARTUP = 7
const CONNECTION_NEEDED = 8
# end enum ConnStatusType
# begin enum PostgresPollingStatusType
typealias PostgresPollingStatusType UInt32
const PostgresPollingStatusType = UInt32
const PGRES_POLLING_FAILED = 0
const PGRES_POLLING_READING = 1
const PGRES_POLLING_WRITING = 2
const PGRES_POLLING_OK = 3
const PGRES_POLLING_ACTIVE = 4
# end enum PostgresPollingStatusType
# begin enum ExecStatusType
typealias ExecStatusType UInt32
const ExecStatusType = UInt32
const PGRES_EMPTY_QUERY = 0
const PGRES_COMMAND_OK = 1
const PGRES_TUPLES_OK = 2
Expand All @@ -90,29 +90,38 @@ const PGRES_COPY_BOTH = 8
const PGRES_SINGLE_TUPLE = 9
# end enum ExecStatusType
# begin enum PGTransactionStatusType
typealias PGTransactionStatusType UInt32
const PGTransactionStatusType = UInt32
const PQTRANS_IDLE = 0
const PQTRANS_ACTIVE = 1
const PQTRANS_INTRANS = 2
const PQTRANS_INERROR = 3
const PQTRANS_UNKNOWN = 4
# end enum PGTransactionStatusType
# begin enum PGVerbosity
typealias PGVerbosity UInt32
const PGVerbosity = UInt32
const PQERRORS_TERSE = 0
const PQERRORS_DEFAULT = 1
const PQERRORS_VERBOSE = 2
# end enum PGVerbosity
# begin enum PGPing
typealias PGPing UInt32
const PGPing = UInt32
const PQPING_OK = 0
const PQPING_REJECT = 1
const PQPING_NO_RESPONSE = 2
const PQPING_NO_ATTEMPT = 3
# end enum PGPing
typealias PQnoticeReceiver Ptr{Void}
typealias PQnoticeProcessor Ptr{Void}
typealias pqbool UInt8
typealias pgthreadlock_t Ptr{Void}
typealias PGconn Void
typealias PGresult Void
const PQnoticeReceiver = Ptr{Void}
const PQnoticeProcessor = Ptr{Void}
const pqbool = UInt8
const pgthreadlock_t = Ptr{Void}
const PGconn = Void
const PGresult = Void

const _IO_FILE = Void
const FILE = Void
const PQconninfoOption = Void
const PGcancel = Void
const PGnotify = Void
const PQArgBlock = Void
const PGresAttDesc = Void
const PQprintOpt = Void
2 changes: 0 additions & 2 deletions src/libpq_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ module libpq_interface
@c Cint _IO_vfprintf (Ptr{_IO_FILE}, Ptr{UInt8}, Cint) libpq
# @c __ssize_t _IO_padn (Ptr{_IO_FILE}, Cint, __ssize_t) libpq
@c Cint _IO_sgetn (Ptr{_IO_FILE}, Ptr{Void}, Cint) libpq
@c __off64_t _IO_seekoff (Ptr{_IO_FILE}, __off64_t, Cint, Cint) libpq
@c __off64_t _IO_seekpos (Ptr{_IO_FILE}, __off64_t, Cint) libpq
@c Void _IO_free_backup_area (Ptr{_IO_FILE},) libpq
@c Cint remove (Ptr{UInt8},) libpq
@c Cint rename (Ptr{UInt8}, Ptr{UInt8}) libpq
Expand Down
22 changes: 11 additions & 11 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import DataArrays: NAtype
import JSON
import Compat: Libc, unsafe_convert, parse, @compat, String, unsafe_string

abstract AbstractPostgresType
@compat abstract type AbstractPostgresType end
type PostgresType{Name} <: AbstractPostgresType end

abstract AbstractOID
@compat abstract type AbstractOID end
type OID{N} <: AbstractOID end

oid{T<:AbstractPostgresType}(t::Type{T}) = convert(OID, t)
Expand Down Expand Up @@ -55,7 +55,7 @@ newpgtype(:_varchar, 1015, (Vector{String},))
newpgtype(:_text, 1009, (Vector{String},))


typealias PGStringTypes Union{Type{PostgresType{:bpchar}},
const PGStringTypes = Union{Type{PostgresType{:bpchar}},
Type{PostgresType{:varchar}},
Type{PostgresType{:text}},
Type{PostgresType{:date}}}
Expand Down Expand Up @@ -153,36 +153,36 @@ function pgdata(::Type{PostgresType{:numeric}}, ptr::Ptr{UInt8}, data::Number)
end

function pgdata(::PGStringTypes, ptr::Ptr{UInt8}, data::AbstractString)
ptr = storestring!(ptr, data)
ptr = storestring!(ptr, String(data))
end

function pgdata(::PostgresType{:date}, ptr::Ptr{UInt8}, data::AbstractString)
ptr = storestring!(ptr, data)
ptr = storestring!(ptr, String(data))
ptr = Dates.DateFormat(ptr)
end

function pgdata(::PostgresType{:timestamp}, ptr::Ptr{UInt8}, data::AbstractString)
ptr = storestring!(ptr, data)
ptr = storestring!(ptr, String(data))
end

function pgdata(::PostgresType{:timestamptz}, ptr::Ptr{UInt8}, data::AbstractString)
ptr = storestring!(ptr, data)
ptr = storestring!(ptr, String(data))
end

function pgdata(::Type{PostgresType{:bytea}}, ptr::Ptr{UInt8}, data::Vector{UInt8})
ptr = storestring!(ptr, string("\\x", bytes2hex(data)))
ptr = storestring!(ptr, String(string("\\x", bytes2hex(data))))
end

function pgdata(::Type{PostgresType{:unknown}}, ptr::Ptr{UInt8}, data)
ptr = storestring!(ptr, string(data))
end

function pgdata{T<:AbstractString}(::Type{PostgresType{:json}}, ptr::Ptr{UInt8}, data::Dict{T,Any})
ptr = storestring!(ptr, JSON.json(data))
ptr = storestring!(ptr, String(JSON.json(data)))
end

function pgdata{T<:AbstractString}(::Type{PostgresType{:jsonb}}, ptr::Ptr{UInt8}, data::Dict{T,Any})
ptr = storestring!(ptr, JSON.json(data))
ptr = storestring!(ptr, String(JSON.json(data)))
end

function pgdata(::Type{PostgresType{:_bool}}, ptr::Ptr{UInt8}, data::Vector{Bool})
Expand Down Expand Up @@ -218,7 +218,7 @@ function pgdata(::Type{PostgresType{:_text}}, ptr::Ptr{UInt8}, data::Vector{Stri
end

# dbi
abstract Postgres <: DBI.DatabaseSystem
@compat abstract type Postgres<:DBI.DatabaseSystem end

type PostgresDatabaseHandle <: DBI.DatabaseHandle
ptr::Ptr{PGconn}
Expand Down