perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Hajducko <>
Subject RE: DBIx::Recordset 'do' syntax?
Date Fri, 08 Oct 2004 20:49:43 GMT
>From perldoc DBIx::Recordset...

       $set -> do ($statement, $attribs, \%params)
           Same as DBI. Executes a single SQL statement on the open

I implemented the process via regular DBI, since I couldn't figure it out w/
DBIx.  I don't even think DBI->do would have done it for me, as I realized
that I needed data back.  Here's the script -


use DBI;

my $LOGS = 2;
my $dbh = DBI->connect("DBI:mysql:database;host;port=3306", '', '');

my $sth = $dbh->prepare('show master logs');

my $row;
while ($row = $sth->fetchrow_arrayref)
        push @logs, $row->[0];

my $log_amt = scalar(@logs);
print "$log_amt logs.\n";
if ($log_amt < $LOGS)
        print "Not enough logs to purge. Must keep $LOGS logs.\n";
        my $purge_to = $log_amt - $LOGS;
        if (($log_amt - $purge_to) < $LOGS)
                print "Not enough logs left after purge. Must keep $LOGS
        print "purging to $logs[$purge_to]\n";
        $dbh->do("purge master logs to '$logs[$purge_to]'");


Someone implement that in DBIx::Recordset?


-----Original Message-----
From: Terrence Brannon [] 
Sent: Friday, October 08, 2004 12:23 PM
To: Steven Hajducko
Cc: ''
Subject: Re: DBIx::Recordset 'do' syntax?

Steven Hajducko wrote:

> Having trouble using DBIx::Recordset->do. 

I don't see a DBIx::Recordset->do() call in the docs... where did you see

> I'd like to use the do command to
> issue 'show master logs' on a MySQL database.  

perhaps you mean $dbh->do()

that is a pure DBI call. Recordset can return a DBI database handle to you

>  I'm confused on how to use $set
> w/out actually specifiying a table to use.

shows how to do this for Recordset API calls.

> Could anyone write a simple example of how to use $set->do in such a way
> that you actually get rows of data back?

Terrence Brannon,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message