query.ddl.DropIndex.kt Maven / Gradle / Ivy
package query.ddl
import ast.statement.ddl.SqlDropIndex
import ast.expr.SqlIdentifierExpr
import database.DB
import query.ReviseQuery
import util.toSqlString
import java.sql.Connection
class DropIndex(
var db: DB = DB.MYSQL,
override var conn: Connection? = null,
override var isTransaction: Boolean = false
) : ReviseQuery() {
constructor(db: DB) : this(db, null, false)
private var sqlDropIndex = SqlDropIndex()
infix fun drop(indexName: String): DropIndex {
sqlDropIndex.name = SqlIdentifierExpr(indexName)
return this
}
infix fun on(table: String): DropIndex {
sqlDropIndex.table = SqlIdentifierExpr(table)
return this
}
override fun sql() = toSqlString(sqlDropIndex, db)
}