novi / mysql-swift

A type safe MySQL client for Swift
MIT License
164 stars 40 forks source link

Handle the "count(*)" query #79

Closed macwish closed 6 years ago

macwish commented 6 years ago
let count: UInt = try conn.query("SELECT count(*) FROM users WHERE age > ? ",  [16])
// or
let count: QueryStatus = try conn.query("SELECT count(*) FROM users WHERE age > ? ",  [16])

Hi @novi , how to handle the count(*) queries? Thank you in advance for your help!

novi commented 6 years ago

Try as keywords:

"SELECT count(*) as `count` FROM users WHERE age > ? "

This query maps the count into count key.