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

lodsve.mybatis.dialect.Dialect Maven / Gradle / Ivy

/*
 * Copyright (C) 2018  Sun.Hao
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 */

package lodsve.mybatis.dialect;

import javax.sql.DataSource;

/**
 * 数据库方言.
 *
 * @author sunhao([email protected])
 * @date 2016-2-18 15:40
 */
public interface Dialect {
    /**
     * 获得查询所有条数的sql
     *
     * @param sql 原sql
     * @return 查询所有条数的sql
     */
    String getCountSql(String sql);

    /**
     * 获得分页的sql
     * 由于各个数据库分页语句不同,故让子类自己实现此方法
     *
     * @param sql    原sql
     * @param offset 偏移量
     * @param limit  数量
     * @return 分页的sql
     */
    String getPageSql(String sql, int offset, int limit);

    /**
     * 判断数据库中是否含有给定的表
     *
     * @param tableName  表名
     * @param dataSource 数据源
     * @return true/false
     * @throws Exception 获取数据源失败
     */
    boolean existTable(String tableName, DataSource dataSource) throws Exception;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy