Sueta
MY

MySQLAPI

1.1

MySQL

·Plugin

Deutsch
Dieses Plugin ist eine MySQL-API. Alle Updates und Anfragen laufen asynchron unter dem Methoden-Aufruf update , query und getValue .

Das Plugin soll Einsteigern helfen, die sich erst mit MySQL beschäftigen. Es ist nicht groß, aber dennoch für Einsteiger sehr nützlich. Der Source-Code steht offen zur Verfügung. Jeder kann die beiden Klassen downloaden und in das eigene Projekt importieren oder das Projekt, sei es per Maven oder sei es per Libraries-Import, hinzufügen.

English
This plugin is an API for MySQL. All updates and requests run asynchronously if you call the methods update , query or getValue .

The plugin is designed to help people who are learning MySQL. It's not big, but it's very useful for beginners. The source code is open. Anyone can download the two classes and import them into their own project or add the project, whether by Maven or by Libraries import.

Developer-Example
import   me.phil.mysql.api.database.DataBaseManager   ;  
 import   me.phil.mysql.api.MySQLAPI   ;  

 public   class  DataBaseManagerExample  {  

     public   void  example  (   )   {  
        DataBaseManager dataBaseManager  =   new  DataBaseManager  (  
                 "localhost"  , 
                 3306  , 
                 "database"  , 
                 "username"  , 
                 "password"   )   ;   // Create an instance.  

        dataBaseManager.  getHost   (   )   ;   // Returns the IP.  
        dataBaseManager.  getPort   (   )   ;   // Returns the port.  
        dataBaseManager.  getDatabase   (   )   ;   // Returns the database-name.  
        dataBaseManager.  getUsername   (   )   ;   // Returns the username.  
        dataBaseManager.  getPassword   (   )   ;   // Returns the password.  
        dataBaseManager.  getConnection   (   )   ;   // Returns the connection if database is connected, null if not.  

        dataBaseManager.  createTable   (   "info"  ,  "uuid VARCHAR(64), example VARCHAR(16)"   )   ;   // Creates an table with columns.  

        dataBaseManager.  connect   (   )   ;   // Connect to an database.  
        dataBaseManager.  connect   (   (   )   ->   {  

             // Put your code here!  
             // for e.g.: System.out.println("Connected!");  

         }   )   ;   // Connect to an database and execute your code.  

        dataBaseManager.  disconnect   (   )   ;   // Disconnect to an database.  
        dataBaseManager.  disconnect   (   (   )   ->   {  

             // Put your code here!  
             // for e.g.: System.out.println("Disconnected!");  

         }   )   ;   // Disconnect to an database and execute your code.  

        dataBaseManager.  update   (   "INSERT INTO info(name, example) VALUES ('xLikePhil', 'otherexample')"   )   ;   // Update an query asynchronous.  
        dataBaseManager.  query   (   "SELECT * FROM info WHERE example = 'xLikePhil';"  , resultSet  ->   {  

             // Put your code here!  
             // for e.g.: System.out.println(resultSet.next());  

         }   )   ;   // Update an query and return ResultSet asynchronous and execute your code.  

        dataBaseManager.  isConnected   (   )   ;   // Return if database is connected.  

        dataBaseManager.  getValue   (   "info"  ,  "name"  ,  "xLikePhil"  ,  "example"  , object  ->   {  

         /* 
        Put your code here! 

        for e.g.: 
        String example = (String) object; 
        Bukkit.getPlayer("xLikePhil").sendMessage("Your example: " + example); 
        */  

         }   )   ;   // Return an value from database asynchronous and execute your code.  

     public   void  otherExample  (   )   {  
        MySQLAPI.  getConnections   (   )   ;   // Return all connections.  
        MySQLAPI.  getPlugin   (  MySQLAPI.  class   )   ;   // Return JavaPlugin of the class.  
        MySQLAPI.  getProvidingPlugin   (  MySQLAPI.  class   )   ;   // Return the instance of the class.  
     }  
 }

Similar projects

Plugin →