<#
data division.
linkage section.
01 require.
procedure division.
#>
<h1>MySQL</h1>
<h2>Databases</h2>
<#
local mysql.

perform require using "mysql" giving mysql.

local options.
local connection.

move object to options.
move "root" to user in options.
move "" to password in options.

perform createConnection in mysql using options giving connection.
perform connect in connection.
perform query in connection using "show databases" showdbs.

showdbs section using err, rows, fields.
if err then 
    display "<h2>" err "</h2>"
    stop run
end-if.
#>
<table>
<tr><th>Database</th></tr>
<#
local k.
local n.
move length in rows to n.
move 0 to k.
local row.

perform varying k from 1 to n
    move rows(k) to row
#>
<tr>
<td><a href='/database?name=${Database in row}'>${Database in row}</a></td>
</tr>
<#
end-perform
#>
</table>
<#
.
stop run.
#>

