v/examples/database/mysql.v

19 lines
286 B
V

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