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

17 lines
256 B
V
Raw Normal View History

import db.mysql
2019-11-18 02:34:46 +03:00
fn main() {
2023-06-13 08:49:41 +03:00
mut conn := mysql.connect(
host: 'localhost'
port: 3306
username: 'root'
password: ''
dbname: 'mysql'
2023-06-13 08:49:41 +03:00
)!
res := conn.query('show tables')!
for row in res.rows() {
println(row.vals.join(', '))
}
conn.close()
}