cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Sergeant <m...@sergeant.org>
Subject Re: draft final version of the esql namespace
Date Thu, 09 Nov 2000 08:34:47 GMT
On Wed, 8 Nov 2000, Donald Ball wrote:

> On Wed, 8 Nov 2000, Matt Sergeant wrote:
> 
> > > it's not two different ways of executing SQL, it's two different results
> > > templates being instantiated - one in the case of a _set_ of rows being
> > > returned, one in the case of a _number_ of rows being returned. bear in
> > > mind, the esql logicsheet has _no_ idea what sort of SQL it's executing,
> > > the only information it's got to go on is the type of results that are
> > > returned. isn't there something similar in the perl DBI world?
> > 
> > No, DBI is agnostic about that. Every kind of statement preparation
> > returns a statement handle, which you then execute, and finally fetch
> > results from. Any sort of update will simply not return any rows (but set
> > the rows property for the number of rows updated). Thats where I'm coming
> > from... Maybe esql is similar and I haven't looked close enough...
> 
> how do you distinguish between a query which returns an empty resultset
> v.s. an (update) query which returns no rows (updated)?

You don't, thats the point I'm making...

SELECT:
my $sth = $dbh->prepare("SELECT * FROM FOO");
$sth->execute;

while (my $row = $sth->fetchrow_hashref) {
	...
}

UPDATE:
my $sth = $dbh->prepare("UPDATE FOO SET bar="value" where bar="old");
$sth->execute;

print "Updated : ", $sth->rows;
__END__

Does that help?

PS: Can we take this to xsp-dev? I'm not about to subscribe to
cocoon-users, so all this traffic ends up in my inbox...

-- 
<Matt/>

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


Mime
View raw message