parent
fc1a46feed
commit
5e3972670d
2 changed files with 41 additions and 0 deletions
@ -0,0 +1,12 @@ |
||||
package com.lq.code.util.sql.factory; |
||||
|
||||
import com.lq.code.util.sql.AbstractDbBuiler; |
||||
|
||||
/** |
||||
* Sql 工厂 |
||||
* @author qi |
||||
*/ |
||||
public interface DbBuilerFactory { |
||||
|
||||
AbstractDbBuiler getSqlBuilder(String dbType); |
||||
} |
@ -0,0 +1,29 @@ |
||||
package com.lq.code.util.sql.factory.impl; |
||||
|
||||
import com.lq.code.util.sql.AbstractDbBuiler; |
||||
import com.lq.code.util.sql.MysqlBuilder; |
||||
import com.lq.code.util.sql.OracleBuiler; |
||||
import com.lq.code.util.sql.SqlConstant; |
||||
import com.lq.code.util.sql.factory.DbBuilerFactory; |
||||
|
||||
/** |
||||
* @author qi |
||||
* dbBuilfer 生产工厂模式默认实现 |
||||
*/ |
||||
public class DefaultDbBuilerFactory implements DbBuilerFactory { |
||||
|
||||
@Override |
||||
public AbstractDbBuiler getSqlBuilder(String dbType) { |
||||
AbstractDbBuiler abstractDbBuiler = null; |
||||
switch (dbType){ |
||||
case SqlConstant |
||||
.DB_TYPE_MYSQL: |
||||
abstractDbBuiler = new MysqlBuilder(); |
||||
break; |
||||
case SqlConstant.DB_TYPE_ORACLE: |
||||
abstractDbBuiler = new OracleBuiler(); |
||||
break; |
||||
} |
||||
return abstractDbBuiler; |
||||
} |
||||
} |
Loading…
Reference in new issue