perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cameron B. Prince" <cpri...@rideware.com>
Subject RE: RH 9.0 RPMs - Query Results Question
Date Thu, 22 May 2003 18:32:57 GMT
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:

&lt;form method=&quot;POST&quot;&gt;&lt;input type=&quot;hidden&quot;
name=&quot;$start&quot; value=&quot;0&quot;&gt;
&lt;input type=&quot;hidden&quot; name=&quot;$max&quot;
value=&quot;10&quot;&gt;
&lt;input type=&quot;hidden&quot; name=&quot;!Table&quot;
value=&quot;song&quot;&gt;
&lt;input type=&quot;hidden&quot; name=&quot;!Filter&quot;
value=&quot;&quot;&gt;
&lt;input type=&quot;hidden&quot; name=&quot;!DataSource&quot;
value=&quot;dbi:Pg:dbname=rw&quot;&gt;
&lt;input type=&quot;submit&quot; name=&quot;$next&quot; value=&quot;Next
Records&quot;&gt; &lt;/form&gt;


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


Mime
View raw message