Skip to content

Commit 269a9a9

Browse files
committed
Updates for 1.0
1 parent e20f85d commit 269a9a9

10 files changed

+39
-68
lines changed

.appveyor.yml

+22-23
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
environment:
22
matrix:
3-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
4-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
5-
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
6-
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
3+
- julia_version: 1
4+
- julia_version: nightly
75

8-
services:
9-
- mysql
6+
platform:
7+
- x86 # 32-bit
8+
- x64 # 64-bit
9+
10+
# # Uncomment the following lines to allow failures on nightly julia
11+
# # (tests will run but not make your overall status red)
12+
# matrix:
13+
# allow_failures:
14+
# - julia_version: nightly
1015

1116
branches:
1217
only:
@@ -20,24 +25,18 @@ notifications:
2025
on_build_status_changed: false
2126

2227
install:
23-
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
24-
# if there's a newer build queued for the same PR, cancel this one
25-
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
26-
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
27-
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
28-
throw "There are newer queued builds for this pull request, failing early." }
29-
# Download most recent Julia Windows binary
30-
- ps: (new-object net.webclient).DownloadFile(
31-
$env:JULIA_URL,
32-
"C:\projects\julia-binary.exe")
33-
# Run installer silently, output to C:\projects\julia
34-
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
28+
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))
3529

3630
build_script:
37-
# Need to convert from shallow to complete for Pkg.clone to work
38-
- IF EXIST .git\shallow (git fetch --unshallow)
39-
- C:\projects\julia\bin\julia -e "versioninfo();
40-
Pkg.clone(pwd(), \"MySQL\"); Pkg.build(\"MySQL\")"
31+
- echo "%JL_BUILD_SCRIPT%"
32+
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"
4133

4234
test_script:
43-
- C:\projects\julia\bin\julia -e "Pkg.test(\"MySQL\")"
35+
- echo "%JL_TEST_SCRIPT%"
36+
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"
37+
38+
# # Uncomment to support code coverage upload. Should only be enabled for packages
39+
# # which would have coverage gaps without running on Windows
40+
# on_success:
41+
# - echo "%JL_CODECOV_SCRIPT%"
42+
# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%"

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ deps/deps.jl
3535
deps/usr/
3636
deps/mysql-connector*
3737
deps/downloads/
38-
deps/manifests/
38+
deps/manifests/
39+
deps/build.log

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ os:
99
- osx
1010

1111
julia:
12-
- 0.6
12+
- 1.0
1313
- nightly
1414

1515
notifications:
@@ -19,7 +19,7 @@ after_success:
1919
# push coverage results to Coveralls
2020
#- julia -e 'cd(Pkg.dir("MySQL")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
2121
# push coverage results to Codecov
22-
- julia -e 'cd(Pkg.dir("MySQL")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
22+
- julia -e 'using Pkg; cd(Pkg.dir("MySQL")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
2323

2424
before_script:
2525
- export OLD_PATH=$LD_LIBRARY_PATH

REQUIRE

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
julia 0.6
1+
julia 0.7
22
DataStreams
3-
Compat 0.48.0
43
Missings
54
DecFP
65
BinaryProvider

src/MySQL.jl

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
__precompile__(true)
21
module MySQL
3-
using Compat, Compat.Dates
4-
using DataStreams, Missings
52

6-
export Data
3+
using DataStreams, Missings, Dates
74

8-
@static if isdefined(Core, :NamedTuple)
9-
macro NT(args...)
10-
return esc(:(($(args...),)))
11-
end
12-
else
13-
using NamedTuples
14-
end
5+
export Data
156

167
abstract type MySQLError end
178
# For errors that happen in MySQL.jl
@@ -131,9 +122,4 @@ query(source::Query, sink::T; append::Bool=false, transforms::Dict=Dict{Int,Func
131122

132123
include("prepared.jl")
133124

134-
Base.@deprecate mysql_options MySQL.setoptions!
135-
Base.@deprecate mysql_connect MySQL.connect
136-
Base.@deprecate mysql_disconnect MySQL.disconnect
137-
Base.@deprecate mysql_insert_id MySQL.insertid
138-
139125
end # module

src/api.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module API
22

3-
using Compat, Compat.Dates, DecFP, Missings
3+
using Dates, DecFP, Missings
44

55
# Load libmariadb from our deps.jl
66
const depsjl_path = joinpath(dirname(@__FILE__), "..", "deps", "deps.jl")

src/consts.jl

+1-5
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ const MYSQL_TYPE_VAR_STRING = UInt32(253)
2727
const MYSQL_TYPE_STRING = UInt32(254)
2828
const MYSQL_TYPE_GEOMETRY = UInt32(255)
2929

30-
if length(methods(Base.bitstring)) == 1
31-
bitstring(x) = bits(x)
32-
end
33-
3430
struct Bit
3531
bits::UInt64
3632
end
@@ -161,7 +157,7 @@ const MYSQL_DEFAULT_PORT = 3306
161157
const CR_SERVER_GONE_ERROR = 2006
162158
const CR_SERVER_LOST = 2013
163159

164-
if Compat.Sys.iswindows()
160+
if Sys.iswindows()
165161
const MYSQL_DEFAULT_SOCKET = "MySQL"
166162
else
167163
const MYSQL_DEFAULT_SOCKET = "/tmp/mysql.sock"

src/prepared.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mutable struct Stmt
2727
API.mysql_stmt_prepare(ptr, sql) != 0 && throw(MySQLInternalError(conn))
2828
nparams = API.mysql_stmt_param_count(ptr)
2929
stmt = new(ptr, sql, nparams, 0)
30-
@compat finalizer(x->API.mysql_stmt_close(x.ptr), stmt)
30+
finalizer(x->API.mysql_stmt_close(x.ptr), stmt)
3131
return stmt
3232
end
3333
end

src/types.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ mutable struct Result
3636
function Result(ptr)
3737
res = new(ptr)
3838
if ptr != C_NULL
39-
@compat finalizer(API.mysql_free_result, res)
39+
finalizer(API.mysql_free_result, res)
4040
end
4141
return res
4242
end

test/runtests.jl

+6-16
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
using MySQL, Missings
2-
using Compat, Compat.Test, Compat.Dates
3-
4-
@static if isdefined(Core, :NamedTuple)
5-
macro NT(args...)
6-
return esc(:(($(args...),)))
7-
end
8-
else
9-
using NamedTuples
10-
end
2+
using Test, Dates
113

124
if haskey(ENV, "APPVEYOR_BUILD_NUMBER")
135
pwd = "Password12!"
@@ -52,7 +44,7 @@ res = MySQL.query(conn, "select * from Employee")
5244
@test length(res[1]) == 4
5345
@test res.ID == [1,2,3,4]
5446

55-
expected = @NT(
47+
expected = (
5648
ID = Int32[1, 2, 3, 4],
5749
Name = Union{Missing, String}["John", "Tom", "Jim", "Tim"],
5850
Salary = Union{Missing, Float32}[10000.5, 20000.25, 30000.0, 15000.5],
@@ -73,9 +65,7 @@ MySQL.execute!(conn, "INSERT INTO Employee () VALUES ();")
7365
res = MySQL.query(conn, "select * from Employee")
7466

7567
foreach(x->push!(x[2], x[1] == 1 ? Int32(5) : missing), enumerate(expected))
76-
if isdefined(Core, :NamedTuple)
7768
@test isequal(res, expected)
78-
end
7969

8070
q = MySQL.Query(conn, "select * from Employee")
8171
for row in Data.rows(q)
@@ -97,10 +87,10 @@ res = MySQL.query(conn, "select Salary from Employee")
9787

9888
stmt = MySQL.Stmt(conn, "INSERT INTO Employee (Name, Salary, JoinDate, LastLogin, LunchTime, OfficeNo, empno) VALUES (?, ?, ?, ?, ?, ?, ?);")
9989

100-
values = [@NT(Name="John", Salary=10000.50, JoinDate=Date("2015-8-3"), LastLogin=DateTime("2015-9-5T12:31:30"), LunchTime=Dates.Time(12,00,00), OfficeNo=1, empno=1301),
101-
@NT(Name="Tom", Salary=20000.25, JoinDate=Date("2015-8-4"), LastLogin=DateTime("2015-10-12T13:12:14"), LunchTime=Dates.Time(13,00,00), OfficeNo=12, empno=1422),
102-
@NT(Name="Jim", Salary=30000.00, JoinDate=Date("2015-6-2"), LastLogin=DateTime("2015-9-5T10:05:10"), LunchTime=Dates.Time(12,30,00), OfficeNo=45, empno=1567),
103-
@NT(Name="Tim", Salary=15000.50, JoinDate=Date("2015-7-25"), LastLogin=DateTime("2015-10-10T12:12:25"), LunchTime=Dates.Time(12,30,00), OfficeNo=56, empno=3200)]
90+
values = [(Name="John", Salary=10000.50, JoinDate=Date("2015-8-3"), LastLogin=DateTime("2015-9-5T12:31:30"), LunchTime=Dates.Time(12,00,00), OfficeNo=1, empno=1301),
91+
(Name="Tom", Salary=20000.25, JoinDate=Date("2015-8-4"), LastLogin=DateTime("2015-10-12T13:12:14"), LunchTime=Dates.Time(13,00,00), OfficeNo=12, empno=1422),
92+
(Name="Jim", Salary=30000.00, JoinDate=Date("2015-6-2"), LastLogin=DateTime("2015-9-5T10:05:10"), LunchTime=Dates.Time(12,30,00), OfficeNo=45, empno=1567),
93+
(Name="Tim", Salary=15000.50, JoinDate=Date("2015-7-25"), LastLogin=DateTime("2015-10-10T12:12:25"), LunchTime=Dates.Time(12,30,00), OfficeNo=56, empno=3200)]
10494

10595
Data.stream!(values, stmt)
10696

0 commit comments

Comments
 (0)