You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by "Cameron B. Prince" <cp...@rideware.com> on 2003/05/22 04:27:16 UTC
RH 9.0 RPMs - Query Results Question
Hi,
I recently begain converting my project from Red Hat Interchange to mod_perl
w/ Embperl. I am a former Red Hat employee where I worked on the Interchange
team for about 2 years. I really like Interchange, but I've reached a point
in my project where it's in some ways, more than I need and in others,
lacking features I need.
I started by creating RPM's for Embperl. These are for a stock RH9
distribution:
ftp://ftp.rideware.com/perl_modules/threaded/perl-HTML-Embperl-2.0b9-8.i386.
rpm
ftp://ftp.rideware.com/perl_modules/srpm/perl-HTML-Embperl-2.0b9-8.src.rpm
After using Perl with Interchange for many years, using Embperl is pretty
intuitive. I'm making good progress but I've ran into a snag and I'm not
sure of the best way to proceed.
I have a page that has a single query... The problem is, the query produces
several hundred, and in some cases, thousand results. In Interchange, there
is a function called a more-list. It saves the results in the user's session
and then produces links to additional results similar to Google. I need to
duplicate this functionality with Embperl.
Could anyone supply ideas or example code of how to do this?
Thanks,
Cameron
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: RH 9.0 RPMs - Query Results Question
Posted by Angus Lees <an...@urnet.com.au>.
At Thu, 22 May 2003 13:32:57 -0500, Cameron B. Prince wrote:
> [+ $set -> PrevNextForm ('Previous Records',
> 'Next Records',
> \%fdat) +]
> The form is being added to the document after it's URL escaped. So the
> source looks like this:
[...]
you need to temporarily disable html escaping:
[+ local $escmode = 0;
$set->PrevNextForm(...); +]
> Also, is there any way to send a query directly to the module rather than
> just setting fdat options?
build your own hashref and pass that in, rather than using \%fdat.
if it helps, i have a working example of a DBIx::Recordset-using
website at http://www.slug.org.au/. there's a "view source" link a
the bottom of the page.
--
- Gus
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
RE: RH 9.0 RPMs - Query Results Question
Posted by "Cameron B. Prince" <cp...@rideware.com>.
Hey guys,
I've been playing with DBIx::Recordset, and it seems pretty nice... I think
it will do what I need, but I've ran into a snag with the form that's
created by either of these:
[+
$set -> PrevNextForm ({-first => 'First', -prev => '<<Back',
-next => 'Next>>', -last => 'Last',
-goto => 'Goto #'}, \%fdat)
+]
[+ $set -> PrevNextForm ('Previous Records',
'Next Records',
\%fdat) +]
The form is being added to the document after it's URL escaped. So the
source looks like this:
<form method="POST"><input type="hidden"
name="$start" value="0">
<input type="hidden" name="$max"
value="10">
<input type="hidden" name="!Table"
value="song">
<input type="hidden" name="!Filter"
value="">
<input type="hidden" name="!DataSource"
value="dbi:Pg:dbname=rw">
<input type="submit" name="$next" value="Next
Records"> </form>
Here's the full code of my test page:
[-
use DBIx::Recordset ;
$fdat{'!DataSource'} = 'dbi:Pg:dbname=rw' ;
$fdat{'!Table'} = 'song' ;
$fdat{'$max'} = 10 ;
*set = DBIx::Recordset -> Search(\%fdat) ;
$names = $set -> Names ;
-]
<table>
<tr>
<th>[+ $names -> [$col] +]</th>
</tr>
<tr>
[- $rec = $set[$row] -]
<td>[+ $rec -> {$names->[$col]} +]</td>
</tr>
</table>
[+
$set -> PrevNextForm ({-first => 'First', -prev => '<<Back',
-next => 'Next>>', -last => 'Last',
-goto => 'Goto #'}, \%fdat)
+]
How can I fix the form?
Also, is there any way to send a query directly to the module rather than
just setting fdat options?
Thanks,
Cameron
> -----Original Message-----
> From: Angus Lees [mailto:gus@inodes.org]
> Sent: Thursday, May 22, 2003 5:22 PM
> To: Robert
> Cc: cprince@rideware.com; embperl@perl.apache.org
> Subject: Re: RH 9.0 RPMs - Query Results Question
>
>
> At Thu, 22 May 2003 12:36:40 +0200, Robert wrote:
> > You'll have to do it manually. If the query is fast, use
> Limit/Offset or
> > equivalent otherwise Embperl::Session is your friend. And
> take a look at
> > DBIx::Recordset. BTW, it would be nice extension to
> Recordset - Gerald?
>
> see the DBIx::Recordset->PrevNextForm function for a wrapper into the
> Limit/Offset method.
>
> also read Intrors.pod from DBIx::Recordset for a worked embperl
> example.
>
>
> grabbing all the results in one go, storing it in %udat somewhere and
> then displaying only a certain range of the precached results should
> be quite straightforward to implement yourself.
>
> the cost of repeatedly retrieving such a large stored session might
> well be more than the cost of redoing your search query though.
>
> --
> - Gus
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: RH 9.0 RPMs - Query Results Question
Posted by Angus Lees <gu...@inodes.org>.
At Thu, 22 May 2003 12:36:40 +0200, Robert wrote:
> You'll have to do it manually. If the query is fast, use Limit/Offset or
> equivalent otherwise Embperl::Session is your friend. And take a look at
> DBIx::Recordset. BTW, it would be nice extension to Recordset - Gerald?
see the DBIx::Recordset->PrevNextForm function for a wrapper into the
Limit/Offset method.
also read Intrors.pod from DBIx::Recordset for a worked embperl
example.
grabbing all the results in one go, storing it in %udat somewhere and
then displaying only a certain range of the precached results should
be quite straightforward to implement yourself.
the cost of repeatedly retrieving such a large stored session might
well be more than the cost of redoing your search query though.
--
- Gus
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: RH 9.0 RPMs - Query Results Question
Posted by Robert <ro...@robert.cz>.
Cameron B. Prince wrote:
>I have a page that has a single query... The problem is, the query produces
>several hundred, and in some cases, thousand results. In Interchange, there
>is a function called a more-list. It saves the results in the user's session
>and then produces links to additional results similar to Google. I need to
>duplicate this functionality with Embperl.
>
>Could anyone supply ideas or example code of how to do this?
>
>
You'll have to do it manually. If the query is fast, use Limit/Offset or
equivalent otherwise Embperl::Session is your friend. And take a look at
DBIx::Recordset. BTW, it would be nice extension to Recordset - Gerald?
- Robert
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org