[SOLVED] CS SQL database Java package ed.inf.adbs.lightdb;

$25

File Name: CS_SQL_database_Java_package_ed.inf.adbs.lightdb;.zip
File Size: 461.58 KB

5/5 - (1 vote)

package ed.inf.adbs.lightdb;

import java.io.FileReader;

import net.sf.jsqlparser.parser.CCJSqlParserUtil;
import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.statement.select.Select;

/**
* Lightweight in-memory database system
*
*/
public class LightDB {

public static void main(String[] args) {

if (args.length != 3) {
System.err.println(Usage: LightDB database_dir input_file output_file);
return;
}

String databaseDir = args[0];
String inputFile = args[1];
String outputFile = args[2];

parsingExample(inputFile);
}

/**
* Example method for getting started with JSQLParser. Reads SQL statement from
* a file and prints it to screen; then extracts SelectBody from the query and
* prints it to screen.
*/

public static void parsingExample(String filename) {
try {
Statement statement = CCJSqlParserUtil.parse(new FileReader(filename));
//Statement statement = CCJSqlParserUtil.parse(SELECT * FROM Boats);
if (statement != null) {
System.out.println(Read statement: + statement);
Select select = (Select) statement;
System.out.println(Select body is + select.getSelectBody());
}
} catch (Exception e) {
System.err.println(Exception occurred during parsing);
e.printStackTrace();
}
}
}

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS SQL database Java package ed.inf.adbs.lightdb;
$25