Giter Club home page Giter Club logo

mysql-kit's Introduction

MySQL

Documentation Team Chat MIT License Continuous Integration Swift 5.2

๐Ÿฌ Non-blocking, event-driven Swift client for MySQL.

Major Releases

The table below shows a list of MySQLKit major releases alongside their compatible NIO and Swift versions.

Version NIO Swift SPM
4.0 2.0 5.2+ from: "4.0.0"
3.0 1.0 4.0+ from: "3.0.0"
2.0 N/A 3.1+ from: "2.0.0"
1.0 N/A 3.1+ from: "1.0.0"

Use the SPM string to easily include the dependency in your Package.swift file.

.package(url: "https://github.com/vapor/mysql-kit.git", from: ...)

Supported Platforms

MySQLKit supports the following platforms:

  • Ubuntu 16.04+
  • macOS 10.15+

Overview

MySQLKit is a MySQL client library built on SQLKit. It supports building and serializing MySQL-dialect SQL queries. MySQLKit uses MySQLNIO to connect and communicate with the database server asynchronously. AsyncKit is used to provide connection pooling.

Configuration

Database connection options and credentials are specified using a MySQLConfiguration struct.

import MySQLKit

let configuration = MySQLConfiguration(
    hostname: "localhost",
    port: 3306,
    username: "vapor_username",
    password: "vapor_password",
    database: "vapor_database"
)

URL string based configuration is also supported.

guard let configuration = MySQLConfiguration(url: "mysql://...") else {
    ...
}

To connect via unix-domain sockets, use unixDomainSocketPath instead of hostname and port.

let configuration = MySQLConfiguration(
    unixDomainSocketPath: "/path/to/socket",
    username: "vapor_username",
    password: "vapor_password",
    database: "vapor_database"
)

Connection Pool

Once you have a MySQLConfiguration, you can use it to create a connection source and pool.

let eventLoopGroup: EventLoopGroup = ...
defer { try! eventLoopGroup.syncShutdown() }

let pools = EventLoopGroupConnectionPool(
    source: MySQLConnectionSource(configuration: configuration), 
    on: eventLoopGroup
)
defer { pools.shutdown() }

First create a MySQLConnectionSource using the configuration struct. This type is responsible for creating new connections to your database server as needed.

Next, use the connection source to create an EventLoopGroupConnectionPool. You will also need to pass an EventLoopGroup. For more information on creating an EventLoopGroup, visit SwiftNIO's documentation. Make sure to shutdown the connection pool before it deinitializes.

EventLoopGroupConnectionPool is a collection of pools for each event loop. When using EventLoopGroupConnectionPool directly, random event loops will be chosen as needed.

pools.withConnection { conn 
    print(conn) // MySQLConnection on randomly chosen event loop
}

To get a pool for a specific event loop, use pool(for:). This returns an EventLoopConnectionPool.

let eventLoop: EventLoop = ...
let pool = pools.pool(for: eventLoop)

pool.withConnection { conn
    print(conn) // MySQLConnection on eventLoop
}

MySQLDatabase

Both EventLoopGroupConnectionPool and EventLoopConnectionPool can be used to create instances of MySQLDatabase.

let mysql = pool.database(logger: ...) // MySQLDatabase
let rows = try mysql.simpleQuery("SELECT @@version;").wait()

Visit MySQLNIO's docs for more information on using MySQLDatabase.

SQLDatabase

A MySQLDatabase can be used to create an instance of SQLDatabase.

let sql = mysql.sql() // SQLDatabase
let planets = try sql.select().column("*").from("planets").all().wait()

Visit SQLKit's docs for more information on using SQLDatabase.

mysql-kit's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mysql-kit's Issues

Building in Xcode

As mentioned in the docs, on macOS you have to specify the location of the MySQL C library when building. Can these flags also be passed to the linker from within Xcode?

Heroku dyno crash using MySQL

I recently migrated to Vapor 2.0 and I'm facing this crash on Heroku on Mac its working fine but on Heroku its crashing when to try to connect to MySQL

   drop.get("make") { req in
            mysql = try MySQL.Database.makeDB().makeConnection()
            let mysql_CHECKDB = try MySQL.Database.makeDB().makeConnection()
            return req.description
        }

When i request make it crashes

screen shot 2017-06-17 at 10 00 55 pm


extension MySQL.Database {
    static func makeDB() -> MySQL.Database {
        do {
            let mysql = try MySQL.Database(
                hostname: "127.0.0.1",
               user: "root",
               password: "",
                database: "Radar"
            )

            try mysql.makeConnection().execute("SELECT @@version")
            
            return mysql
        } catch {
            
            fatalError("MySQL Error")
        }
    }
}


Memory allocation crash with LONGTEXT columns on low-mem systems

Today, a strange low-level crash was reported on Slack, starting from here, stacktrace here.

I built a test case out of it: #102, which passes on CircleCI, but that is just a coincidence.

After some more discussion in DM, it seems that the crash is tied to the available virtual memory of the system:

  • The reporter's DigitalOcean droplet has 512 MB RAM and 2 GB swap.
  • After increasing the swap to 5 GB on the droplet, the crash disappears.
  • CircleCI has 4 GB RAM allocated for every builder VM, and the test doesn't crash.

My educated guess is that Bind tries to allocate Int32.max (2 GB) or a similar, huge block of memory UInt32.max (4294967295 bytes), that fails without enough virtual memory available.

mysql build issue

Hi,

I installed MySQL manually and the location is /usr/local/mysql and underneath this location I have the following directories - bin, lib, man etc directories

I've included .Package(url: "https://github.com/vapor/mysql-provider.git", majorVersion: 2) in Package.swift

I tried compiling vapor build --clean and get the following error
Fetching Dependencies [ โ€ข]
Error: backgroundExecute(code: 1, error: "swift-package: error: /Users/rrvemula/Documents/Development/Hello/Package.swift:10:9: error: '(arrayLiteral: Package.Dependency, _)' is not convertible to '(arrayLiteral: Package.Dependency...)', tuples have a different number of elements\n .Package(url: "https://github.com/vapor/vapor.git\", majorVersion: 2),\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nexit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --driver-mode=swift -I /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm -L /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm -lPackageDescription -target x86_64-apple-macosx10.10 /Users/rrvemula/Documents/Development/Hello/Package.swift -fileno 11\n", output: "")

I also tried vapor xcode and get the following error
Generating Xcode Project [Failed]
swift-package: error: /Users/rrvemula/Documents/Development/Hello/Package.swift:10:9: error: '(arrayLiteral: Package.Dependency, _)' is not convertible to '(arrayLiteral: Package.Dependency...)', tuples have a different number of elements
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 2),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --driver-mode=swift -I /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm -L /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm -lPackageDescription -target x86_64-apple-macosx10.10 /Users/rrvemula/Documents/Development/Hello/Package.swift -fileno 11

Error: Could not generate Xcode project: swift-package: error: /Users/rrvemula/Documents/Development/Hello/Package.swift:10:9: error: '(arrayLiteral: Package.Dependency, _)' is not convertible to '(arrayLiteral: Package.Dependency...)', tuples have a different number of elements
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 2),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --driver-mode=swift -I /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm -L /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm -lPackageDescription -target x86_64-apple-macosx10.10 /Users/rrvemula/Documents/Development/Hello/Package.swift -fileno 11

can someone please help me wit resolving this?

I looked up other issues logged (#29, #67 )but was unable to resolve it.

Connection thread safety?

In the README it says this:

... a single connection cannot be used on more than one thread

But in the documentation for Database.makeConnection() it says:

Creates a new thread-safe connection to the database that can be reused between executions.

Is Connection thread safe or is it not? The fact that makeConnection() is called before each query by defaults suggests that it probably isn't.

Establishing a new connection with the db for each query is wasteful; how can we update Connection to be totally thread safe? I don't have a very deep knowledge of the underlying C library, but based on the docs it looks like it should support multithreaded environments just fine. So which part currently isn't thread safe? cConnection shouldn't ever be mutated so I must be missing something.

Migrate 08-18

Working on a migration to 08-18, but some of the new pointer APIs are giving me trouble. Specifically, the new UnsafeMutableRawPointer behaves a little differently than UnsafeMutablePointer<Void> (no deinitialize() method, and the allocate() and deallocate() methods now require an alignedTo argument.

@tannernelson You guys have migrated some of the other packages already, so have you had to deal with these yet?

mysql_close crash

let mysql = try MySQL.Database(
            host: "127.0.0.1",
            user: "root",
            password: "secret",
            database: "ironman-old"
)

let result = try mysql.execute("SELECT * FROM checklist_items")

Running this from a command over and over will throw this error now and then

#12 0x0000000100bfc10c in Connection.deinit at /Users/casper_r/vapor/ironman/Packages/MySQL-0.5.0/Sources/MySQL/Connection.swift:44
#13 0x0000000100bfc0d1 in Connection.__deallocating_deinit ()
#14 0x0000000100bff82d in Database.execute(String, [NodeRepresentable], Connection?) throws -> [[String : Node]] at /Users/casper_r/vapor/ironman/Packages/MySQL-0.5.0/Sources/MySQL/Database.swift:205
#15 0x0000000100004b61 in CheckListItemsSeeder.run(arguments : [String]) throws -> () at /Users/casper_r/vapor/ironman/App/Commands/CheckListItemsSeeder.swift:28
#16 0x000000010000504b in protocol witness for Command.run(arguments : [String]) throws -> () in conformance CheckListItemsSeeder ()
#17 0x000000010071a385 in ConsoleProtocol.run(Group, arguments : [String]) throws -> () at /Users/casper_r/vapor/ironman/Packages/Console-0.6.2/Sources/Console/Console/Console+Run.swift:79
#18 0x000000010071aaee in ConsoleProtocol.run(executable : String, commands : [Runnable], arguments : [String], help : [String]) throws -> () at /Users/casper_r/vapor/ironman/Packages/Console-0.6.2/Sources/Console/Console/Console+Run.swift:94
#19 0x0000000100ac2d39 in Droplet.runCommands() throws -> () at /Users/casper_r/vapor/ironman/Packages/Vapor-0.17.1/Sources/Vapor/Droplet/Droplet+Serve.swift:61
#20 0x0000000100ac1d15 in Droplet.serve(() throws -> ()?) -> Never at /Users/casper_r/vapor/ironman/Packages/Vapor-0.17.1/Sources/Vapor/Droplet/Droplet+Serve.swift:14
#21 0x000000010000418f in main at /Users/casper_r/vapor/ironman/App/main.swift:71

Connection pooling

@tannernelson mentioned a while ago that this package is only meant to be a simple Swift wrapper, but I'm wondering if you've had a change of heart.

It looks like thread safety has been implemented, so I think the next step would be to add connection pooling. We can reuse a single connection now but the server will usually drop it after a few hours, so we'll probably want to maintain a small pool of connections to recycle as they expire.

What do you guys think?

TINYINT not recognized

I haven't been able to look into the reason yet, but the MySQL TINYINT type does not appear to be supported. When performing a SELECT, any fields of type TINYINT get returned as Value.null.

swift-package: error: unsatisfiable with version 2

Hi, I'm trying to work with Vapor MySQL and Kitura but I always get the error in the title when I run swift build or swift package generate-xcodeproj. It only happens with new version 2, I works perfectly with latest version 1. Here is my Package.swift

let package = Package(
  name: "Kitura-Starter",
  targets: [
    Target(name: "Kitura-Starter",
           dependencies: [.Target(name: "Controller")]),
    Target(name: "Controller")
  ],
  dependencies: [
    .Package(url: "https://github.com/IBM-Swift/Kitura.git", majorVersion: 1, minor: 7),
    .Package(url: "https://github.com/IBM-Swift/HeliumLogger.git", majorVersion: 1, minor: 7),
    .Package(url: "https://github.com/IBM-Swift/Kitura-Credentials", majorVersion: 1, minor: 7),
    .Package(url: "https://github.com/IBM-Bluemix/cf-deployment-tracker-client-swift.git", majorVersion: 3),
    .Package(url: "https://github.com/IBM-Swift/BlueCryptor.git", majorVersion: 0, minor: 8),
    .Package(url: "https://github.com/vapor/mysql.git", majorVersion: 2)
])

value enum convenience accessors

What's the reasoning behind the use of enum Value here vs. protocol Value in Fluent?

Parsing database results returned as enums is a pain - do I really have to switch on every entry in order to bind a variable to the correct type, or is there a better way to handle this?

Example:

let results = try mysql.execute("SELECT name FROM user")
let entry = results[0]
if let name = entry["name"] {
    switch name {
        case let .string(myName):
            // Finally we have our property as a String
            ...
        default:
            ...
    }
}
// And we repeat for every property fetched

Not recovering from timeout

By default, MySQL times out a connection that has been idle for more than 8 hours. Presently, vapor/mysql isn't recovering from this timeout and opening a new connection with the server, thusly causing an error to be thrown on the next query.

Return `[Node]` over `[[String: Node]]`

On database executions, I think an array of nodes might be preferable:

Pros:

  • can easily map to node initializable types

Cons:

  • might not be obvious that underlying nodes are objects

Wondering if anyone else has opinions.

Unicode characters with bytes greater than 127 cause crash

The Char type used in Bind.swift is an Int8, which only supports values up to 127. So, attempting to store any Unicode characters higher than this causes a crash. The crash occurs at line 71 in Bind.swift, while attempting to initialize a Char from a single byte if the byte's value is over 127.

Is there any reason Char can't be something bigger? Int32 should support all Unicode characters that I'm aware of.

MySQL date types are returned as NULL

Data returned as a result from an SQL select statement contains MySQL.Value.null for any fields of type DATE or TIME.

Inserting data into the db using a formatted date string as the value for a date field, using .string() in the appropriate prepared statement values, works just fine. But getting that data back out of the db results in MySQL.Value.null for those fields.

BLOB type should map to Node.bytes, not Node.string

Currently the BLOB column type goes through the same UTF-8 decoding as string types, despite the common definition (incl. MySQL's own) that BLOB (and BINARY and VARBINARY) columns store raw binary data.

I think this type should be mapped to Node.bytes(Bytes) directly, without any encoding in either direction.

MySQL Fluent Driver not returning elements

print(try mysql.driver.raw("SELECT * FROM users")) // 1 element
print(try User.all()) // []

where the DB is defined with

// ...
 ย static func prepare(_ database: Database) throws {
 ย  ย try database.create("users") {
 ย  ย  ย $0.id()
 ย  ย  ย $0.string("name")
 ย  ย  ย $0.string("email")
 ย  ย  ย $0.string("hash")
 ย  ย }
 ย }
// ...

Package.swift

  dependencies: [
    .Package(url: "https://github.com/vapor/vapor.git", majorVersion: 0, minor: 16),
    .Package(url: "https://github.com/vapor/vapor-mysql.git", majorVersion: 0, minor: 4),
  ],

Xcode build settings

It would help out if documentation explained how to set the build settings to run the from inside Xcode. In Xcode, under Basic build settings, set "Header Search Paths" to /usr/local/include/mysql and set "Library Search Paths" to /usr/local/lib.

Data gets corrupted in driver

I'm running todobackend tests against my local installation of MySQL.

State of the todos table before tests begin:

mysql> select * from todos; Empty set (0.00 sec)

First insert into the table looks good, title="walk the dog". Breaking at getAll and looking at results from a select:

mysql-first-insert

Then clear is called and `truncate table todos' is run, followed by a second insert of a todo item with the title="blah".

At another breakpoint in getAll, there's a discrepancy between what is shown in the todos table and what we see in xcode. Running select from the command line shows that the table is as expected:

correct-table-entry

However, results from select in xcode show that the title has been corrupted:

mysql-second-insert

We see this issue when multiple threads are being used. Our local test suite that runs on a single thread does not expose the problem, so it seems like a concurrency issue.

@rfdickerson

Stored procedure not returning any results.

I've been successfully using vapor/mysql for standard calls, for example:
let result = try database.execute("SELECT * FROM customers;")

But when I try a stored procedure that does the exact same thing:
let result = try database.execute("CALL selectCustomers();")
The result dictionary is empty.

I can confirm that the procedure works when calling directly from mysql.

Here is the stored procedure:

DROP PROCEDURE IF EXISTS getAllCustomers;
DELIMITER //
CREATE PROCEDURE getAllCustomers()
BEGIN
    SELECT * FROM customers;
END //
DELIMITER ;

I'm not sure if this is a bug, or is it that vapor/mysql does not support stored procedures? Any help much appreciated.

MySQL build error

My Package file:

import PackageDescription

let package = Package(
name: "WelcomAPI",
dependencies: [
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 0, minor: 16),
.Package(url: "https://github.com/vapor/vapor-mustache.git", majorVersion: 0, minor: 11),
.Package(url: "https://github.com/vapor/vapor-mysql.git", majorVersion: 0, minor: 4)
],
exclude: [
"Config",
"Database",
"Localization",
"Public",
"Resources",
"Tests",
]
)

When run "vapor build", it tells:

Fetching Dependencies [Done]
Building Project [Failed]

Command:
swift build 1>&2

Error (1):
Compile Swift Module 'SocksCore' (14 sources)
Compile Swift Module 'libc' (1 sources)
Compile Swift Module 'CryptoEssentials' (15 sources)
Compile Swift Module 'Polymorphic' (2 sources)
Compile Swift Module 'Strand' (1 sources)
Compile Swift Module 'Mustache' (29 sources)
Compile Swift Module 'PathIndexable' (2 sources)
Compile Swift Module 'Node' (21 sources)
Compile Swift Module 'Fluent' (29 sources)
Compile Swift Module 'Core' (22 sources)
Compile Swift Module 'Socks' (5 sources)
Compile Swift Module 'SocksCoreExampleTCPServer' (1 sources)
Compile Swift Module 'SocksCoreExampleTCPClient' (1 sources)
/Users/h172462/Desktop/AppDemo/WelcomeAPI/Packages/Mustache-0.0.0/Sources/Mustache/Rendering/Context.swift:101:5: warning: 'warn_unused_result' attribute behavior is now the default
@warn_unused_result(message: "Context.extendedContext returns a new Context.")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/Users/h172462/Desktop/AppDemo/WelcomeAPI/Packages/Mustache-0.0.0/Sources/Mustache/Rendering/Context.swift:114:5: warning: 'warn_unused_result' attribute behavior is now the default
@warn_unused_result(message: "Context.contextWithRegisteredKey returns a new Context.")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Compile Swift Module 'SocksExampleUDPServer' (1 sources)
Compile Swift Module 'SocksExampleUDPClient' (1 sources)
Compile Swift Module 'SocksExampleTCPServer' (1 sources)
Compile Swift Module 'SocksExampleTCPClient' (1 sources)
Compile Swift Module 'SocksCoreExampleTCPKeepAliveServer' (1 sources)
Linking ./.build/debug/SocksCoreExampleTCPClient
Linking ./.build/debug/SocksCoreExampleTCPServer
Linking ./.build/debug/SocksExampleUDPClient
Linking ./.build/debug/SocksExampleTCPClient
Linking ./.build/debug/SocksExampleUDPServer
Linking ./.build/debug/SocksExampleTCPServer
Linking ./.build/debug/SocksCoreExampleTCPKeepAliveServer
Compile Swift Module 'SHA1' (1 sources)
Compile Swift Module 'SHA2' (1 sources)
Compile Swift Module 'HMAC' (1 sources)
Compile Swift Module 'Console' (34 sources)
Compile Swift Module 'JSON' (7 sources)
Compile Swift Module 'MySQL' (9 sources)
:1:9: note: in file included from :1:

import "/usr/local/include/mysql/mysql.h"

    ^

/usr/local/include/mysql/mysql.h:64:10: note: in file included from /usr/local/include/mysql/mysql.h:64:

include "mysql/client_plugin.h"

     ^

/usr/local/include/mysql/mysql/client_plugin.h:103:10: error: 'mysql/plugin_auth_common.h' file not found

include <mysql/plugin_auth_common.h>

     ^

/Users/h172462/Desktop/AppDemo/WelcomeAPI/Packages/MySQL-0.4.0/Sources/MySQL/Bind+Node.swift:4:12: error: could not build Objective-C module 'CMySQLMac'
import CMySQLMac
^
:1:9: note: in file included from :1:

import "/usr/local/include/mysql/mysql.h"

    ^

/usr/local/include/mysql/mysql.h:64:10: note: in file included from /usr/local/include/mysql/mysql.h:64:

include "mysql/client_plugin.h"

     ^

/usr/local/include/mysql/mysql/client_plugin.h:103:10: error: 'mysql/plugin_auth_common.h' file not found

include <mysql/plugin_auth_common.h>

     ^

/Users/h172462/Desktop/AppDemo/WelcomeAPI/Packages/MySQL-0.4.0/Sources/MySQL/Bind+Node.swift:4:12: error: could not build Objective-C module 'CMySQLMac'
import CMySQLMac
^
:1:9: note: in file included from :1:

import "/usr/local/include/mysql/mysql.h"

    ^

/usr/local/include/mysql/mysql.h:64:10: note: in file included from /usr/local/include/mysql/mysql.h:64:

include "mysql/client_plugin.h"

     ^

/usr/local/include/mysql/mysql/client_plugin.h:103:10: error: 'mysql/plugin_auth_common.h' file not found

include <mysql/plugin_auth_common.h>

     ^

/Users/h172462/Desktop/AppDemo/WelcomeAPI/Packages/MySQL-0.4.0/Sources/MySQL/Bind+Node.swift:4:12: error: could not build Objective-C module 'CMySQLMac'
import CMySQLMac
^
:1:9: note: in file included from :1:

import "/usr/local/include/mysql/mysql.h"

    ^

/usr/local/include/mysql/mysql.h:64:10: note: in file included from /usr/local/include/mysql/mysql.h:64:

include "mysql/client_plugin.h"

     ^

/usr/local/include/mysql/mysql/client_plugin.h:103:10: error: 'mysql/plugin_auth_common.h' file not found

include <mysql/plugin_auth_common.h>

     ^

/Users/h172462/Desktop/AppDemo/WelcomeAPI/Packages/MySQL-0.4.0/Sources/MySQL/Bind+Node.swift:4:12: error: could not build Objective-C module 'CMySQLMac'
import CMySQLMac
^
:1:9: note: in file included from :1:

import "/usr/local/include/mysql/mysql.h"

    ^

/usr/local/include/mysql/mysql.h:64:10: note: in file included from /usr/local/include/mysql/mysql.h:64:

include "mysql/client_plugin.h"

     ^

/usr/local/include/mysql/mysql/client_plugin.h:103:10: error: 'mysql/plugin_auth_common.h' file not found

include <mysql/plugin_auth_common.h>

     ^

/Users/h172462/Desktop/AppDemo/WelcomeAPI/Packages/MySQL-0.4.0/Sources/MySQL/Bind+Node.swift:4:12: error: could not build Objective-C module 'CMySQLMac'
import CMySQLMac
^
:1:9: note: in file included from :1:

import "/usr/local/include/mysql/mysql.h"

    ^

/usr/local/include/mysql/mysql.h:64:10: note: in file included from /usr/local/include/mysql/mysql.h:64:

include "mysql/client_plugin.h"

     ^

/usr/local/include/mysql/mysql/client_plugin.h:103:10: error: 'mysql/plugin_auth_common.h' file not found

include <mysql/plugin_auth_common.h>

     ^

/Users/h172462/Desktop/AppDemo/WelcomeAPI/Packages/MySQL-0.4.0/Sources/MySQL/Bind+Node.swift:4:12: error: could not build Objective-C module 'CMySQLMac'
import CMySQLMac
^
:1:9: note: in file included from :1:

import "/usr/local/include/mysql/mysql.h"

    ^

/usr/local/include/mysql/mysql.h:64:10: note: in file included from /usr/local/include/mysql/mysql.h:64:

include "mysql/client_plugin.h"

     ^

/usr/local/include/mysql/mysql/client_plugin.h:103:10: error: 'mysql/plugin_auth_common.h' file not found

include <mysql/plugin_auth_common.h>

     ^

/Users/h172462/Desktop/AppDemo/WelcomeAPI/Packages/MySQL-0.4.0/Sources/MySQL/Bind+Node.swift:4:12: error: could not build Objective-C module 'CMySQLMac'
import CMySQLMac
^
:1:9: note: in file included from :1:

import "/usr/local/include/mysql/mysql.h"

    ^

/usr/local/include/mysql/mysql.h:64:10: note: in file included from /usr/local/include/mysql/mysql.h:64:

include "mysql/client_plugin.h"

     ^

/usr/local/include/mysql/mysql/client_plugin.h:103:10: error: 'mysql/plugin_auth_common.h' file not found

include <mysql/plugin_auth_common.h>

     ^

/Users/h172462/Desktop/AppDemo/WelcomeAPI/Packages/MySQL-0.4.0/Sources/MySQL/Bind+Node.swift:4:12: error: could not build Objective-C module 'CMySQLMac'
import CMySQLMac
^
:0: error: build had 1 command failures
swift-build: error: exit(1): /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-07-25-a.xctoolchain/usr/bin/swift-build-tool -f /Users/h172462/Desktop/AppDemo/WelcomeAPI/.build/debug.yaml

Toolchain:
/Users/h172462/.swiftenv/shims/swift

Help:
Join our Slack where hundreds of contributors
are waiting to help: http://slack.qutheory.io

Error: Build failed.

And build by Xcode, it tells:

/usr/local/include/mysql/mysql/client_plugin.h:103:10: 'mysql/plugin_auth_common.h' file not found
/Users/h172462/Desktop/AppDemo/WelcomeAPI/Packages/MySQL-0.4.0/Sources/MySQL/Bind+Node.swift:4:12: Could not build Objective-C module 'CMySQLMac'

could you help me to find out the cause?

is it possible to use this mySQL wrapper in iPhone application?

Hi!
I dealed some time with vapor, spm and these stuffs which are new for me, but I think first I had to ask this question. Can I remote mySQL database from iPhone app with this wrapper or is it just for Desktop applications? Because I've read about this on many sites, that connect to a MySQL database with iPhone it's not safe, and not recommended, and everyone recommend to write php scripts to remote mySQL database... Thank you for your answer and help.

could not compile mysql

the same problem

swift build -Xswiftc -I/usr/local/mysql/include -Xlinker -L/usr/local/mysql/lib

Cloning https://github.com/vapor/cmysql.git
HEAD is now at 6db7362 update brew location
Resolved version: 0.2.1
Cloning https://github.com/vapor/node.git
HEAD is now at 575f309 Merge pull request #9 from vapor/rename
Resolved version: 0.4.0
Cloning https://github.com/vapor/path-indexable.git
HEAD is now at 46c625e Merge pull request #3 from qutheory/07-20
Resolved version: 0.3.0
Cloning https://github.com/vapor/polymorphic.git
HEAD is now at 32434fa update readme
Resolved version: 0.3.1
Cloning https://github.com/vapor/core.git
HEAD is now at 8326d19 Merge pull request #4 from qutheory/07-25
Resolved version: 0.3.0
Cloning https://github.com/vapor/json.git
HEAD is now at 51d5373 Merge pull request #5 from vapor/rename
Resolved version: 0.4.0
Compile Swift Module 'Polymorphic' (2 sources)
Compile Swift Module 'PathIndexable' (2 sources)
Compile Swift Module 'libc' (1 sources)
Compile Swift Module 'Node' (21 sources)
Compile Swift Module 'Core' (22 sources)
Compile Swift Module 'JSON' (7 sources)
Compile Swift Module 'MySQL' (9 sources)
/Users/yh/as/mysql/Sources/MySQL/Bind+Node.swift:43:31: error: use of unresolved identifier 'MYSQL_TYPE_JSON'
                if variant == MYSQL_TYPE_JSON {
                              ^~~~~~~~~~~~~~~
Unsortable locations found
UNREACHABLE executed at /Users/buildnode/jenkins/workspace/oss-swift-package-osx/llvm/tools/clang/lib/Basic/SourceManager.cpp:2113!
0  swift                    0x0000000109e9b89b llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43
1  swift                    0x0000000109e9aae6 llvm::sys::RunSignalHandlers() + 70
2  swift                    0x0000000109e9bfef SignalHandler(int) + 383
3  libsystem_platform.dylib 0x00007fff8fd1452a _sigtramp + 26
4  swift                    0x000000010aa91601 cmark_strbuf__initbuf + 71552
5  swift                    0x0000000109e9bd3e abort + 14
6  swift                    0x0000000109e3b707 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 471
7  swift                    0x0000000109f16457 clang::SourceManager::isBeforeInTranslationUnit(clang::SourceLocation, clang::SourceLocation) const + 1415
8  swift                    0x00000001089c8e44 std::__1::back_insert_iterator<std::__1::vector<clang::RawComment*, std::__1::allocator<clang::RawComment*> > > std::__1::__merge<clang::BeforeThanCompare<clang::RawComment>&, std::__1::__wrap_iter<clang::RawComment**>, clang::RawComment* const*, std::__1::back_insert_iterator<std::__1::vector<clang::RawComment*, std::__1::allocator<clang::RawComment*> > > >(std::__1::__wrap_iter<clang::RawComment**>, std::__1::__wrap_iter<clang::RawComment**>, clang::RawComment* const*, clang::RawComment* const*, std::__1::back_insert_iterator<std::__1::vector<clang::RawComment*, std::__1::allocator<clang::RawComment*> > >, clang::BeforeThanCompare<clang::RawComment>&) + 84
9  swift                    0x00000001089c8d93 clang::RawCommentList::addDeserializedComments(llvm::ArrayRef<clang::RawComment*>) + 131
10 swift                    0x0000000108107dda clang::ASTReader::ReadComments() + 746
11 swift                    0x000000010883f522 clang::ASTContext::getRawCommentForDeclNoCache(clang::Decl const*) const + 66
12 swift                    0x000000010883fdcb clang::ASTContext::getRawCommentForAnyRedecl(clang::Decl const*, clang::Decl const**) const + 443
13 swift                    0x0000000107b08fb3 (anonymous namespace)::PrintAST::printDocumentationComment(swift::Decl const*) + 131
14 swift                    0x0000000107b0896a (anonymous namespace)::PrintAST::visitVarDecl(swift::VarDecl*) + 26
15 swift                    0x0000000107afa91d (anonymous namespace)::PrintAST::visit(swift::Decl*) + 429
16 swift                    0x0000000107afa68b swift::Decl::print(swift::ASTPrinter&, swift::PrintOptions const&) const + 59
17 swift                    0x0000000107ba9ec3 swift::DiagnosticEngine::emitDiagnostic(swift::Diagnostic const&) + 2163
18 swift                    0x0000000107ba945c swift::DiagnosticEngine::flushActiveDiagnostic() + 316
19 swift                    0x0000000107a7024b swift::TypeChecker::noteTypoCorrection(swift::DeclName, swift::DeclNameLoc, swift::LookupResult::Result const&) + 907
20 swift                    0x0000000107a1a017 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 4455
21 swift                    0x0000000107a25332 (anonymous namespace)::PreCheckExpression::walkToExprPre(swift::Expr*) + 418
22 swift                    0x0000000107b24c98 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 1512
23 swift                    0x0000000107b23a14 swift::Expr::walk(swift::ASTWalker&) + 84
24 swift                    0x0000000107a1a76d swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 221
25 swift                    0x0000000107a20b71 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 625
26 swift                    0x0000000107a227a2 swift::TypeChecker::typeCheckCondition(swift::Expr*&, swift::DeclContext*) + 178
27 swift                    0x0000000107a22994 swift::TypeChecker::typeCheckStmtCondition(llvm::MutableArrayRef<swift::StmtConditionElement>&, swift::DeclContext*, swift::Diag<>) + 404
28 swift                    0x0000000107a9a7ef swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 1743
29 swift                    0x0000000107a9a26e swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 334
30 swift                    0x0000000107a9a856 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 1846
31 swift                    0x0000000107a9a26e swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 334
32 swift                    0x0000000107a99619 (anonymous namespace)::StmtChecker::typeCheckBody(swift::BraceStmt*&) + 25
33 swift                    0x0000000107a988ef swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 383
34 swift                    0x0000000107a98713 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 35
35 swift                    0x0000000107a99294 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 180
36 swift                    0x0000000107a53306 typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) + 166
37 swift                    0x0000000107a53fa0 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1568
38 swift                    0x00000001076ff7bc swift::CompilerInstance::performSema() + 3916
39 swift                    0x00000001071ff57a performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 442
40 swift                    0x00000001071fe0ef swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2895
41 swift                    0x00000001071c0c20 main + 2448
42 libdyld.dylib            0x00007fff8bcdf5ad start + 1
43 libdyld.dylib            0x0000000000000030 start + 1949436548
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-07-25-a.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/yh/as/mysql/Sources/MySQL/Bind+Node.swift /Users/yh/as/mysql/Sources/MySQL/Bind.swift /Users/yh/as/mysql/Sources/MySQL/Binds.swift /Users/yh/as/mysql/Sources/MySQL/Connection.swift /Users/yh/as/mysql/Sources/MySQL/Database.swift /Users/yh/as/mysql/Sources/MySQL/Field+Variant.swift /Users/yh/as/mysql/Sources/MySQL/Field.swift /Users/yh/as/mysql/Sources/MySQL/Fields.swift /Users/yh/as/mysql/Sources/MySQL/MySQL+Node.swift -target x86_64-apple-macosx10.10 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I /Users/yh/as/mysql/.build/debug -I /usr/local/mysql/include -F /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -enable-testing -g -module-cache-path /Users/yh/as/mysql/.build/debug/ModuleCache -D SWIFT_PACKAGE -Xcc -fmodule-map-file=/Users/yh/as/mysql/Packages/CMySQL-0.2.1/module.modulemap -emit-module-doc-path /Users/yh/as/mysql/.build/debug/MySQL.build/Bind+Node~partial.swiftdoc -Onone -parse-as-library -module-name MySQL -emit-module-path /Users/yh/as/mysql/.build/debug/MySQL.build/Bind+Node~partial.swiftmodule -emit-dependencies-path /Users/yh/as/mysql/.build/debug/MySQL.build/Bind+Node.d -emit-reference-dependencies-path /Users/yh/as/mysql/.build/debug/MySQL.build/Bind+Node.swiftdeps -num-threads 8 -o /Users/yh/as/mysql/.build/debug/MySQL.build/Bind+Node.swift.o 
1.  While type-checking getter for value at /Users/yh/as/mysql/Sources/MySQL/Bind+Node.swift:18:28
2.  While type-checking expression at [/Users/yh/as/mysql/Sources/MySQL/Bind+Node.swift:43:20 - line:43:31] RangeText="variant == M"
<unknown>:0: error: unable to execute command: Illegal instruction: 4
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
/Users/yh/as/mysql/Sources/MySQL/Field+Variant.swift:26:24: error: use of unresolved identifier 'MYSQL_TYPE_JSON'
            if self == MYSQL_TYPE_JSON {
                       ^~~~~~~~~~~~~~~
Unsortable locations found
UNREACHABLE executed at /Users/buildnode/jenkins/workspace/oss-swift-package-osx/llvm/tools/clang/lib/Basic/SourceManager.cpp:2113!
0  swift                    0x00000001109cf89b llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43
1  swift                    0x00000001109ceae6 llvm::sys::RunSignalHandlers() + 70
2  swift                    0x00000001109cffef SignalHandler(int) + 383
3  libsystem_platform.dylib 0x00007fff8fd1452a _sigtramp + 26
4  swift                    0x00000001115c5601 cmark_strbuf__initbuf + 71552
5  swift                    0x00000001109cfd3e abort + 14
6  swift                    0x000000011096f707 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 471
7  swift                    0x0000000110a4a457 clang::SourceManager::isBeforeInTranslationUnit(clang::SourceLocation, clang::SourceLocation) const + 1415
8  swift                    0x000000010f4fce44 std::__1::back_insert_iterator<std::__1::vector<clang::RawComment*, std::__1::allocator<clang::RawComment*> > > std::__1::__merge<clang::BeforeThanCompare<clang::RawComment>&, std::__1::__wrap_iter<clang::RawComment**>, clang::RawComment* const*, std::__1::back_insert_iterator<std::__1::vector<clang::RawComment*, std::__1::allocator<clang::RawComment*> > > >(std::__1::__wrap_iter<clang::RawComment**>, std::__1::__wrap_iter<clang::RawComment**>, clang::RawComment* const*, clang::RawComment* const*, std::__1::back_insert_iterator<std::__1::vector<clang::RawComment*, std::__1::allocator<clang::RawComment*> > >, clang::BeforeThanCompare<clang::RawComment>&) + 84
9  swift                    0x000000010f4fcd93 clang::RawCommentList::addDeserializedComments(llvm::ArrayRef<clang::RawComment*>) + 131
10 swift                    0x000000010ec3bdda clang::ASTReader::ReadComments() + 746
11 swift                    0x000000010f373522 clang::ASTContext::getRawCommentForDeclNoCache(clang::Decl const*) const + 66
12 swift                    0x000000010f373dcb clang::ASTContext::getRawCommentForAnyRedecl(clang::Decl const*, clang::Decl const**) const + 443
13 swift                    0x000000010e63cfb3 (anonymous namespace)::PrintAST::printDocumentationComment(swift::Decl const*) + 131
14 swift                    0x000000010e63c96a (anonymous namespace)::PrintAST::visitVarDecl(swift::VarDecl*) + 26
15 swift                    0x000000010e62e91d (anonymous namespace)::PrintAST::visit(swift::Decl*) + 429
16 swift                    0x000000010e62e68b swift::Decl::print(swift::ASTPrinter&, swift::PrintOptions const&) const + 59
17 swift                    0x000000010e6ddec3 swift::DiagnosticEngine::emitDiagnostic(swift::Diagnostic const&) + 2163
18 swift                    0x000000010e6dd45c swift::DiagnosticEngine::flushActiveDiagnostic() + 316
19 swift                    0x000000010e5a424b swift::TypeChecker::noteTypoCorrection(swift::DeclName, swift::DeclNameLoc, swift::LookupResult::Result const&) + 907
20 swift                    0x000000010e54e017 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 4455
21 swift                    0x000000010e559332 (anonymous namespace)::PreCheckExpression::walkToExprPre(swift::Expr*) + 418
22 swift                    0x000000010e658c98 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 1512
23 swift                    0x000000010e657a14 swift::Expr::walk(swift::ASTWalker&) + 84
24 swift                    0x000000010e54e76d swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 221
25 swift                    0x000000010e554b71 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 625
26 swift                    0x000000010e5567a2 swift::TypeChecker::typeCheckCondition(swift::Expr*&, swift::DeclContext*) + 178
27 swift                    0x000000010e556994 swift::TypeChecker::typeCheckStmtCondition(llvm::MutableArrayRef<swift::StmtConditionElement>&, swift::DeclContext*, swift::Diag<>) + 404
28 swift                    0x000000010e5ce7ef swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 1743
29 swift                    0x000000010e5ce26e swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 334
30 swift                    0x000000010e5cd619 (anonymous namespace)::StmtChecker::typeCheckBody(swift::BraceStmt*&) + 25
31 swift                    0x000000010e5cc8ef swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 383
32 swift                    0x000000010e5cc713 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 35
33 swift                    0x000000010e5cd294 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 180
34 swift                    0x000000010e587306 typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) + 166
35 swift                    0x000000010e587fa0 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1568
36 swift                    0x000000010e2337bc swift::CompilerInstance::performSema() + 3916
37 swift                    0x000000010dd3357a performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 442
38 swift                    0x000000010dd320ef swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2895
39 swift                    0x000000010dcf4c20 main + 2448
40 libdyld.dylib            0x00007fff8bcdf5ad start + 1
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-07-25-a.xctoolchain/usr/bin/swift -frontend -c /Users/yh/as/mysql/Sources/MySQL/Bind+Node.swift /Users/yh/as/mysql/Sources/MySQL/Bind.swift /Users/yh/as/mysql/Sources/MySQL/Binds.swift /Users/yh/as/mysql/Sources/MySQL/Connection.swift /Users/yh/as/mysql/Sources/MySQL/Database.swift -primary-file /Users/yh/as/mysql/Sources/MySQL/Field+Variant.swift /Users/yh/as/mysql/Sources/MySQL/Field.swift /Users/yh/as/mysql/Sources/MySQL/Fields.swift /Users/yh/as/mysql/Sources/MySQL/MySQL+Node.swift -target x86_64-apple-macosx10.10 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I /Users/yh/as/mysql/.build/debug -I /usr/local/mysql/include -F /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -enable-testing -g -module-cache-path /Users/yh/as/mysql/.build/debug/ModuleCache -D SWIFT_PACKAGE -Xcc -fmodule-map-file=/Users/yh/as/mysql/Packages/CMySQL-0.2.1/module.modulemap -emit-module-doc-path /Users/yh/as/mysql/.build/debug/MySQL.build/Field+Variant~partial.swiftdoc -Onone -parse-as-library -module-name MySQL -emit-module-path /Users/yh/as/mysql/.build/debug/MySQL.build/Field+Variant~partial.swiftmodule -emit-dependencies-path /Users/yh/as/mysql/.build/debug/MySQL.build/Field+Variant.d -emit-reference-dependencies-path /Users/yh/as/mysql/.build/debug/MySQL.build/Field+Variant.swiftdeps -num-threads 8 -o /Users/yh/as/mysql/.build/debug/MySQL.build/Field+Variant.swift.o 
1.  While type-checking getter for description at /Users/yh/as/mysql/Sources/MySQL/Field+Variant.swift:24:36
2.  While type-checking expression at [/Users/yh/as/mysql/Sources/MySQL/Field+Variant.swift:26:16 - line:26:24] RangeText="self == M"
<unknown>:0: error: unable to execute command: Illegal instruction: 4
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
<unknown>:0: error: build had 1 command failures
error: exit(1): /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-07-25-a.xctoolchain/usr/bin/swift-build-tool -f /Users/yh/as/mysql/.build/debug.yaml

implement closed

There needs to be some indication on the connection when it has closed or become unusable

Poor query performance with large result sets

Consider the simplest and most naive of the database queries, where thing is a table with two varchar(255) columns and 50000 rows of fake data:

let db = try Database(host: "127.0.0.1",
                      user: "root",
                      password: "",
                      database: "test")

let result = try db.execute("SELECT * FROM thing")

Running this query takes more than 2 seconds in a debug build, little more than 1 second in a release build on a 2015 MBP. The numbers are striking, the query is an order of magnitude slower than the time needed for the actual SQL fetch! (Tested by commenting out the parsing code from Connection).


After playing around with Instruments, I found a few bottlenecks:

  • The field names are converted from C to Swift strings for every row (see #79 for the fix; ~40% time reduction)
  • Decoding strings byte-by-byte takes most of the time (see next section)
  • Creating a new dictionary for every row causes unnecessary allocations here (see #81; ~5% reduction)
  • Hashing strings to build a dictionary is slow (which probably cannot be helped...)

I spent a few waking hours trying to replace the UTF8 decoding code, without a viable result.

Using the String(bytes:encoding:) initializer on the buffer (just like in the Postgres driver) gave me blazing fast results(*), but the whole result set was leaked, despite the fact that no native memory should be retained by the pointer operations. To reproduce, replace these lines with the Postgres decoding code.

(*) In terms of running time, fixing this would grant a tolerable result, only 3 times slower than the raw fetch.

Any insight is welcome.

TimeZone extension causes crash on Linux

Hi there,

I've found an issue in the latest release of vapor/mysql. In Bind.swift, around line 250, there is this extension to Foundation's TimeZone.

extension TimeZone {
    static let utc = TimeZone(abbreviation: "UTC")!
}

When running this code on Ubuntu 16.04, I'm encountering a crash for unwrapping a nil Optional. It appears that some (possibly all? I've only confirmed this in docker ubuntu 16.04) Linux instances are unable to recognize the "UTC" abbreviation.

Impact Scope
In my testing, this makes all DB writes to mysql fail on Ubuntu 16.04. Read operations work for me.

I have only tested on Ubuntu 16.04 inside a docker container (ubuntu:16.04 image to be exact). I have not tested to see if there is some library that could be installed to mitigate this, but I haven't found anything in the Foundation docs to indicate that this should be needed.

Repro Steps

import Foundation

extension TimeZone {
static let utc = TimeZone(secondsFromGMT: 0)!
}

let utc = TimeZone.utc

Compile/run this code using swiftc on Ubuntu 16.04.

Fix
In my testing, I'm able to workaround this by changing that code to a different initializer:

static let utc = TimeZone(secondsFromGMT: 0)!

However, I don't suggest this as the actual fix because it still uses force-unwrapping, which we really shouldn't be doing. Ideally, the package should account for the possibility of TimeZone.init returning nil, as all Apple's currently documented initializers can do so.

Cannot invoke 'Database' with an argument list of type '(host: String, user: String, password: String, database: String)'

I have migrated my code to Vapor 2.0 and i'm facing this error
Cannot invoke 'Database' with an argument list of type '(host: String, user: String, password: String, database: String)'

extension MySQL.Database {
    static func makeConnection() -> MySQL.Database {
        do {
            let mysql = try MySQL.Database(
                host: "127.0.0.1",
                user: "root",
                password: "",
                database: "Radar"
            )
            try mysql.execute("SELECT @@version")
            return mysql
        } catch {

            fatalError("MySQL Error")
        }
    }
}

screen shot 2017-06-16 at 3 57 38 pm

Mapping Integer and Double values to TIMESTAMP fields on DB

When using Int or Double on makeNode() for a date field inside a Fluent Model, MySQL fails to map the value to a TIMESTAMP field.

Source code example (Double):

struct Location: Model {
    var id: Node?
    var createdAt: Date

    func makeNode(context: Context) throws -> Node {
        return try Node(node: [
            "id": id,
            "created_at": createdAt.timeIntervalSince1970  // NSTimeInterval == Double
        ])
}

Source code example (Int):

struct Location: Model {
    var id: Node?
    var createdAt: Date

    func makeNode(context: Context) throws -> Node {
        return try Node(node: [
            "id": id,
            "created_at": Int(createdAt.timeIntervalSince1970)  // Int
        ])
}

Error response:

[to be updated]

Issue with Vapor/MySQL and Kaitura over Docker

Hi guys,

So i am a newbie, and in my environment, im running Kaitura over Docker. I have installed the necessary headers I believe and MySQL on that environment, as well as on my mac.

Now when i run swift build I get the following console error:

/projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ Compile Swift Module 'LoggerAPI' (1 sources) /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ Compile Swift Module 'Core' (28 sources) Compile Swift Module 'Node' (22 sources) /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ /projects/project7/.build/debug/CHTTPParser.build/module.modulemap:2:14: error: umbrella directory '/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include' not found umbrella "/Users/doronkatz/Development/Server/project7/Packages/CHTTPParser-0.3.0/Sources/CHTTPParser/include" ^ <unknown>:0: error: build had 5 command failures error: exit(1): /root/swift-3.0.1-RELEASE-ubuntu16.04/usr/bin/swift-build-tool -f /projects/project7/.build/debug.yaml

My Package.swift is as follows:

`
import PackageDescription

let package = Package(
name: "project7",
dependencies: [
    .Package(url: "https://github.com/IBM-Swift/Kitura.git", majorVersion: 1),
    .Package(url: "https://github.com/IBM-Swift/HeliumLogger.git", majorVersion: 1),
    .Package(url: "https://github.com/IBM-Swift/BlueCryptor.git", majorVersion: 0, minor: 8),
    .Package(url: "https://github.com/vapor/mysql.git", majorVersion: 1),
]

)
`

Im on Swift 3.0.1. Not sur what else I can do on my end... Any assistance would be great. If it is a Kaitura issue let me know, so I can move it onto the right forum.

Thanks!

Fully qualified table names

The table name used in the SQL statements needs to include the database name from the initialization settings. For example, if the MySql database name is test, then select from users SQL statement would look like SELECT * FROM test.users

Prepared statements with NodeRepresentable

On the main page, it says to use the Values-enum in prepared statements, but this has been changed out with NodeRepresentable. I cannot find out how to do create prepared statements anymore.

Unable to invoke subcommands

Hi!
I followed your installation guide, installed and link successfully mysql, etc. But after I run this command> swift build -Xswiftc -I/usr/local/include/mysql -Xlinker -L/usr/local/lib
I get the following error message > error: unable to invoke subcommand: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build (No such file or directory)
How can I solve this problem or what did I in a wrong way? My xCode Verision is> Version 7.3.1 (7D1014) and I installed Swift June 20, 2016 development snapshot.
Thanks

get connection issue on ubuntu

os: ubuntu 14.04 lts
mysql: 5.7.16
mysql error logs:

2016-11-12T13:11:45.268776Z 3 [Note] Aborted connection 3 to db: 'xxxx' user: 'root' host: 'localhost' (Got an error reading communication packets)

my app use vapor/mysql library just crash, console log: Trace/breakpoint trap

Storing special chars crashes

Fx storing the string

"KMD IRONMAN Denmark added 399 new photos to the album: IRONKIDS Copenhagen 2016 โ€” with Julie Damstedt and Simon Smith."

Will crash at Bind.swift

  public convenience init(_ string: String) {
        let bytes = Array(string.utf8)
        let buffer = UnsafeMutablePointer<Char>.allocate(capacity: bytes.count)
        for (i, byte) in bytes.enumerated() {
            buffer[i] = Char(byte) //HERE
        }

        self.init(type: MYSQL_TYPE_STRING, buffer: buffer, bufferLength: bytes.count)
    }

mysql build error

Getting build error when i run:

vapor build --mysql

Not much documentation on how to install any dependencies for this project in their [website][1]. From the stack trace, it seems im missing 'lmysqlclient' which im not sure if im supposed to add to the linker flags or is this something that needs to be added to the vapor config (im pretty new to vapor).

Any help greatly appreciated!

Here is the stack trace:

computer:Server user$ swift build -Xswiftc -I/usr/local/mysql/include -Xlinker -L/usr/local/mysql/lib -Xswiftc -DNOJSON
Linking CLibreSSL
Compile Swift Module 'TurnstileCrypto' (3 sources)
Compile Swift Module 'Jay' (21 sources)
Compile Swift Module 'SocksCore' (14 sources)
Compile Swift Module 'Polymorphic' (2 sources)
Compile Swift Module 'PathIndexable' (2 sources)
Compile Swift Module 'libc' (1 sources)
Compile Swift Module 'Core' (28 sources)
ld: warning: directory not found for option '-L/usr/local/mysql/lib'
Compile Swift Module 'Node' (22 sources)
Compile Swift Module 'Socks' (5 sources)
Compile Swift Module 'Fluent' (35 sources)
Compile Swift Module 'Essentials' (2 sources)
Compile Swift Module 'TLS' (7 sources)
Compile Swift Module 'Console' (34 sources)
Compile Swift Module 'Leaf' (34 sources)
Compile Swift Module 'JSON' (8 sources)
Compile Swift Module 'Turnstile' (13 sources)
Compile Swift Module 'Random' (3 sources)
Compile Swift Module 'Cipher' (2 sources)
Compile Swift Module 'MySQL' (10 sources)
Compile Swift Module 'TurnstileWeb' (8 sources)
Compile Swift Module 'BCrypt' (1 sources)
Compile Swift Module 'Hash' (3 sources)
Compile Swift Module 'HMAC' (2 sources)
Compile Swift Module 'FluentMySQL' (2 sources)
Compile Swift Module 'URI' (10 sources)
Compile Swift Module 'Transport' (8 sources)
Compile Swift Module 'HTTP' (33 sources)
Compile Swift Module 'SMTP' (21 sources)
Compile Swift Module 'WebSockets' (14 sources)
Compile Swift Module 'Settings' (10 sources)
Compile Swift Module 'Cookies' (11 sources)
Compile Swift Module 'Cache' (3 sources)
Compile Swift Module 'Routing' (9 sources)
Compile Swift Module 'HTTPRouting' (5 sources)
Compile Swift Module 'Sessions' (6 sources)
Compile Swift Module 'Auth' (14 sources)
Compile Swift Module 'TypeSafeRouting' (3 sources)
Compile Swift Module 'Vapor' (86 sources)
Compile Swift Module 'VaporMySQL' (1 sources)
Compile Swift Module 'App' (3 sources)
Linking ./.build/debug/App
ld: warning: directory not found for option '-L/usr/local/mysql/lib'
ld: library not found for -lmysqlclient for architecture x86_64
:0: error: link command failed with exit code 1 (use -v to see invocation)
:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode/10.0/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/user/test/Server/.build/debug.yaml

Multiple mysql connection crash on Heroku

When I try to make multiple MySQL Connection on Heroku it crash


extension Droplet {
    
    func setupRoutes() throws {
        var mysql = MySQL.Database.makeTest()

        get("hello") { req in
            var json = JSON()
            try json.set("hello", "world")
            return json
        }

        get("test") { req in
            
            let conn = try mysql.makeConnection()
            
            try conn.execute("DROP TABLE IF EXISTS spam")
            try conn.execute("CREATE TABLE spam (s VARCHAR(64), time TIME)")
            
            for _ in 0..<10_000 {
                try conn.execute("INSERT INTO spam VALUES (?, ?)", ["hello", "13:42"])
            }
            
            let conn2 = try mysql.makeConnection() //HEROKU CRASH HERE
            try conn2.execute("SELECT * FROM spam")
            return req.description

        }

        // response to requests to /info domain
        // with a description of the request
        get("info") { req in
            return req.description
        }

        get("description") { req in return req.description }
        
        try resource("posts", PostController.self)
    }
}
extension MySQL.Database {
    static func makeTest() -> MySQL.Database {
        do {
            let mysql = try MySQL.Database(
                hostname: "****",
                user: "*****",
                password: "******",
                database: "*****"
            )
            let connection = try mysql.makeConnection()
            try connection.execute("SELECT @@version")
            
            return mysql
        } catch {
            
            fatalError("MySQL ERROR")
        }
    }
}

Foreign Keys between tables

When preparing schemas with relations to other tables through the prepare function on the Preparation protocol, foreign key relations do not seem to be created in the database, even if the parent method on Schema is used.

For example, for the following schema (specifically the review table),
screen shot 2016-10-03 at 3 15 26 pm
created with the following code,

static func prepare(_ database: Database) throws {
        try database.create(self.entity, closure: { box in
            box.id()
            box.string("description")
            box.string("rating")
            box.string("date")
            box.parent(Box.self, optional: false)
            box.parent(User.self, optional: false)
        })
    }

one would expect that foreign key relations should be created within the database. However, none seem to be created. I'm certainly no expert when it comes to MySQL databases, so I do not know if this is a big problem or not, but I just wanted to check in with you guys to see if this was an issue.

P.S. For clarification, generating code that looks something like this

CONSTRAINT `fk_review_box1`
    FOREIGN KEY (`box_id` , `box_vendor_id`)
    REFERENCES `mydb`.`box` (`id` , `vendor_id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,

would create the missing link that I was talking about above.

MySQL POINT type creates trap on SELECT

Using 1.0.0 I executed try mysql.execute("CREATE TABLE locations (location POINT)") to create a table with a column of type POINT. I then noticed that running SELECT * FROM locations was throwing an exception with outputBind("") as the error.

As a working example I posted a Swift application here: https://github.com/iachievedit/point

The issue is easily reproducible with Vapor 1.0.0/MySQL 5.7. The upshot is that vapor/mysql cannot retrieve POINT data from the MySQL database (although it has no issue inserting it).

Also, in the same application running SELECT AsText(location) FROM locations fails with:

[MySQL] Unsupported type: unknown.
[["AsText(location)": Node.Node.null]]

How to skip ssl when establish connection

Hi,
I had a database server with mysql5.6. When I try to connect to DB I have this issue.
ERROR 2026 (HY000): SSL connection error: error:00000001:lib(0):func(0):reason(1)
How can I skip ssl connection or is there a way to add ssl certification?
Thanks!

crush when i do this .execute("START TRANSCATION;", [], connection)

I am using Mac.
when i run this line,
.execute("START TRANSCATION;", [], connection)
it crushes, and found this error,
error: MySQL.Error.prepare("This command is not supported in the prepared statement protocol yet")
i have no idea why it would throw.
without this line, it won't throw. but i need this line to guarantee that upcoming commands work together.
Is it possible to fix that?
Thanks.

Error deploying to Heroku with MySQL running elsewhere

Hi, I have no idea what to do, I am trying to deploy this: https://github.com/syky27/LostSocks-api/tree/03270f0025798b5050e7d0c71fadc81360fe8c07

with mysql.json config to external server and I am getting this error.

โ•ฐโ”€ยฑ git push heroku master
Counting objects: 167, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (126/126), done.
Writing objects: 100% (167/167), 59.09 KiB | 0 bytes/s, done.
Total 167 (delta 52), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Swift app detected
remote: Cloning into 'swiftenv'...
remote: -----> Installing 3.0
remote: Downloading https://swift.org/builds/swift-3.0-release/ubuntu1404/swift-3.0-RELEASE/swift-3.0-RELEASE-ubuntu14.04.tar.gz
remote: 3.0 has been installed.
remote: -----> Installing clang-3.7.0
remote: -----> Building Package
remote: Cloning https://github.com/vapor/vapor.git
remote: HEAD is now at 4f5b6ad Merge pull request #642 from sroebert/master
remote: Resolved version: 1.1.1
remote: Cloning https://github.com/vapor/crypto.git
remote: HEAD is now at 0aaa68b Merge pull request #15 from vapor/fix-overflow
remote: Resolved version: 1.0.1
remote: Cloning https://github.com/vapor/core.git
remote: HEAD is now at 5f40499 Merge pull request #24 from vapor/1.0
remote: Resolved version: 1.0.0
remote: Cloning https://github.com/vapor/clibressl.git
remote: HEAD is now at 23ddb29 Merge pull request #7 from vapor/1.0
remote: Resolved version: 1.0.0
remote: Cloning https://github.com/vapor/fluent.git
remote: HEAD is now at 3434b6b Merge pull request #123 from sroebert/feature/comparingToNull
remote: Resolved version: 1.0.7
remote: Cloning https://github.com/vapor/node.git
remote: HEAD is now at 4cf8c76 Merge pull request #21 from ZeroFactor/master
remote: Resolved version: 1.0.1
remote: Cloning https://github.com/vapor/path-indexable.git
remote: HEAD is now at 0aa6f6e Merge pull request #7 from vapor/1.0
remote: Resolved version: 1.0.0
remote: Cloning https://github.com/vapor/polymorphic.git
remote: HEAD is now at ce69ff3 Merge pull request #6 from vapor/1.0
remote: Resolved version: 1.0.0
remote: Cloning https://github.com/vapor/engine.git
remote: HEAD is now at daf4942 Update main.swift
remote: Resolved version: 1.0.3
remote: Cloning https://github.com/vapor/tls.git
remote: HEAD is now at df899dd Merge pull request #28 from andreasley/master
remote: Resolved version: 1.0.2
remote: Cloning https://github.com/vapor/socks.git
remote: HEAD is now at 3233dee Merge pull request #78 from hpux735/master
remote: Resolved version: 1.0.1
remote: Cloning https://github.com/vapor/console.git
remote: HEAD is now at 2bb03a0 Merge pull request #21 from vapor/1.0
remote: Resolved version: 1.0.0
remote: Cloning https://github.com/vapor/json.git
remote: HEAD is now at fc5235b Merge pull request #17 from seivan/feature/collection_as_json
remote: Resolved version: 1.0.1
remote: Cloning https://github.com/DanToml/Jay.git
remote: HEAD is now at 1c381d7 update travis and version for 3.0 release (#50)
remote: Resolved version: 1.0.0
remote: Cloning https://github.com/stormpath/Turnstile.git
remote: HEAD is now at cab8e99 Merge pull request #11 from harlanhaskins/master
remote: Resolved version: 1.0.3
remote: Cloning https://github.com/vapor/leaf.git
remote: HEAD is now at ce2d27e Merge pull request #25 from vapor/html-escape
remote: Resolved version: 1.0.2
remote: Cloning https://github.com/vapor/mysql-provider.git
remote: HEAD is now at 23cce89 Merge pull request #14 from vapor/1.0
remote: Resolved version: 1.0.0
remote: Cloning https://github.com/vapor/mysql-driver.git
remote: HEAD is now at 1233458 Merge pull request #19 from vapor/fix-retain-connection
remote: Resolved version: 1.0.1
remote: Cloning https://github.com/vapor/mysql.git
remote: HEAD is now at 50e3097 Merge pull request #59 from bygri/master
remote: Resolved version: 1.0.2
remote: Cloning https://github.com/vapor/cmysql.git
remote: HEAD is now at c0fb658 Merge pull request #6 from vapor/1.0
remote: Resolved version: 1.0.0
remote: Compile CLibreSSL getentropy_linux.c
remote: Compile CLibreSSL a_time.c
remote: Compile CLibreSSL dh_prn.c
remote: Compile CLibreSSL rc2_ecb.c
remote: Compile CLibreSSL bn_asm.c
remote: Compile CLibreSSL mem_clr.c
remote: Compile CLibreSSL ecs_vrf.c
remote: Compile CLibreSSL hmac.c
remote: Compile CLibreSSL dso_lib.c
remote: Compile CLibreSSL asn1_par.c
remote: Compile CLibreSSL b_print.c
remote: Compile CLibreSSL x509_ext.c
remote: Compile CLibreSSL enc_read.c
remote: Compile CLibreSSL e_xcbc_d.c
remote: Compile CLibreSSL comp_lib.c
remote: Compile CLibreSSL rsa_pss.c
remote: Compile CLibreSSL e_bf.c
remote: Compile CLibreSSL a_bytes.c
remote: Compile CLibreSSL obj_err.c
remote: Compile CLibreSSL v3_akey.c
remote: Compile CLibreSSL f_enum.c
remote: Compile CLibreSSL dsa_asn1.c
remote: Compile CLibreSSL getentropy_win.c
remote: Compile CLibreSSL tls.c
remote: Compile CLibreSSL camellia.c
remote: Compile CLibreSSL dh_ameth.c
remote: Compile CLibreSSL poly1305.c
remote: Compile CLibreSSL rc4_enc.c
remote: Compile CLibreSSL p8_pkey.c
remote: Compile CLibreSSL dso_dlfcn.c
remote: Compile CLibreSSL tls_client.c
remote: Compile CLibreSSL t_req.c
remote: Compile CLibreSSL gostr341001_ameth.c
remote: Compile CLibreSSL evp_asn1.c
remote: Compile CLibreSSL s23_lib.c
remote: Compile CLibreSSL ec_ameth.c
remote: Compile CLibreSSL bn_word.c
remote: Compile CLibreSSL ocsp_prn.c
remote: Compile CLibreSSL x_pubkey.c
remote: Compile CLibreSSL x_crl.c
remote: Compile CLibreSSL bio_ssl.c
remote: Compile CLibreSSL ssl_txt.c
remote: Compile CLibreSSL ocsp_ht.c
remote: Compile CLibreSSL a_utf8.c
remote: Compile CLibreSSL ts_rsp_verify.c
remote: Compile CLibreSSL xcbc_enc.c
remote: Compile CLibreSSL lh_stats.c
remote: Compile CLibreSSL dh_key.c
remote: Compile CLibreSSL i_cfb64.c
remote: Compile CLibreSSL asn_mime.c
remote: Compile CLibreSSL v3_akeya.c
remote: Compile CLibreSSL bss_mem.c
remote: Compile CLibreSSL cmll_cbc.c
remote: Compile CLibreSSL t1_enc.c
remote: Compile CLibreSSL conf_sap.c
remote: Compile CLibreSSL v3_extku.c
remote: Compile CLibreSSL cfb128.c
remote: Compile CLibreSSL v3_genn.c
remote: Compile CLibreSSL tb_cipher.c
remote: Compile CLibreSSL cmll_ecb.c
remote: Compile CLibreSSL a_digest.c
remote: Compile CLibreSSL strlcat.c
remote: Compile CLibreSSL e_old.c
remote: Compile CLibreSSL bio_b64.c
remote: Compile CLibreSSL bio_cb.c
remote: Compile CLibreSSL bn_exp.c
remote: Compile CLibreSSL pcy_lib.c
remote: Compile CLibreSSL x509_obj.c
remote: Compile CLibreSSL p5_crpt2.c
remote: Compile CLibreSSL getentropy_hpux.c
remote: Compile CLibreSSL m_md5.c
remote: Compile CLibreSSL wp_block.c
remote: Compile CLibreSSL pem_pk8.c
remote: Compile CLibreSSL dsa_prn.c
remote: Compile CLibreSSL d1_pkt.c
remote: Compile CLibreSSL pk12err.c
remote: Compile CLibreSSL aes_cbc.c
remote: Compile CLibreSSL c_all.c
remote: Compile CLibreSSL v3_enum.c
remote: Compile CLibreSSL explicit_bzero_win.c
remote: Compile CLibreSSL posix_win.c
remote: Compile CLibreSSL v3_lib.c
remote: Compile CLibreSSL m_gost2814789.c
remote: Compile CLibreSSL v3_ncons.c
remote: Compile CLibreSSL arc4random_uniform.c
remote: Compile CLibreSSL ofb64enc.c
remote: Compile CLibreSSL ts_rsp_sign.c
remote: Compile CLibreSSL n_pkey.c
remote: Compile CLibreSSL ecb3_enc.c
remote: Compile CLibreSSL v3_int.c
remote: Compile CLibreSSL dsa_err.c
remote: Compile CLibreSSL pem_sign.c
remote: Compile CLibreSSL ec2_smpl.c
remote: Compile CLibreSSL bf_null.c
remote: Compile CLibreSSL d1_meth.c
remote: Compile CLibreSSL gostr341001_pmeth.c
remote: Compile CLibreSSL gost89imit_ameth.c
remote: Compile CLibreSSL pkcs7err.c
remote: Compile CLibreSSL md5_one.c
remote: Compile CLibreSSL rsa_depr.c
remote: Compile CLibreSSL x_x509a.c
remote: Compile CLibreSSL bn_add.c
remote: Compile CLibreSSL explicit_bzero.c
remote: Compile CLibreSSL ssl_rsa.c
remote: Compile CLibreSSL sha256.c
remote: Compile CLibreSSL dsa_sign.c
remote: Compile CLibreSSL d1_srvr.c
remote: Compile CLibreSSL t1_srvr.c
remote: Compile CLibreSSL lhash.c
remote: Compile CLibreSSL pem_xaux.c
remote: Compile CLibreSSL bn_mpi.c
remote: Compile CLibreSSL e_des3.c
remote: Compile CLibreSSL eck_prn.c
remote: Compile CLibreSSL ssl_stat.c
remote: Compile CLibreSSL m_ripemd.c
remote: Compile CLibreSSL asn_pack.c
remote: Compile CLibreSSL tb_dh.c
remote: Compile CLibreSSL timingsafe_memcmp.c
remote: Compile CLibreSSL x_val.c
remote: Compile CLibreSSL x_long.c
remote: Compile CLibreSSL gost89_params.c
remote: Compile CLibreSSL v3_cpols.c
remote: Compile CLibreSSL p12_asn.c
remote: Compile CLibreSSL ede_cbcm_enc.c
remote: Compile CLibreSSL dh_err.c
remote: Compile CLibreSSL poly1305-donna.c
remote: Compile CLibreSSL bn_gcd.c
remote: Compile CLibreSSL a_strex.c
remote: Compile CLibreSSL arc4random.c
remote: Compile CLibreSSL v3_bcons.c
remote: Compile CLibreSSL p12_kiss.c
remote: Compile CLibreSSL ec_curve.c
remote: Compile CLibreSSL s23_srvr.c
remote: Compile CLibreSSL eng_table.c
remote: Compile CLibreSSL bss_bio.c
remote: Compile CLibreSSL a_print.c
remote: Compile CLibreSSL v3_skey.c
remote: Compile CLibreSSL err_prn.c
remote: Compile CLibreSSL fcrypt.c
remote: Compile CLibreSSL ocsp_ext.c
remote: Compile CLibreSSL p5_pbe.c
remote: Compile CLibreSSL ec_print.c
remote: Compile CLibreSSL pem_x509.c
remote: Compile CLibreSSL dsa_vrf.c
remote: Compile CLibreSSL evp_pbe.c
remote: Compile CLibreSSL asn1_gen.c
remote: Compile CLibreSSL ofb64ede.c
remote: Compile CLibreSSL p5_crpt.c
remote: Compile CLibreSSL t1_meth.c
remote: Compile CLibreSSL bf_cfb64.c
remote: Compile CLibreSSL ecp_oct.c
remote: Compile CLibreSSL a_bitstr.c
remote: Compile CLibreSSL i_ofb64.c
remote: Compile CLibreSSL pvkfmt.c
remote: Compile CLibreSSL aes_ecb.c
remote: Compile CLibreSSL dsa_key.c
remote: Compile CLibreSSL v3_ia5.c
remote: Compile CLibreSSL dsa_ossl.c
remote: Compile CLibreSSL x_bignum.c
remote: Compile CLibreSSL m_wp.c
remote: Compile CLibreSSL p12_decr.c
remote: Compile CLibreSSL eng_ctrl.c
remote: Compile CLibreSSL ts_verify_ctx.c
remote: Compile CLibreSSL evp_aead.c
remote: Compile CLibreSSL bn_recp.c
remote: Compile CLibreSSL bss_fd.c
remote: Compile CLibreSSL bn_lib.c
remote: Compile CLibreSSL rc4_skey.c
remote: Compile CLibreSSL tasn_fre.c
remote: Compile CLibreSSL mem_dbg.c
remote: Compile CLibreSSL gcm128.c
remote: Compile CLibreSSL timingsafe_bcmp.c
remote: Compile CLibreSSL ts_rsp_print.c
remote: Compile CLibreSSL i2d_pu.c
remote: Compile CLibreSSL gostr341001_params.c
remote: Compile CLibreSSL ofb_enc.c
remote: Compile CLibreSSL cbc_cksm.c
remote: Compile CLibreSSL gost_err.c
remote: Compile CLibreSSL gost89_keywrap.c
remote: Compile CLibreSSL rsa_saos.c
remote: Compile CLibreSSL s3_pkt.c
remote: Compile CLibreSSL ex_data.c
remote: Compile CLibreSSL cmll_misc.c
remote: Compile CLibreSSL x509_att.c
remote: Compile CLibreSSL dh_lib.c
remote: Compile CLibreSSL timegm.c
remote: Compile CLibreSSL aes_ofb.c
remote: Compile CLibreSSL p12_add.c
remote: Compile CLibreSSL md4_dgst.c
remote: Compile CLibreSSL s3_clnt.c
remote: Compile CLibreSSL eng_cnf.c
remote: Compile CLibreSSL dso_null.c
remote: Compile CLibreSSL getentropy_freebsd.c
remote: Compile CLibreSSL getentropy_netbsd.c
remote: Compile CLibreSSL rc2ofb64.c
remote: Compile CLibreSSL bn_mod.c
remote: Compile CLibreSSL x509_lu.c
remote: Compile CLibreSSL aes_ige.c
remote: Compile CLibreSSL x_nx509.c
remote: Compile CLibreSSL aes_cfb.c
remote: Compile CLibreSSL p12_init.c
remote: Compile CLibreSSL c_zlib.c
remote: Compile CLibreSSL e_rc4_hmac_md5.c
remote: Compile CLibreSSL i_ecb.c
remote: Compile CLibreSSL buffer.c
remote: Compile CLibreSSL ssl_cert.c
remote: Compile CLibreSSL eng_list.c
remote: Compile CLibreSSL cmll_ofb.c
remote: Compile CLibreSSL rsa_oaep.c
remote: Compile CLibreSSL bss_acpt.c
remote: Compile CLibreSSL cversion.c
remote: Compile CLibreSSL randfile.c
remote: Compile CLibreSSL str2key.c
remote: Compile CLibreSSL c_skey.c
remote: Compile CLibreSSL bn_rand.c
remote: Compile CLibreSSL p_lib.c
remote: Compile CLibreSSL x509_req.c
remote: Compile CLibreSSL by_dir.c
remote: Compile CLibreSSL buf_str.c
remote: Compile CLibreSSL c_rle.c
remote: Compile CLibreSSL evp_lib.c
remote: Compile CLibreSSL ecs_err.c
remote: Compile CLibreSSL m_gostr341194.c
remote: Compile CLibreSSL sha512.c
remote: Compile CLibreSSL bn_sqrt.c
remote: Compile CLibreSSL ui_err.c
remote: Compile CLibreSSL ec_lib.c
remote: Compile CLibreSSL bn_div.c
remote: Compile CLibreSSL krb5_asn.c
remote: Compile CLibreSSL v3_pmaps.c
remote: Compile CLibreSSL b_dump.c
remote: Compile CLibreSSL a_object.c
remote: Compile CLibreSSL a_set.c
remote: Compile CLibreSSL x509_trs.c
remote: Compile CLibreSSL tls_verify.c
remote: Compile CLibreSSL evp_err.c
remote: Compile CLibreSSL ecp_nist.c
remote: Compile CLibreSSL ocsp_err.c
remote: Compile CLibreSSL ocsp_lib.c
remote: Compile CLibreSSL a_dup.c
remote: Compile CLibreSSL ec2_mult.c
remote: Compile CLibreSSL bn_print.c
remote: Compile CLibreSSL m_dss1.c
remote: Compile CLibreSSL md4_one.c
remote: Compile CLibreSSL a_time_tm.c
remote: Compile CLibreSSL rsa_asn1.c
remote: Compile CLibreSSL cmll_cfb.c
remote: Compile CLibreSSL pcy_data.c
remote: Compile CLibreSSL m_ecdsa.c
remote: Compile CLibreSSL p12_p8d.c
remote: Compile CLibreSSL ctr128.c
remote: Compile CLibreSSL ts_asn1.c
remote: Compile CLibreSSL x509_v3.c
remote: Compile CLibreSSL e_des.c
remote: Compile CLibreSSL bn_mul.c
remote: Compile CLibreSSL bs_ber.c
remote: Compile CLibreSSL malloc-wrapper.c
remote: Compile CLibreSSL pk7_asn1.c
remote: Compile CLibreSSL rc2_skey.c
remote: Compile CLibreSSL p_open.c
remote: Compile CLibreSSL e_rc2.c
remote: Compile CLibreSSL ssl_err2.c
remote: Compile CLibreSSL p12_mutl.c
remote: Compile CLibreSSL ecb_enc.c
remote: Compile CLibreSSL ec_key.c
remote: Compile CLibreSSL rc2cfb64.c
remote: Compile CLibreSSL e_null.c
remote: Compile CLibreSSL gostr341194.c
remote: Compile CLibreSSL strcasecmp.c
remote: Compile CLibreSSL bio_md.c
remote: Compile CLibreSSL v3_pcia.c
remote: Compile CLibreSSL encode.c
remote: Compile CLibreSSL streebog.c
remote: Compile CLibreSSL p12_p8e.c
remote: Compile CLibreSSL o_str.c
remote: Compile CLibreSSL ecp_smpl.c
remote: Compile CLibreSSL pem_oth.c
remote: Compile CLibreSSL pk7_lib.c
remote: Compile CLibreSSL ech_lib.c
remote: Compile CLibreSSL pmeth_fn.c
remote: Compile CLibreSSL rsa_err.c
remote: Compile CLibreSSL getentropy_aix.c
remote: Compile CLibreSSL xts128.c
remote: Compile CLibreSSL bf_ecb.c
remote: Compile CLibreSSL a_verify.c
remote: Compile CLibreSSL rsa_pk1.c
remote: Compile CLibreSSL t_x509a.c
remote: Compile CLibreSSL p12_attr.c
remote: Compile CLibreSSL qud_cksm.c
remote: Compile CLibreSSL x509_cmp.c
remote: Compile CLibreSSL m_md4.c
remote: Compile CLibreSSL bss_log.c
remote: Compile CLibreSSL tasn_typ.c
remote: Compile CLibreSSL x509cset.c
remote: Compile CLibreSSL tls_conninfo.c
remote: Compile CLibreSSL p12_key.c
remote: Compile CLibreSSL names.c
remote: Compile CLibreSSL a_sign.c
remote: Compile CLibreSSL t_spki.c
remote: Compile CLibreSSL dsa_gen.c
remote: Compile CLibreSSL bf_ofb64.c
remote: Compile CLibreSSL sha1_one.c
remote: Compile CLibreSSL ts_conf.c
remote: Compile CLibreSSL a_bool.c
remote: Compile CLibreSSL bn_nist.c
remote: Compile CLibreSSL x509_vpm.c
remote: Compile CLibreSSL ecs_sign.c
remote: Compile CLibreSSL x509_set.c
remote: Compile CLibreSSL x_attrib.c
remote: Compile CLibreSSL conf_mall.c
remote: Compile CLibreSSL ec_cvt.c
remote: Compile CLibreSSL ts_lib.c
remote: Compile CLibreSSL tasn_enc.c
remote: Compile CLibreSSL bn_depr.c
remote: Compile CLibreSSL des_enc.c
remote: Compile CLibreSSL bf_skey.c
remote: Compile CLibreSSL ssl_lib.c
remote: Compile CLibreSSL ocsp_cl.c
remote: Compile CLibreSSL e_gost2814789.c
remote: Compile CLibreSSL v3_pcons.c
remote: Compile CLibreSSL t_x509.c
remote: Compile CLibreSSL x509_r2x.c
remote: Compile CLibreSSL e_camellia.c
remote: Compile CLibreSSL rand_err.c
remote: Compile CLibreSSL b_win.c
remote: Compile CLibreSSL strlcpy.c
remote: Compile CLibreSSL bs_cbb.c
remote: Compile CLibreSSL t_crl.c
remote: Compile CLibreSSL bs_cbs.c
remote: Compile CLibreSSL eng_fat.c
remote: Compile CLibreSSL reallocarray.c
remote: Compile CLibreSSL pmeth_lib.c
remote: Compile CLibreSSL bn_prime.c
remote: Compile CLibreSSL dh_depr.c
remote: Compile CLibreSSL dh_pmeth.c
remote: Compile CLibreSSL p_sign.c
remote: Compile CLibreSSL x509_def.c
remote: Compile CLibreSSL pcbc_enc.c
remote: Compile CLibreSSL strnlen.c
remote: Compile CLibreSSL cts128.c
remote: Compile CLibreSSL v3_pku.c
remote: Compile CLibreSSL x509type.c
remote: Compile CLibreSSL v3_info.c
remote: Compile CLibreSSL ecs_asn1.c
remote: Compile CLibreSSL tb_pkmeth.c
remote: Compile CLibreSSL bss_conn.c
remote: Compile CLibreSSL ui_lib.c
remote: Compile CLibreSSL tb_rand.c
remote: Compile CLibreSSL t_pkey.c
remote: Compile CLibreSSL bn_mont.c
remote: Compile CLibreSSL bn_const.c
remote: Compile CLibreSSL pem_all.c
remote: Compile CLibreSSL v3_purp.c
remote: Compile CLibreSSL d1_both.c
remote: Compile CLibreSSL s3_cbc.c
remote: Compile CLibreSSL s3_both.c
remote: Compile CLibreSSL e_chacha20poly1305.c
remote: Compile CLibreSSL a_mbstr.c
remote: Compile CLibreSSL bss_file.c
remote: Compile CLibreSSL x509_vfy.c
remote: Compile CLibreSSL e_idea.c
remote: Compile CLibreSSL a_octet.c
remote: Compile CLibreSSL pcy_node.c
remote: Compile CLibreSSL t_bitst.c
remote: Compile CLibreSSL e_cast.c
remote: Compile CLibreSSL bn_ctx.c
remote: Compile CLibreSSL rand_key.c
remote: Compile CLibreSSL s3_srvr.c
remote: Compile CLibreSSL conf_err.c
remote: Compile CLibreSSL v3_pci.c
remote: Compile CLibreSSL d1_srtp.c
remote: Compile CLibreSSL ec2_oct.c
remote: Compile CLibreSSL p_enc.c
remote: Compile CLibreSSL c_enc.c
remote: Compile CLibreSSL hm_ameth.c
remote: Compile CLibreSSL cbc128.c
remote: Compile CLibreSSL bn_x931p.c
remote: Compile CLibreSSL gostr341001.c
remote: Compile CLibreSSL ts_req_print.c
remote: Compile CLibreSSL pem_pkey.c
remote: Compile CLibreSSL tb_dsa.c
remote: Compile CLibreSSL ofb128.c
remote: Compile CLibreSSL tb_ecdsa.c
remote: Compile CLibreSSL evp_key.c
remote: Compile CLibreSSL x_pkey.c
remote: Compile CLibreSSL cmll_ctr.c
remote: Compile CLibreSSL ec_pmeth.c
remote: Compile CLibreSSL rmd_dgst.c
remote: Compile CLibreSSL ssl_algs.c
remote: Compile CLibreSSL eng_err.c
remote: Compile CLibreSSL cfb_enc.c
remote: Compile CLibreSSL fcrypt_b.c
remote: Compile CLibreSSL conf_def.c
remote: Compile CLibreSSL eng_lib.c
remote: Compile CLibreSSL m_streebog.c
remote: Compile CLibreSSL tb_ecdh.c
remote: Compile CLibreSSL by_mem.c
remote: Compile CLibreSSL pcy_cache.c
remote: Compile CLibreSSL err_all.c
remote: Compile CLibreSSL pem_info.c
remote: Compile CLibreSSL bio_err.c
remote: Compile CLibreSSL o_names.c
remote: Compile CLibreSSL tasn_utl.c
remote: Compile CLibreSSL dh_asn1.c
remote: Compile CLibreSSL hm_pmeth.c
remote: Compile CLibreSSL dsa_depr.c
remote: Compile CLibreSSL o_time.c
remote: Compile CLibreSSL nsseq.c
remote: Compile CLibreSSL p12_crt.c
remote: Compile CLibreSSL v3err.c
remote: Compile CLibreSSL gost89imit_pmeth.c
remote: Compile CLibreSSL ecp_mont.c
remote: Compile CLibreSSL x509name.c
remote: Compile CLibreSSL conf_lib.c
remote: Compile CLibreSSL rsa_chk.c
remote: Compile CLibreSSL bn_err.c
remote: Compile CLibreSSL bf_buff.c
remote: Compile CLibreSSL dh_check.c
remote: Compile CLibreSSL eng_init.c
remote: Compile CLibreSSL eng_pkey.c
remote: Compile CLibreSSL v3_bitst.c
remote: Compile CLibreSSL m_sha1.c
remote: Compile CLibreSSL ecs_lib.c
remote: Compile CLibreSSL tb_digest.c
remote: Compile CLibreSSL pk7_doit.c
remote: Compile CLibreSSL p12_crpt.c
remote: Compile CLibreSSL i_cbc.c
remote: Compile CLibreSSL obj_xref.c
remote: Compile CLibreSSL ui_util.c
remote: Compile CLibreSSL digest.c
remote: Compile CLibreSSL bf_nbio.c
remote: Compile CLibreSSL gost2814789.c
remote: Compile CLibreSSL eng_all.c
remote: Compile CLibreSSL ocsp_srv.c
remote: Compile CLibreSSL p12_utl.c
remote: Compile CLibreSSL ec_mult.c
remote: Compile CLibreSSL rsa_sign.c
remote: Compile CLibreSSL stack.c
remote: Compile CLibreSSL b_posix.c
remote: Compile CLibreSSL md5_dgst.c
remote: Compile CLibreSSL x_info.c
remote: Compile CLibreSSL dsa_ameth.c
remote: Compile CLibreSSL pmeth_gn.c
remote: Compile CLibreSSL cryptlib.c
remote: Compile CLibreSSL x_spki.c
remote: Compile CLibreSSL rsa_lib.c
remote: Compile CLibreSSL bio_enc.c
remote: Compile CLibreSSL t1_reneg.c
remote: Compile CLibreSSL x_x509.c
remote: Compile CLibreSSL v3_crld.c
remote: Compile CLibreSSL ui_openssl.c
remote: Compile CLibreSSL v3_sxnet.c
remote: Compile CLibreSSL err.c
remote: Compile CLibreSSL a_type.c
remote: Compile CLibreSSL bn_kron.c
remote: Compile CLibreSSL pem_seal.c
remote: Compile CLibreSSL gostr341001_key.c
remote: Compile CLibreSSL pk7_mime.c
remote: Compile CLibreSSL x509_txt.c
remote: Compile CLibreSSL bss_sock.c
remote: Compile CLibreSSL aes_core.c
remote: Compile CLibreSSL ameth_lib.c
remote: Compile CLibreSSL bss_dgram.c
remote: Compile CLibreSSL c_cfb64.c
remote: Compile CLibreSSL eng_openssl.c
remote: Compile CLibreSSL b_sock.c
remote: Compile CLibreSSL bio_ndef.c
remote: Compile CLibreSSL pem_err.c
remote: Compile CLibreSSL enc_writ.c
remote: Compile CLibreSSL comp_err.c
remote: Compile CLibreSSL rsa_none.c
remote: Compile CLibreSSL evp_pkey.c
remote: Compile CLibreSSL sha1dgst.c
remote: Compile CLibreSSL tls_server.c
remote: Compile CLibreSSL x509_d2.c
remote: Compile CLibreSSL d1_clnt.c
remote: Compile CLibreSSL aes_ctr.c
remote: Compile CLibreSSL chacha-merged.c
remote: Compile CLibreSSL rsa_ameth.c
remote: Compile CLibreSSL obj_lib.c
remote: Compile CLibreSSL cm_pmeth.c
remote: Compile CLibreSSL ec_err.c
remote: Compile CLibreSSL o_init.c
remote: Compile CLibreSSL strsep.c
remote: Compile CLibreSSL bn_sqr.c
remote: Compile CLibreSSL dh_gen.c
remote: Compile CLibreSSL tasn_new.c
remote: Compile CLibreSSL x_req.c
remote: Compile CLibreSSL tasn_dec.c
remote: Compile CLibreSSL rsa_eay.c
remote: Compile CLibreSSL ssl_ciph.c
remote: Compile CLibreSSL p5_pbev2.c
remote: Compile CLibreSSL c_ofb64.c
remote: Compile CLibreSSL x_algor.c
remote: Compile CLibreSSL p_dec.c
remote: Compile CLibreSSL cfb64ede.c
remote: Compile CLibreSSL bf_enc.c
remote: Compile CLibreSSL v3_alt.c
remote: Compile CLibreSSL ssl_asn1.c
remote: Compile CLibreSSL cbc_enc.c
remote: Compile CLibreSSL bio_lib.c
remote: Compile CLibreSSL cm_ameth.c
remote: Compile CLibreSSL pk7_attr.c
remote: Compile CLibreSSL s3_lib.c
remote: Compile CLibreSSL rc2_cbc.c
remote: Compile CLibreSSL i_skey.c
remote: Compile CLibreSSL bn_gf2m.c
remote: Compile CLibreSSL conf_api.c
remote: Compile CLibreSSL obj_dat.c
remote: Compile CLibreSSL ec_oct.c
remote: Compile CLibreSSL e_aes.c
remote: Compile CLibreSSL v3_conf.c
remote: Compile CLibreSSL txt_db.c
remote: Compile CLibreSSL conf_mod.c
remote: Compile CLibreSSL cfb64enc.c
remote: Compile CLibreSSL tls_config.c
remote: Compile CLibreSSL ssl_sess.c
remote: Compile CLibreSSL rsa_gen.c
remote: Compile CLibreSSL a_d2i_fp.c
remote: Compile CLibreSSL a_int.c
remote: Compile CLibreSSL ec_asn1.c
remote: Compile CLibreSSL ts_req_utils.c
remote: Compile CLibreSSL rand_lib.c
remote: Compile CLibreSSL rmd_one.c
remote: Compile CLibreSSL i2d_pr.c
remote: Compile CLibreSSL e_rc4.c
remote: Compile CLibreSSL f_int.c
remote: Compile CLibreSSL cpt_err.c
remote: Compile CLibreSSL ech_err.c
remote: Compile CLibreSSL x509rset.c
remote: Compile CLibreSSL ech_key.c
remote: Compile CLibreSSL v3_ocsp.c
remote: Compile CLibreSSL tls_util.c
remote: Compile CLibreSSL ui_openssl_win.c
remote: Compile CLibreSSL ec_check.c
remote: Compile CLibreSSL tasn_prn.c
remote: Compile CLibreSSL dsa_lib.c
remote: Compile CLibreSSL a_enum.c
remote: Compile CLibreSSL d1_lib.c
remote: Compile CLibreSSL pcy_map.c
remote: Compile CLibreSSL aes_wrap.c
remote: Compile CLibreSSL m_sigver.c
remote: Compile CLibreSSL tb_rsa.c
remote: Compile CLibreSSL ncbc_enc.c
remote: Compile CLibreSSL rsa_ssl.c
remote: Compile CLibreSSL bn_blind.c
remote: Compile CLibreSSL ssl_err.c
remote: Compile CLibreSSL x509spki.c
remote: Compile CLibreSSL s23_clnt.c
remote: Compile CLibreSSL ccm128.c
remote: Compile CLibreSSL buf_err.c
remote: Compile CLibreSSL e_aes_cbc_hmac_sha1.c
remote: Compile CLibreSSL strndup.c
remote: Compile CLibreSSL ts_err.c
remote: Compile CLibreSSL tb_asnmth.c
remote: Compile CLibreSSL p_seal.c
remote: Compile CLibreSSL rsa_x931.c
remote: Compile CLibreSSL pk7_smime.c
remote: Compile CLibreSSL tls_peer.c
remote: Compile CLibreSSL getentropy_solaris.c
remote: Compile CLibreSSL e_chacha.c
remote: Compile CLibreSSL bio_asn1.c
remote: Compile CLibreSSL dso_err.c
remote: Compile CLibreSSL v3_utl.c
remote: Compile CLibreSSL bio_pk7.c
remote: Compile CLibreSSL d2i_pu.c
remote: Compile CLibreSSL ocsp_asn.c
remote: Compile CLibreSSL x_all.c
remote: Compile CLibreSSL ocsp_vfy.c
remote: Compile CLibreSSL x509_err.c
remote: Compile CLibreSSL by_file.c
remote: Compile CLibreSSL pcy_tree.c
remote: Compile CLibreSSL rsa_pmeth.c
remote: Compile CLibreSSL pqueue.c
remote: Compile CLibreSSL c_ecb.c
remote: Compile CLibreSSL asn1_err.c
remote: Compile CLibreSSL m_dss.c
remote: Compile CLibreSSL dso_openssl.c
remote: Compile CLibreSSL t1_clnt.c
remote: Compile CLibreSSL asn1_lib.c
remote: Compile CLibreSSL d2i_pr.c
remote: Compile CLibreSSL gost_asn1.c
remote: Compile CLibreSSL chacha.c
remote: Compile CLibreSSL bn_exp2.c
remote: Compile CLibreSSL a_strnid.c
remote: Compile CLibreSSL rsa_prn.c
remote: Compile CLibreSSL rsa_crpt.c
remote: Compile CLibreSSL eng_dyn.c
remote: Compile CLibreSSL s23_pkt.c
remote: Compile CLibreSSL ts_rsp_utils.c
remote: Compile CLibreSSL bn_shift.c
remote: Compile CLibreSSL bss_null.c
remote: Compile CLibreSSL f_string.c
remote: Compile CLibreSSL p12_npas.c
remote: Compile CLibreSSL pem_lib.c
remote: Compile CLibreSSL set_key.c
remote: Compile CLibreSSL wp_dgst.c
remote: Compile CLibreSSL asn_moid.c
remote: Compile CLibreSSL t1_lib.c
remote: Compile CLibreSSL evp_enc.c
remote: Compile CLibreSSL d1_enc.c
remote: Compile CLibreSSL aes_misc.c
remote: Compile CLibreSSL cmac.c
remote: Compile CLibreSSL x_sig.c
remote: Compile CLibreSSL a_i2d_fp.c
remote: Compile CLibreSSL tb_store.c
remote: Compile CLibreSSL ecs_ossl.c
remote: Compile CLibreSSL x_exten.c
remote: Compile CLibreSSL m_null.c
remote: Compile CLibreSSL p_verify.c
remote: Compile CLibreSSL inet_pton.c
remote: Compile CLibreSSL x_name.c
remote: Compile CLibreSSL getentropy_osx.c
remote: Compile CLibreSSL dsa_pmeth.c
remote: Compile CLibreSSL v3_prn.c
remote: Compile CLibreSSL bsd-asprintf.c
remote: Compile Swift Module 'Polymorphic' (2 sources)
remote: Compile Swift Module 'PathIndexable' (2 sources)
remote: Compile Swift Module 'libc' (1 sources)
remote: Compile Swift Module 'TurnstileCrypto' (3 sources)
remote: Compile Swift Module 'Jay' (21 sources)
remote: Compile Swift Module 'SocksCore' (14 sources)
remote: Linking CLibreSSL
remote: Compile Swift Module 'Core' (28 sources)
remote: Compile Swift Module 'Node' (22 sources)
remote: Compile Swift Module 'Turnstile' (13 sources)
remote: Compile Swift Module 'Socks' (5 sources)
remote: Compile Swift Module 'Console' (34 sources)
remote: Compile Swift Module 'Essentials' (2 sources)
remote: Compile Swift Module 'TLS' (7 sources)
remote: Compile Swift Module 'TurnstileWeb' (8 sources)
remote: Compile Swift Module 'Cipher' (2 sources)
remote: Compile Swift Module 'Random' (3 sources)
remote: Compile Swift Module 'Leaf' (34 sources)
remote: Compile Swift Module 'JSON' (8 sources)
remote: Compile Swift Module 'Fluent' (35 sources)
remote: Compile Swift Module 'Hash' (3 sources)
remote: Compile Swift Module 'BCrypt' (1 sources)
remote: Compile Swift Module 'HMAC' (2 sources)
remote: Compile Swift Module 'MySQL' (10 sources)
remote: /tmp/build_dc231d431df3ddcf000c91813a419168/Packages/MySQL-1.0.2/Sources/MySQL/Field+Variant.swift:26:24: error: use of unresolved identifier 'MYSQL_TYPE_JSON'
remote:             if self == MYSQL_TYPE_JSON {
remote:                        ^~~~~~~~~~~~~~~
remote: CMySQLLinux.MYSQL_TYPE_BLOB:1:12: note: did you mean 'MYSQL_TYPE_BLOB'?
remote: public var MYSQL_TYPE_BLOB: enum_field_types { get }
remote:            ^
remote: CMySQLLinux.MYSQL_TYPE_LONG:1:12: note: did you mean 'MYSQL_TYPE_LONG'?
remote: public var MYSQL_TYPE_LONG: enum_field_types { get }
remote:            ^
remote: CMySQLLinux.MYSQL_TYPE_SET:1:12: note: did you mean 'MYSQL_TYPE_SET'?
remote: public var MYSQL_TYPE_SET: enum_field_types { get }
remote:            ^
remote: /tmp/build_dc231d431df3ddcf000c91813a419168/Packages/MySQL-1.0.2/Sources/MySQL/Bind+Node.swift:44:31: error: use of unresolved identifier 'MYSQL_TYPE_JSON'
remote:                 if variant == MYSQL_TYPE_JSON {
remote:                               ^~~~~~~~~~~~~~~
remote: CMySQLLinux.MYSQL_TYPE_BLOB:1:12: note: did you mean 'MYSQL_TYPE_BLOB'?
remote: public var MYSQL_TYPE_BLOB: enum_field_types { get }
remote:            ^
remote: CMySQLLinux.MYSQL_TYPE_LONG:1:12: note: did you mean 'MYSQL_TYPE_LONG'?
remote: public var MYSQL_TYPE_LONG: enum_field_types { get }
remote:            ^
remote: CMySQLLinux.MYSQL_TYPE_SET:1:12: note: did you mean 'MYSQL_TYPE_SET'?
remote: public var MYSQL_TYPE_SET: enum_field_types { get }
remote:            ^
remote: <unknown>:0: error: build had 1 command failures
remote: swift-build: error: exit(1): /app/tmp/cache/swiftenv/versions/3.0/usr/bin/swift-build-tool -f /tmp/build_dc231d431df3ddcf000c91813a419168/.build/release.yaml
remote:  !     Push rejected, failed to compile Swift app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !   Push rejected to lostsocksapi.
remote:
To https://git.heroku.com/lostsocksapi.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/lostsocksapi.git'

Thank you for any help

TINYINT Issues

MySQL TINYINT fields still aren't being handled correctly on Linux.

Example: My table has a TINYINT column, and so I store a value of 2 in it. When I perform a fetch using this package, I extract the field like this:

let myField = result["myCol"]!.int  // myField is an `Int` 

On macOS, myField now has a value of 2. On Linux, myField has a value of 140533208973314.

Any ideas of what might be going on?

Support SMALLINT as well / unsigned functionality seems not to work at all

Hey guys,

I get a lot of [MySQL] Unsupported type: SMALLINT errors.

MySQL SMALLINT => C API MYSQL_TYPE_SHORT => C short int (16 bit) => Swift UInt16 / Int16.

Something like this in Bind+Node.swift solves my problem.

case MYSQL_TYPE_SHORT:
                if cBind.is_unsigned == 1 {
                    let uint = unwrap(buffer, UInt16.self)
                    return .number(.uint(UInt(uint)))
                } else {
                    let int = unwrap(buffer, Int16.self)
                    return .number(.int(Int(int)))
                }

On the other hand, unsigned functionality seems not to work at all. I have a lot of unsigned types in my database but cBind.is_unsigned = 0 always, as the initializer always sets unsigned: Bool = false. This result in a proper database structure being unusable at all.

Thank you,
Andrei

unable to build mysql on a vapor project

when I run vapor build --mysql

/Users/bukacakrawala/Desktop/PersonalProject/bukacakVapor/bukacakV/Packages/CMySQL-1.0.0/module.modulemap:14:12: error: header '/usr/local/include/mysql/mysql.h' not found
header "/usr/local/include/mysql/mysql.h"

/Users/bukacakrawala/Desktop/PersonalProject/bukacakVapor/bukacakV/Packages/MySQL-1.0.2/Sources/MySQL/Bind+Node.swift:8:12: error: could not build Objective-C module 'CMySQLMac'
import CMySQLMac

This is the package that I installed in my project: .Package(url: "https://github.com/vapor/mysql-provider.git", majorVersion: 1, minor: 0).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.