Re: can't flush buffers?

2000-12-24 Thread Carlos Ramirez

Browsers cannot display a table until it has enough information about
the table, this includes the end table tag. Even if you flush output,
the browser does not display until it encounters the end table tag. So
from the looks of your example, the end table tag
is not printed until all records are retreived, which is what I think
you are trying to avoid.

You might want to try printing smaller tables at a time. And use width
property of the TD tag to maintain the same format for all tables. This
will display the retreived data incrementally, which is what you want,
right?

-Carlos


quagly wrote:
> 
> I posted something like this a week ago, but typos in my message kept
> anyone from understanding the issue.
> 
> I am trying to return each row to the client as it comes from the
> database, instead of waiting for all the rows to be returned before
> displaying them.
> 
> I have set $|=1 and added $r->flush; after every print statement ( I
> realize this is redundant ) but to no avail.
> 
> This is the relevant code:
> 
> while ($sth->fetch) {
>$r->print ("",
>map("$_",@cols),
>"");
>   $r->rflush;
> }
> 
> Here is the complete package:
> 
> package Sql::Client;
> 
> use Apache::Request;
> use strict;
> use warnings;
> use Apache::Constants qw(:common);
> 
> my $r;  #request
> my $apr;   #Apache::Request
> my $host;  #hostname of remote user
> my $sql;#sql to execute
> 
> $|=1;
> 
> sub getarray ($) {
> 
> my $dbh;  # Database handle
> my $sth;# Statement handle
> my $p_sql; # sql statement passed as parameter
> my @cols;  #column array to bind results
> my $titles;   # array ref to column headers
> 
> $p_sql = shift;
> 
> # Connect
> $dbh = DBI->connect (
> "DBI:mysql:links_db::localhost",
> "nobody",
> "somebody",
> {
> PrintError => 1,# warn() on errors
> RaiseError => 0,   # don't die on error
> AutoCommit => 1,# commit executes
> immediately
> }
> );
> 
> # prepare statment
> $sth = $dbh->prepare($p_sql);
> 
> $sth->execute;
> 
> $titles = $sth->{NAME_uc};
> #--
> # for minimal memory use, do it this way
> @cols[0..$#$titles] = ();
> $sth->bind_columns(\(@cols));
> $r->print( "");
> $r->print ("",
> map("$_",@$titles),
> "");
> while ($sth->fetch) {
> $r->print ("",
> map("$_",@cols),
> "");
> $r->rflush;
> }
> $r->print ("");
> return;
> }
> 
> sub handler {
> $r = shift;
> $apr =  Apache::Request->new($r);
> $sql = $apr->param('sql') || 'SELECT';
> $sql='SELECT' if  $apr->param('reset');
> 
> $r->content_type( 'text/html' );
> $r->send_http_header;
> return OK if $r->header_only;
> $host = $r->get_remote_host;
> $r->print(< 
> 
>  HREF="/styles/lightstyle.css"
> >
> Hello $host
> 
> Sql Client
> 
> Enter your Select Statement:
> 
> $sql
> 
> 
> 
> 
> HTMLEND
> $r->rflush;
> getarray($sql) unless $sql =~ /^SELECT$/;
> 
> $r->print(< 
> 
> HTMLEND
> return OK;
> }
> 1;

-- 
RTFM: Not just an acronym, it's the LAW!



Re: [OT] Where to download Sablotron for AxKit

2000-12-24 Thread Matt Sergeant

On Sat, 23 Dec 2000, Philip Mak wrote:

> This is off-topic, but I am having problems downloading Sablotron from its
> website (Sablotron is a component that AxKit requires).
>
> On http://www.gingerall.com/charlie-bin/get/webGA/act/download.act the
> link for "Sablotron 0.50 - sources" and "Sablotron 0.50 - Linux
> binary" redirects to download.gingerall.cz, which is an unknown host.
>
> The Sablotron mailing list also appears to be busted, having an unknown
> host problem.
>
> Since several people mentioned AxKit on this list, I thought someone here
> might know about Sablotron. Do you know where I can download it from? I
> haven't been able to find any mirrors for it.

I'm having the exact same problem here. Mail me direct if you want me to
send you 0.44 which I have on my hard drive.

-- 


/||** Director and CTO **
   //||**  AxKit.com Ltd   **  ** XML Application Serving **
  // ||** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** Personal Web Site: http://sergeant.org/ **
 \\//
 //\\
//  \\