Advertisement
Guest User

Untitled

a guest
Sep 15th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.98 KB | None | 0 0
  1. package com.alta189.sqlLibrary.MySQL;
  2.  
  3. import java.net.MalformedURLException;
  4. import java.sql.Connection;
  5. import java.sql.ResultSet;
  6. import java.util.logging.Logger;
  7.  
  8. public class mysqlCore {
  9.     private Logger log;
  10.     private String logPrefix;
  11.     public String host;
  12.     private DatabaseHandler manageDB;
  13.     public String username;
  14.     public String password;
  15.     public String database;
  16.    
  17.     public mysqlCore(Logger log, String logPrefix, String host, String database, String username, String password) {
  18.         this.log = log;
  19.         this.logPrefix = logPrefix;
  20.         this.database = database;
  21.         this.host = host;
  22.         this.username = username;
  23.         this.password = password;
  24.     }
  25.    
  26.     public Boolean initialize() {
  27.        
  28.         this.manageDB = new DatabaseHandler(this, this.host, this.database, this.username, this.password);
  29.        
  30.         return false;
  31.     }
  32.    
  33.     public void writeInfo(String toWrite) {
  34.         if (toWrite != null) {
  35.             this.log.info(this.logPrefix + toWrite);
  36.         }
  37.     }
  38.    
  39.     public void writeError(String toWrite, Boolean severe) {
  40.         if (severe) {
  41.             if (toWrite != null) {
  42.                 this.log.severe(this.logPrefix + toWrite);
  43.             }
  44.         } else {
  45.             if (toWrite != null) {
  46.                 this.log.warning(this.logPrefix + toWrite);
  47.             }
  48.         }
  49.     }
  50.    
  51.     public ResultSet sqlQuery(String query) throws MalformedURLException, InstantiationException, IllegalAccessException {
  52.         return this.manageDB.sqlQuery(query);
  53.     }
  54.    
  55.     public Boolean createTable(String query) {
  56.         return this.manageDB.createTable(query);
  57.     }
  58.    
  59.     public void insertQuery(String query) throws MalformedURLException, InstantiationException, IllegalAccessException {
  60.         this.manageDB.insertQuery(query);
  61.     }
  62.    
  63.     public void updateQuery(String query) throws MalformedURLException, InstantiationException, IllegalAccessException {
  64.         this.manageDB.updateQuery(query);
  65.     }
  66.    
  67.     public void deleteQuery(String query) throws MalformedURLException, InstantiationException, IllegalAccessException {
  68.         this.manageDB.deleteQuery(query);
  69.     }
  70.    
  71.     public Boolean checkTable(String table) throws MalformedURLException, InstantiationException, IllegalAccessException {
  72.         return this.manageDB.checkTable(table);
  73.     }
  74.    
  75.     public Boolean wipeTable(String table) throws MalformedURLException, InstantiationException, IllegalAccessException {
  76.         return this.manageDB.wipeTable(table);
  77.     }
  78.    
  79.     public Connection getConnection() throws MalformedURLException, InstantiationException, IllegalAccessException {
  80.         return this.manageDB.getConnection();
  81.     }
  82.    
  83.     public void close() {
  84.         this.manageDB.closeConnection();
  85.     }
  86.    
  87.     public Boolean checkConnection() throws MalformedURLException, InstantiationException, IllegalAccessException {
  88.         return this.manageDB.checkConnection();
  89.     }
  90.    
  91.     public Boolean checkNewConnection() throws MalformedURLException, InstantiationException, IllegalAccessException {
  92.         return this.manageDB.checkNewConnection();
  93.     }
  94.    
  95.     public Connection getNewConnection() throws MalformedURLException, InstantiationException, IllegalAccessException {
  96.         return this.manageDB.getNewConnection();
  97.     }
  98.    
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement