Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    JoSQL 1.9

    Download button

    No screenshots available
    Downloads: 673  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Excellent (5.0/5)
    2 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Gary Bentley | More programs
    The Apache License 2.0 / FREE
    August 23rd, 2007, 21:35 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    JoSQL description

    JoSQL (SQL for Java Objects) provides the ability for a developer to apply a SQL statement to a collection of Java Objects.

    JoSQL (SQL for Java Objects) provides the ability for a developer to apply a SQL statement to a collection of Java Objects.

    JoSQL provides the ability to search, order and group ANY Java objects and should be applied when you want to perform SQL-like queries on a collection of Java Objects.

    Example:

    // Get a list of java.io.File objects.
    List myObjs = getMyObjects ();

    // Create a new Query.
    Query q = new Query ();

    // Parse the SQL you are going to use, it is assumed here that
    // "myObjs" contains instances of "java.io.File".
    q.parse ("SELECT name,length " +
    "FROM java.io.File " +
    "WHERE fileExtension (name) = :fileExt " +
    "ORDER BY length DESC, name " +
    "EXECUTE ON RESULTS avg (:_allobjs, length) avgLength");

    // Set the bind variable "fileExt".
    q.setVariable ("fileExt", "java");

    // Execute the query.
    QueryResults qr = q.execute (myObjs);

    // Get the average length, this is a save value, the result
    // of executing the call "avg (:_allobjs, length)", it is saved against
    // key: "avgLength".
    Map saveValues = qr.getSaveValues ();
    Number avg = (Number) saveValues.get ("avgLength");

    // Cycle over the results.
    List res = qr.getResults ();

    for (int i = 0; i < res.size (); i++)
    {

    // This time there is a List for each row, index 0 holds the name of
    // the file that matched, index 1 holds the length.
    List r = (List) res.get (i);

    System.out.println ("NAME: " + r.get (0));
    System.out.println ("LENGTH: " + r.get (1) + ", AVG: " + avg);

    }

    What's New in This Release:

    · Added support for an expression list
    · New interface for not fixed function results



    Product's homepage

      


    TAGS:

    java library | Java Objects | SQL statement | JoSQL | java | sql

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM