SQL querys on local HTML files using JavaScript?

Discussion in 'Javascript' started by Joe Doe, Oct 22, 2004.

  1. Joe Doe

    Joe Doe Guest

    Hi!

    I've got a site on ASP, generating pages dynamically from querys to an
    SQL Server database. You know, the typical products table, etc.

    Now I need to make a CD version of the site, so the ASP pages will be
    translated to HTML pages that will be executed directly from the CD,
    without a web server.

    So, what I've done is translate the tables to bidimensional JavaScript
    arrays, I have now a file called "products.js" that generates the
    product table on an array, on this way:

    // -------------------
    p=new Array(203);

    for(j=0;j<203;j++)
    {
    p[j]=new Array(8);
    }

    p[0][0]="5";
    p[0][1]="A001";
    p[0][2]="DESCRIPTION OF THIS PRODUCT";
    p[0][3]="02";
    p[0][4]="0";
    p[0][5]="20";
    p[0][6]="False";
    p[0][7]="ENF";

    p[1][0]="239";
    p[1][1]="B014";
    p[1][2]="ANOTHER PRODUCT";
    p[1][3]="08";
    p[1][4]="2487";
    p[1][5]="500";
    p[1][6]="True";
    p[1][7]="SPU";

    // --------------------- etc...

    This way, having an HTML page that looks for the details of a given
    product by its ID (column p[0]) is really easy to do, just loop the
    array looking for this ID, and return the values stored there.

    That's OK for simple pages like this one, but the site also has a search
    form, to find products using complex queries like "give me all products
    that contain the word 'useful' on its description, having blue colour,
    being in stock, with manufacture date between this and that date, etc.".
    This is quite easy to do with SQL, but how could I do this when I have
    several tables that have been translated to JavaScript bidimensional arrays?

    Is there any kit that would let me do standard SQL queries on
    JavaScript/HTML local files?

    I've been reading about XML for <SCRIPT>:

    http://xmljs.sourceforge.net/

    that might be good for me, but is there any other simpler tool?

    Thanks a lot,

    Joe
     
    Joe Doe, Oct 22, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. karim
    Replies:
    1
    Views:
    792
    George Ter-Saakov
    Jun 26, 2003
  2. Alan
    Replies:
    3
    Views:
    496
    Sudsy
    Jan 22, 2004
  3. ali
    Replies:
    6
    Views:
    345
    Rogier R. Spaans
    Dec 31, 2004
  4. Lyndon
    Replies:
    1
    Views:
    552
    Leonard Blaisdell
    Jul 25, 2005
  5. Fuzzydave

    Nested Looping SQL Querys

    Fuzzydave, Sep 20, 2006, in forum: Python
    Replies:
    8
    Views:
    409
    Steve Holden
    Sep 21, 2006
Loading...

Share This Page