bhgomes
5/23/2017 - 1:36 AM

JAQL Snippet Example 1: Creating a Database

JAQL Snippet Example 1: Creating a Database

import bhgomes.jaql.*;

public class MakeDatabase {
    public static void main(String[] args) {
        // Method 1
        Database db1 = JAQL.open("db1", JAQL.SQLITE_DRIVER, "jdbc:sqlite:db1.db");
        db1.info("Built a Database with JAQL convenience class");
        
        // Method 2
        Database db2 = new Database("db2").open(JAQL.SQLITE_DRIVER, "jdbc:sqlite:db1.db");
        db2.info("Built a Database using the Database JAQL Object");
    }
}
import bhgomes.jaql.*;
import bhgomes.jaql.lang.*;

public class QueryExample {
    public static void main(String[] args) {
        Statement st1 = JAQL.open("db1", JAQL.SQLITE_DRIVER, "jdbc:sqlite:db1.db")
                            .execute("SELECT * FROM table1 WHERE name=='BOB'");
        
        st1.results().table(0).get(1, 2); // returns the first column and second row entry of the zeroth table 
    }
}