Skip to content

Latest commit

 

History

History
49 lines (44 loc) · 1.47 KB

README.md

File metadata and controls

49 lines (44 loc) · 1.47 KB

JPL_project

5th sem java project

- !!!!!!!!!!!!!!!!!!!! Download files folders in the same format as the repo !!!!!!!!!!!!!!!!!!!!

File exection on cmd from the given parent folder

  • jcmpl CodeFile.java
  • jrun CodeFile

class QuizDB - API for querying the quiz database

Present in the quizlib package

Attributes

  • fields : List of fields
  • table : matrix of all the rows below the heading

Methods

  • void runQuery(String query) : Updates the field and table contents based on the String query
  • void resultDisplay() : Display result table
  • ArrayList< ArrayList<String> > getResult() : returns the matrix of entire result table. The first row comprises the headers (field names)

Example

import java.util.Collection;
import java.util.ArrayList;
import quizlib.QuizDB;

public class TestAPI
{
	public static void main(String args[])
	{
		QuizDB qobj = new QuizDB();
		qobj.runQuery("SELECT * FROM course");
		System.out.println("Testing resultDisplay:");
		qobj.resultDisplay();
		
		System.out.println("\nTesting getResult:");
		ArrayList<ArrayList<String>> result = qobj.getResult();
		for(ArrayList<String> row : result)
		{
			for(String data : row)
				System.out.print(data+"\t|\t");
			System.out.println();	
		}
	}
}

image

command_script.txt

command_script.txt has important PGSQL queries that will be needed from time to time