mysql: migrate connection flags to enum instead of const, fix example (#7803)

This commit is contained in:
Don Alfons Nisnoni 2021-01-02 21:09:20 +08:00 committed by GitHub
parent 7f776bfd29
commit e943d03298
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 32 deletions

View file

@ -1,15 +1,18 @@
// import mysql
// fn main() {
// conn := mysql.connect('localhost', 'root', '', 'mysql')
// res := conn.query('show tables')
// for row in res.rows() {
// println(row.vals.join(', '))
// }
// res.free()
// conn.close()
// }
import mysql
fn main() {
}
mut conn := mysql.Connection{
host: 'localhost'
port: 3306
username: 'root'
password: ''
dbname: 'mysql'
}
conn.connect() ?
res := conn.query('show tables') ?
for row in res.rows() {
println(row.vals.join(', '))
}
res.free()
conn.close()
}