Advertisement
pleasemore123

Untitled

Aug 26th, 2014
1,988
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Decided to give this out, well, its great, i'm not going to teach you how to use, but, this is a wonderful language to implent between Java to SQL.
  2.  
  3.  
  4. [code]
  5.  
  6. import SQL.*;
  7. import MySQL.DatabaseConnection.*;
  8. import MySQL.International.*;
  9.  
  10. import server.Server;
  11. import server.util.SQL.getters;
  12. import server.util.SQL.setters;
  13. import server.util.SQL.DatabaseConfiguration;
  14. import server.util.Connection;
  15. from 'user.home': InternetAndConfigurations.*;
  16.  
  17. /** Author Dharokist
  18.   * 27/07/2014 (Israel <3)
  19.   * Auto connect to database with Java
  20. **/
  21. class AutoConnectDatabase {
  22. @settlers("expect").class;
  23. @getters("expect").class;
  24.  
  25.   String IP = 127.0.0.1;
  26.   String ROOT = "database.test";
  27.   String PASS = "tellmeyourpassandilltellyoumine";
  28.   int IP, ROOT, PASS;
  29.  
  30.   void StringToInt(syndicate[ints 1-0]) {
  31.           new Settler settler = Object[settler];
  32.           StringToInt(IP);
  33.           int IP = this.IP;
  34.  
  35.           StringToInt(ROOT);
  36.           int ROOT = this.ROOT;
  37.  
  38.           StringToInt(PASS);
  39.           int PASS = this.PASS;
  40.   }
  41.   indexStatus = "connecting";
  42.   $ query 'connect' (simulation[] (syndicated(SYU)) {
  43.     void info(int IP, ROOT, PASS) {
  44.          'Dataconnect' =
  45.           IP; Root; Pass;
  46.           MySQLDataHandle.handle(connection(IP, ROOT, PASS).indexOf("query(connect[IP]"));
  47.           sendByConnection(IP,ROOT,PASS);
  48.     }
  49.  
  50.     for (int i; i < dataMaxNumber; i++; - (null ? true : false)) {
  51.          continue.evenIfNull(while return);
  52.          @surpressWarning("unexpected")
  53.          catch {
  54.                 (i.expectionHandledWell(unexpected))
  55.                  return dataMentNumberous;
  56.          }
  57.     }
  58.   }
  59.  
  60.  $ query 'recieve' (simulation[] (getData(SYU)) {
  61.     International(Set());
  62.     Internet $ setter = elsed();
  63.     connection.Configure().bytesReturning(5, 4, 5083, 5088)); //db, databases in use, database id to appprove from - to
  64.     int totalDatabases = 4; // change to your databases
  65.     switch (totalDatabases) {
  66.           case 0:
  67.                 return 5083:
  68.           case 1:
  69.                 return 5084;
  70.           case 2:
  71.                 return 5085:
  72.           case 3:
  73.                 return 5086:
  74.           case 4:
  75.                 return 5087:
  76.           default:
  77.                 "expection.toPrintOf()"; //Prints out the error, shouldn't be happen unless you have a wrong database id
  78.      }    
  79.      on-void read() {
  80.      if (dataRecieved(from 'query 'recieve')) {
  81.           for (int dataID = 5084; DataID < 5088; DataID++) {
  82.                   expection.toPrintOf(indexStatus);
  83.                   try {
  84.                        connect(IP, ROOT, PASS) {
  85.                        //dataUD[][] = {{ 5084, 1, "Database"}}; //unnecessary as only 1 dataUD use, uncomment when more
  86.                        //Todo: reading while expection and data arrady 2d
  87.                        SQL.RecieveDataFromWebhost(IP, ROOT, PASS, dataID);
  88.                        use (SQL.RecievedDataSettedVoid)
  89.                        for {
  90.                            generate().WNDC(while(expectionUnHandled)().addMore++));
  91.                            seeData(dataID); send towards: SQL.ConnectWith(from 'query 'connect');
  92.  
  93.                             }
  94.                    } catch (expection DatabaseNew().RecieveNew()) {
  95.                         PrintOf(expectionToString);
  96.                    }
  97.             }
  98.       }
  99.                        
  100.      printOf("Could find, so now final connection!");
  101.      MySQLDataHandle.connection().addOfIP = info(IP);
  102.      seeData(String: Connected IP!");
  103.     MySQLDataHandle.connection().addOfPASS = info(PASS);
  104.     seeData(String: Connected Pass!");
  105.      MySQLDataHandle.connection().addOfROOT = info(ROOT);
  106.      seeData(String: Connected Root!");
  107.     }  
  108.  
  109.    void seeData(int dataID) {
  110.            info(ip, root, pass)) ? through: MySQL.Datahandle(this);
  111.            success:
  112.                        'printOf' = "Connected!";
  113.            failure:
  114.                        'printOf' = "Couldn't read connection!";
  115.           return;
  116.           expection: { Database.expectedUniversalConnection };
  117.  
  118.    }
  119.  
  120.    void paraFast(connect().SQL.setters(null(throwsExpectionIfLocked))) {
  121.          if (MySQLDataHandler(handle == true == setIndex("Connected to webhost, fasting the bytes")) {
  122.              from query 'connect' {
  123.                 boolean disRefused = false;
  124.                 handle(situtationType > 3) {
  125.                         expectionBefore().sync(connect, IP);
  126.                         CheckForExpection();
  127.                         disRefused = true;
  128.                 } else handle(situtationType < 3) {
  129.                          sendConnectionBytes(connect, settled(void info(continue)); //so it keeps sending the info thought we tackled a leak
  130.                          enterWithoutExpection(settled);
  131.                 }
  132.                 from ('qurey 'connect': disRefuse = true) {
  133.                  while (disRefuse == true)
  134.                         recieve();
  135.                  }
  136.           }
  137.    }
  138.  
  139. }
  140.  
  141. [/code]
Advertisement
RAW Paste Data Copied
Advertisement