Luc Girardin
05/16/2023, 3:04 PMfun CairoEngine.isTableEmpty(tableName: String) : Boolean {
var empty = true
val ctx = SqlExecutionContextImpl(this, 1)
try {
SqlCompiler(this).use { compiler ->
compiler.compile(tableName, ctx).recordCursorFactory.use { factory ->
factory.getCursor(ctx).use { cursor ->
if (cursor.hasNext()) {
empty = false
}
}
}
}
} catch (e: SqlException) {
} finally {
ctx.close()
}
return empty
}
Imre
05/16/2023, 3:16 PMctx.with(AllowAllSecurityContex.INSTANCE, null, null)
Luc Girardin
05/16/2023, 3:38 PM