Comments (4)
If you could submit a test case where this fails, that would help a ton.
Otherwise I will investigate this on the next update.
from mysql-kit.
Here's how to reproduce the issue:
let mysql = try! MySQL.Database(...)
let myString = "È" // Unicode #200
try! mysql.execute("INSERT INTO mytable (myfield) VALUES (?)", [.string(myString)], nil)
This crashes at the following line in Bind.swift
:
buffer[i] = Char(byte)
Because it's attempting to cast a decimal value of 200 into an Int8
.
from mysql-kit.
UPDATE: Sorry to keep pestering about this, but I believe it's a big flaw in this library that should be addressed. I had a little more time to dig into it today, and I believe that the solution is simple.
I believe that Char
should be changed to be a typealias for UInt8
. The utf8
property of Swift's String
returns a UTF8View
, which itself is an array of unsigned 8-bit integers. The documentation isn't clear about this, but after some experimentation I've come to the conclusion that the integers are indeed unsigned, which is why we were experiencing crashes when handling any Unicode characters containing a byte larger than 127.
Making this change allows the package to be fully compatible with all Unicode characters.
from mysql-kit.
Fixed with PR #27
from mysql-kit.
Related Issues (20)
- Custom JSONDecoder HOT 1
- Decoding rows with null values to optionals fails
- 'SQLEnumSyntax' and 'SQLAlterTableSyntax' missing in MySQL-kit 4.0.0-beta.3.3 HOT 1
- Value of type 'DatabaseQuery' has no member 'idKey' - FluentMySQLDriver 4.0.0-beta.3 HOT 1
- FluentMySQLDriver crashes when saving dates HOT 4
- Build error on Swift CLI project HOT 4
- Cannot decode String from extracted JSON value
- Error when selecting from database HOT 1
- SimpleQuery fails decoding data version : +3.0.0 HOT 4
- conversion error should include data in question HOT 1
- Support encoding, and collation for database, table, and column HOT 4
- `.text` creates a VARCHAR(255) column HOT 6
- Crash on any mysql query HOT 1
- Rakan
- Question: how are broken connections handled by the pool? HOT 4
- Hostname Validation Error HOT 2
- hard to use in readme's code such as ... HOT 6
- SSH connection HOT 1
- Add api to support high level transaction
- Connection CharacterSet is incorrectly determined HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mysql-kit.