Mailing List Archive



Back to the month index Back to the list index

bob basques (bob.basques@stpaul.gov)
Mon, 07 Apr 1997 16:06:01 -0500


Message-Id: <334961B9.17AA@stpaul.gov>
Date: Mon, 07 Apr 1997 16:06:01 -0500
From: bob basques <bob.basques@stpaul.gov>
Subject: Re: [mSQL] mSQL/Perl -- How to capture query results

SAW Computer Enterprises wrote:
>
> Experience with mSQL: none
> Experience with Perl: about 6 months
> Server: Apache
> Development OS: Win95
> Perl Adapter Version: 1.x
> mSQL Version: 1.x
>
> What I have done: read the mSQL FAQ, The mSQL Perl Adapter description, and the mSQL users guide.
>
> Situation:
>
> I am able to create and drop tables using the Perl adapter. I can also add information to the table rows. Using the mSQL Terminal Monitor, I have been able to construct queries which return basic information from my simple tables.
>
> Question:
>
> What I have not been able to figure out is how to run a query against the table and return the information to the Perl program. I cannot determine the syntax for capturing the results of the query within Perl to display the query results.
>
> Example of One Thing That I Want to Do:
>
> I want to be able to submit a query via an HTML form to my table. The results of this query would be displayed in a dynamically generated (by a Perl Script) HTML page.
>
> Any general help would be appreciated on how to capture this information using the Perl Adapter. A code example would be ideal but an explanation of the process or a location to acquire this information would be sufficient.
>
> Thanks in advance.
>
> ______________________________________
> Shannon A. Wenzel, Webmaster
> SAW Computer Enterprises -- Internet Presence Provider
> Small Business and Multilingual Web Pages
> www.sawcomputer.com * info@sawcomputer.com * 609.924.1178
>
> --------------------------------------------------------------------------
> To remove yourself from the Mini SQL mailing list send a message containing
> "unsubscribe" to > "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
> "info msql-list" to majordomo@bunyip.com for info on monthly archives of
> the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!

This should get you started:

      $dbh = Msql->connect($host_name,"geobasedb"); #open Database
      $imagesdb = $dbh->query("select type,rx,ry,name from images where
(rx > $swx) and (rx < $nex) and (ry > $swy) and (ry < $ney)");
                                                     #make query
      $imagesnumrows = $imagesdb->numrows; #number of rows
returned
      %imageshash = $imagesdb->fetchhash; #fetch first row
(hint: use "FOR" loop to stp thru list
      $imagesx = $imageshash{'rx'}; #example of saving
a field from the row returned
      $imagesy = $imageshash{'ry'}; #example of saving
another field from the row returned

Hope it helps

-- 
Bob Basques
bob.basques@stpaul.gov - WORK
 blammo@win.bright.net - HOME
        www.stpaul.gov - 3rd of a bunch of (Volunteer) Webmasters 
    bridges.stpaul.gov - Webmaster
25 W. 4th St.            PHONE (612)266-6188
900 C.H.A. Bridge Div.     FAX (612)292-6315
St. Paul, Mn. 55102
--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com.  Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!