Skip to content

Commit

Permalink
fix compatibilities merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanner authored and Tanner committed May 30, 2018
1 parent 2eda9f7 commit f89d2f8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
10 changes: 5 additions & 5 deletions Sources/MySQL/Protocol/MySQLCapabilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
/// https://dev.mysql.com/doc/internals/en/capability-flags.html#packet-Protocol::CapabilityFlags
public struct MySQLCapabilities: OptionSet {
/// The raw capabilities value.
var raw: UInt64
public var rawValue: UInt64

/// MySQL specific flags
var mysqlSpecific: UInt32 {
get {
return UInt32(raw)
return UInt32(rawValue & 0xFFFFFFFF)
}
}

/// See: [MariaDB Initial Handshake Packet specific flags](https://mariadb.com/kb/en/library/1-connecting-connecting/)
var mariaDBSpecific: UInt32 {
get {
return UInt32(raw >> 32)
return UInt32(rawValue >> 32)
}

set {
raw |= UInt64(newValue) << 32
rawValue |= UInt64(newValue) << 32
}
}

/// Create a new `MySQLCapabilityFlags` from the upper and lower values.
public init(rawValue: UInt32) {
public init(rawValue: UInt64) {
self.rawValue = rawValue
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/MySQL/Protocol/MySQLHandshakeV10.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct MySQLHandshakeV10 {
let reserved = try bytes.requireBytes(length: 6, source: .capture())
assert(reserved == [0, 0, 0, 0, 0, 0])

if capabilities.get(CLIENT_LONG_PASSWORD) {
if capabilities.contains(.CLIENT_LONG_PASSWORD) {
/// string[4] reserved (all [00])
let reserved2 = try bytes.requireBytes(length: 4, source: .capture())
assert(reserved2 == [0, 0, 0, 0])
Expand Down
8 changes: 4 additions & 4 deletions Tests/MySQLTests/MySQLPacketTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ class MySQLPacketTests: XCTestCase {
var buffer = ByteBufferAllocator().buffer(capacity: 256)
let response = MySQLHandshakeResponse41(
capabilities: [
CLIENT_PROTOCOL_41,
CLIENT_PLUGIN_AUTH,
CLIENT_SECURE_CONNECTION,
CLIENT_CONNECT_WITH_DB
.CLIENT_PROTOCOL_41,
.CLIENT_PLUGIN_AUTH,
.CLIENT_SECURE_CONNECTION,
.CLIENT_CONNECT_WITH_DB
],
maxPacketSize: 1_073_741_824,
characterSet: MySQLCharacterSet.utf8mb4_unicode_ci,
Expand Down
1 change: 0 additions & 1 deletion Tests/MySQLTests/MySQLTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ class MySQLTests: XCTestCase {
}

func testDisconnect() throws {
return;
let client = try MySQLConnection.makeTest()
while true {
let version = try client.simpleQuery("SELECT @@version").wait()
Expand Down
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '2'

services:
cleartext:
image: mysql:5.7
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
MYSQL_DATABASE: vapor_database
MYSQL_USER: vapor_username
MYSQL_PASSWORD: vapor_password
ports:
- 3306:3306

0 comments on commit f89d2f8

Please sign in to comment.