Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package parser;
- import java.io.BufferedReader;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.FileReader;
- import java.io.IOException;
- import static java.lang.System.in;
- import java.util.LinkedList;
- import java.util.List;
- import java.util.Scanner;
- import static javafx.beans.binding.Bindings.select;
- /**
- *
- * @author syiti
- */
- public class Main {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) throws FileNotFoundException, IOException {
- File file = new File("E:\\Kuliah\\SBD\\tucil\\test.txt");
- BufferedReader br = new BufferedReader(new FileReader(file));
- List<String> lines = new LinkedList<String>(); // create a new list
- String line = br.readLine(); // read a line at a time
- String[] lineArr = line.split(";");
- while(line != null){ // loop till you have no more lines
- System.out.println(line);
- lines.add(line); // add the line to your list
- line = br.readLine(); // try to read another line
- System.out.println("--");
- }
- System.out.println("Masukkan SQL statement: ");
- Scanner s= new Scanner(System.in);
- String t = s.nextLine();
- String[] stringArr = t.split(" ");
- if (stringArr[0].equals("SELECT")){
- System.out.println("yess");
- if (stringArr[2].equals("FROM")){
- System.out.println("wtfff");
- int i = 0;
- int j = 0;
- while(!lineArr[i].equalsIgnoreCase(stringArr[3])){
- i++;
- }
- /* if (stringArr[3].equals("member")){
- System.out.println("yess");
- int i = 0;
- while (stringArr[1].charAt(i) != ','){
- System.out.println("blaaa");
- char c=stringArr[1].charAt(i);
- System.out.println(c);
- i++;
- }
- } else if (stringArr[3].equals("book")){
- } else if (stringArr[3].equals("borrow")){
- } else {
- System.out.println("SQL Error (Table doesn't exist)");
- }
- }
- } else {
- System.out.println("Output : SQL Error (Syntax Error)");*/
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement