Advertisement
Guest User

test

a guest
Feb 24th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package parser;
  7.  
  8. import java.io.BufferedReader;
  9. import java.io.File;
  10. import java.io.FileNotFoundException;
  11. import java.io.FileReader;
  12. import java.io.IOException;
  13. import static java.lang.System.in;
  14. import java.util.LinkedList;
  15. import java.util.List;
  16. import java.util.Scanner;
  17. import static javafx.beans.binding.Bindings.select;
  18.  
  19. /**
  20. *
  21. * @author syiti
  22. */
  23. public class Main {
  24.  
  25. /**
  26. * @param args the command line arguments
  27. */
  28. public static void main(String[] args) throws FileNotFoundException, IOException {
  29. File file = new File("E:\\Kuliah\\SBD\\tucil\\test.txt");
  30.  
  31. BufferedReader br = new BufferedReader(new FileReader(file));
  32.  
  33. List<String> lines = new LinkedList<String>(); // create a new list
  34. String line = br.readLine(); // read a line at a time
  35. String[] lineArr = line.split(";");
  36. while(line != null){ // loop till you have no more lines
  37. System.out.println(line);
  38. lines.add(line); // add the line to your list
  39. line = br.readLine(); // try to read another line
  40. System.out.println("--");
  41. }
  42.  
  43. System.out.println("Masukkan SQL statement: ");
  44. Scanner s= new Scanner(System.in);
  45. String t = s.nextLine();
  46. String[] stringArr = t.split(" ");
  47.  
  48. if (stringArr[0].equals("SELECT")){
  49. System.out.println("yess");
  50. if (stringArr[2].equals("FROM")){
  51. System.out.println("wtfff");
  52. int i = 0;
  53. int j = 0;
  54. while(!lineArr[i].equalsIgnoreCase(stringArr[3])){
  55. i++;
  56. }
  57. /* if (stringArr[3].equals("member")){
  58. System.out.println("yess");
  59. int i = 0;
  60. while (stringArr[1].charAt(i) != ','){
  61. System.out.println("blaaa");
  62. char c=stringArr[1].charAt(i);
  63. System.out.println(c);
  64. i++;
  65. }
  66. } else if (stringArr[3].equals("book")){
  67.  
  68. } else if (stringArr[3].equals("borrow")){
  69.  
  70. } else {
  71. System.out.println("SQL Error (Table doesn't exist)");
  72. }
  73. }
  74. } else {
  75. System.out.println("Output : SQL Error (Syntax Error)");*/
  76. }
  77.  
  78. }
  79.  
  80. }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement