| 1 19 package org.lucane.server.database; 20 21 import java.sql.Connection ; 22 import java.sql.SQLException ; 23 24 import javax.sql.DataSource ; 25 26 27 class MySQLLayer extends DatabaseAbstractionLayer 28 { 29 private DataSource dataSource; 30 31 public MySQLLayer(DataSource dataSource) 32 { 33 this.dataSource = dataSource; 34 } 35 36 public Connection getConnection() 37 throws SQLException  38 { 39 return dataSource.getConnection(); 40 } 41 42 public String resolveType(String type) 43 { 44 if(type.equalsIgnoreCase("SMALLTEXT")) 45 return "VARCHAR(250)"; 46 else if(type.equalsIgnoreCase("TEXT")) 47 return "MEDIUMTEXT"; 48 else if(type.equalsIgnoreCase("SMALLINT")) 49 return "SMALLINT"; 50 else if(type.equalsIgnoreCase("INT")) 51 return "INT"; 52 else if(type.equalsIgnoreCase("BIGINT")) 53 return "BIGINT"; 54 else if(type.equalsIgnoreCase("REAL")) 55 return "DOUBLE"; 56 else 57 return type; 58 } 59 } 60 | Popular Tags |