All Downloads are FREE. Search and download functionalities are using the official Maven repository.

visitor.outputvisitor.SqliteOutPutVisitor.kt Maven / Gradle / Ivy

There is a newer version: 1.1.10
Show newest version
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(")")
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy