comparison src/luan/host/init.luan @ 1407:1979cff9aad2

add sql/Web_query
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 20 Sep 2019 17:00:30 -0600
parents 8fe777ba5045
children 4abf88ec66de
comparison
equal deleted inserted replaced
1406:8187ddb0e827 1407:1979cff9aad2
86 url = "jdbc:postgresql://localhost:5432/"..domain 86 url = "jdbc:postgresql://localhost:5432/"..domain
87 user = domain 87 user = domain
88 password = Io.password 88 password = Io.password
89 } 89 }
90 local db = database(pg) 90 local db = database(pg)
91 local exists = db.query("select datname from pg_database where datname=?",domain)() ~= nil; 91 local exists = db.query("select datname from pg_database where datname=?",domain).results() ~= nil;
92 --logger.info("exists "..exists) 92 --logger.info("exists "..exists)
93 if not exists then 93 if not exists then
94 db.update( [[create user "]]..spec.user..[[" with encrypted password ']]..spec.password..[[']] ) 94 db.update( [[create user "]]..spec.user..[[" with encrypted password ']]..spec.password..[[']] )
95 db.update( [[create database "]]..domain..[[" owner "]]..spec.user..[["]] ) 95 db.update( [[create database "]]..domain..[[" owner "]]..spec.user..[["]] )
96 end 96 end