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:

committed by
GitHub

parent
7f776bfd29
commit
e943d03298
@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user