A
ankur2080
Last resort, posted this message to perl.beginners and perl.dbi.users
and still didn't get a response. :-((.
~~~~
Hi All,
My first try with Class:
BI and DBI modules and I find that making a
query using Class:
BI takes much much more time than just DBI.
Is it me who is doing something wrong or Class:
BI is always slow(I
have kind of feeling that its me who is doing something wrong).
Also, I have another question.
Why do I need to specify the column names, primary keys in Class:
BI
while not in DBI? I mean, how is DBI module able to determine the
primary keys and other fields while Class:
BI not.
FYI, I have ~40k records and using mysql 5.0.
*** using DBI ***
use strict;
use warnings;
use DBI();
my $dbh =
DBI->connect("DBI:mysql:database=scratch;host=blah","user","passwd");
my $sth = $dbh->prepare("SELECT field from table where user =
'user1'");
$sth->execute();
while (my $ref = $sth->fetchrow_hashref()) {
print $ref->{field}, "\n";
}
$sth->finish();
$dbh->disconnect();
## Returns the result in a flash
*** using Class:
BI ***
use strict;
use warnings;
use Test:
ersonal;
my @users = Test:
ersonal->search(user => "user1");
foreach my $u ( @users ){
print $u->field, "\n";
}
## Returns the result very slowly.
____Test:
ersonal____
package Test:
ersonal;
use base 'Test:
BI';
Test:
ersonal->table('table');
Test:
ersonal->columns(Primary => qw/user start_time/);
Test:
ersonal->columns(Others => qw/field/);
1;
_____Test:
BI_______
package Test:
BI;
use base 'Class:
BI';
Test:
BI->connection('dbi:mysql:database=scratch;host=blah', 'user',
'password');
1;
--Ankur
and still didn't get a response. :-((.
~~~~
Hi All,
My first try with Class:
query using Class:
Is it me who is doing something wrong or Class:
have kind of feeling that its me who is doing something wrong).
Also, I have another question.
Why do I need to specify the column names, primary keys in Class:
while not in DBI? I mean, how is DBI module able to determine the
primary keys and other fields while Class:
FYI, I have ~40k records and using mysql 5.0.
*** using DBI ***
use strict;
use warnings;
use DBI();
my $dbh =
DBI->connect("DBI:mysql:database=scratch;host=blah","user","passwd");
my $sth = $dbh->prepare("SELECT field from table where user =
'user1'");
$sth->execute();
while (my $ref = $sth->fetchrow_hashref()) {
print $ref->{field}, "\n";
}
$sth->finish();
$dbh->disconnect();
## Returns the result in a flash
*** using Class:
use strict;
use warnings;
use Test:
my @users = Test:
foreach my $u ( @users ){
print $u->field, "\n";
}
## Returns the result very slowly.
____Test:
package Test:
use base 'Test:
Test:
Test:
Test:
1;
_____Test:
package Test:
use base 'Class:
Test:
'password');
1;
--Ankur