Open mvysny opened 3 months ago
Workaround: use JDBC:
fun main() {
val database = Database.connect("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", user = "root", password = "***")
database.useTransaction {
it.connection.prepareStatement("""create table t_employee(
id int not null primary key auto_increment,
name varchar(128) not null,
job varchar(128) not null,
manager_id int null,
hire_date date not null,
salary bigint not null,
department_id int not null
);""").executeUpdate()
}
for (row in database.from(Employees).select()) {
println(row[Employees.name])
}
}
you also can see see this function: org.ktorm.database.Database#useConnection
Would be great if README.md documented how to run DDLs; it would help running an example code quickly on a H2 in-memory database. I only found
database.executeUpdate()
but I have no idea whichSqlExpression
to use for a DDL statement.