visitor.outputvisitor.SqliteOutPutVisitor.kt Maven / Gradle / Ivy
package visitor.outputvisitor
import ast.expr.SqlIdentifierExpr
import ast.expr.SqlPropertyExpr
import ast.limit.SqlLimit
import ast.statement.upsert.SqlUpsert
class SqliteOutPutVisitor : SqlOutPutVisitor() {
override fun visitSqlLimit(sqlLimit: SqlLimit) {
sqlBuilder.append("LIMIT ${sqlLimit.offset}, ${sqlLimit.limit}")
}
override fun visitSqlUpsert(sqlUpsert: SqlUpsert) {
sqlBuilder.append("INSERT OR REPLACE INTO ")
visitSqlExpr(sqlUpsert.table!!)
sqlBuilder.append(" (")
printList(sqlUpsert.columns, ::visitSqlExpr)
sqlBuilder.append(")")
sqlBuilder.append(" VALUES")
sqlBuilder.append(" (")
printList(sqlUpsert.value, ::visitSqlExpr)
sqlBuilder.append(")")
}
}