You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update package support files (dockerignore, readme, CI workflows)
* Minimal code cleanup - replace `fatalError()`s and `assert()`s with thrown errors, add escapes in comments so Xcode's inline formatting doesn't choke, add `any` to existential usage, other very minor tweaks.
* Fix the "server sends error packet when nothing else is going on causes crash" problem - fixes#87
* Add fix for the bad protocol version bug - fixes#91
* Fix the tests bug that causes problems with the `foos` table still existing when the integration tests for FluentMySQLDriver run.
* Work around weird deadlock on Linux
* Remove many unneeded !s from try!s in tests
@@ -96,14 +90,14 @@ The first step to making a query is creating a new `MySQLConnection`. The minimu
96
90
```swift
97
91
importMySQLNIO
98
92
99
-
let eventLoop: EventLoop =...
100
-
let conn =tryMySQLConnection(
101
-
to: .makeAddressResolvingHost("my.mysql.server", port: 5432),
93
+
let eventLoop: anyEventLoop =...
94
+
let conn =tryawaitMySQLConnection(
95
+
to: .makeAddressResolvingHost("my.mysql.server", port: 3306),
102
96
username: "test_username",
103
97
database: "test_database",
104
98
password: "test_password",
105
99
on: eventLoop
106
-
).wait()
100
+
).get()
107
101
```
108
102
109
103
Note: These examples will make use of `wait()` for simplicity. This is appropriate if you are using MySQLNIO on the main thread, like for a CLI tool or in tests. However, you should never use `wait()` on an event loop.
@@ -130,7 +124,7 @@ Interaction with a server revolves around the `MySQLDatabase` protocol. This pro
130
124
```swift
131
125
importMySQLNIO
132
126
133
-
let db: MySQLDatabase =...
127
+
let db: anyMySQLDatabase =...
134
128
// now we can use client to do queries
135
129
```
136
130
@@ -143,12 +137,12 @@ These queries are most useful for schema or transactional queries, or simple sel
143
137
`simpleQuery` has two overloads, one that returns an array of rows, and one that accepts a closure for handling each row as it is returned.
144
138
145
139
```swift
146
-
let rows =try db.simpleQuery("SELECT @@version").wait()
140
+
let rows =tryawaitdb.simpleQuery("SELECT @@version").get()
147
141
print(rows) // [["@@version": "8.x.x"]]
148
142
149
-
try db.simpleQuery("SELECT @@version") { row in
143
+
tryawaitdb.simpleQuery("SELECT @@version") { row in
150
144
print(row) // ["@@version": "8.x.x"]
151
-
}.wait()
145
+
}.get()
152
146
```
153
147
154
148
### Parameterized Query
@@ -160,20 +154,20 @@ These queries are most useful for selecting, inserting, and updating data. Data
160
154
Just like `simpleQuery`, `query` also offers two overloads. One that returns an array of rows, and one that accepts a closure for handling each row as it is returned.
161
155
162
156
```swift
163
-
let rows =try db.query("SELECT * FROM planets WHERE name = ?", ["Earth"]).wait()
157
+
let rows =tryawaitdb.query("SELECT * FROM planets WHERE name = ?", ["Earth"]).get()
164
158
print(rows) // [["id": 42, "name": "Earth"]]
165
159
166
-
try db.query("SELECT * FROM planets WHERE name = ?", ["Earth"]) { row in
160
+
tryawaitdb.query("SELECT * FROM planets WHERE name = ?", ["Earth"]) { row in
167
161
print(row) // ["id": 42, "name": "Earth"]
168
-
}.wait()
162
+
}.get()
169
163
```
170
164
171
165
### Rows and Data
172
166
173
167
Both `simpleQuery` and `query` return the same `MySQLRow` type. Columns can be fetched from the row using the `column(_:table:)` method.
0 commit comments