1 5 package org.lucane.server.database; 6 7 import java.sql.Connection ; 8 import java.sql.SQLException ; 9 10 import javax.sql.DataSource ; 11 12 class SQLServerLayer extends DatabaseAbstractionLayer 13 { 14 private DataSource dataSource; 15 16 public SQLServerLayer(DataSource dataSource) 17 { 18 this.dataSource = dataSource; 19 } 20 21 public Connection getConnection() 22 throws SQLException 23 { 24 return dataSource.getConnection(); 25 } 26 27 public String resolveType(String type) 28 { 29 if(type.equalsIgnoreCase("SMALLTEXT")) 30 return "VARCHAR(250)"; 31 else if(type.equalsIgnoreCase("TEXT")) 32 return "TEXT"; 33 else if(type.equalsIgnoreCase("SMALLINT")) 34 return "SMALLINT"; 35 else if(type.equalsIgnoreCase("INT")) 36 return "INT"; 37 else if(type.equalsIgnoreCase("BIGINT")) 38 return "BIGINT"; 39 else if(type.equalsIgnoreCase("REAL")) 40 return "REAL"; 41 else 42 return type; 43 } 44 } | Popular Tags |