1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

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
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()
}