package com.jqmobile.core.orm;
import java.sql.SQLException;
import com.jqmobile.core.orm.exception.ORMException;
/**
* Table工具,当前所有表更新实现为增量更新,只增加字段,不减少字段。不支持原有字段改变类型
* @author modi
*
*/
public interface TableUtil {
/**
* 创建数据库表
* @param c
* @throws SQLException
*/
void createTable(Class<?> c) throws ORMException;
/**
* 更新一张表,不判断版本号
* @param c
* @throws SQLException
*/
void updateTable(Class<?> c) throws ORMException;
/**
* 自动更新当前已有所有表(根据各表的版本号自动判断需要更新的表,并更新)
* @throws SQLException
*/
void autoUpdateAllTables() throws ORMException;
/**
* 自动更新指定表(判断版本号)
* @param c
* @throws SQLException
*/
void autoUpdateTable(Class<?> c) throws ORMException;
/**
* 校验指定表是否已存在,存在返回true
* @param tableName
* @return
* @throws SQLException
*/
boolean valiTableExist(String tableName) throws ORMException;
/**
* 创建中间表
* @param c
* @param childClass
* @throws ORMException
*/
void createMiddleTable(Class<?> c, Class<?> childClass) throws ORMException;
}