Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DBD::mysqlPP is giving out of memory exception and ODBC is working fine.

2 views
Skip to first unread message

Ganesh Babu N

unread,
May 18, 2013, 10:41:09 AM5/18/13
to Perl
$dbh = DBI->connect("dbi:mysqlPP:$dsn;host=$host", $user, $pw,
{PrintError => 1, RaiseError => 1});
if (!$dbh) {
    print "error: connection: $DBI::err\n$DBI::errstr\n$DBI::state\n";
}
$drh = DBI->install_driver("mysqlPP");
$ary_ref = $dbh->selectcol_arrayref("SELECT pui,spuid FROM inven WHERE dispatchdate=\"0000-00-00\" and dupli is NULL LIMIT 0, 5000", { Columns=>[1,2] });
%masterdb = @$ary_ref; # build hash from key-value pairs so $hash{$id} => name
$sth = $dbh->prepare("SELECT DISTINCT spuid FROM inven WHERE dispatchdate<>\"0000-00-00\" and dupli is NULL LIMIT 0, 1000");
$sth->execute();
while ( @row = $sth->fetchrow_array ) {
    push(@dspu, "@row\.dat");
}

The above code which uses mysqlPP module is giving our of memory exception and not getting executed.

Where as if it uses ODBC connection it is working without any exception.

first query will fetch 3000 records and 2nd query fetches 500 records. it may increase in later stages.

$dbh = DBI->connect("dbi:ODBC:$dsn", $user, $pw,
{PrintError => 1, RaiseError => 1});
if (!$dbh) {
    print "error: connection: $DBI::err\n$DBI::errstr\n$DBI::state\n";
}

is there any bug in mysqlPP? or am i missing something obvious.

Please help in resolving this error.

Regards,
Ganesh

Shlomi Fish

unread,
May 19, 2013, 4:08:31 AM5/19/13
to Perl
Hi Ganesh,

On Sat, 18 May 2013 20:11:09 +0530
Ganesh Babu N <nbabu...@gmail.com> wrote:

> $dbh = DBI->connect("dbi:mysqlPP:$dsn;host=$host", $user, $pw,
> {PrintError => 1, RaiseError => 1});
> if (!$dbh) {
> print "error: connection: $DBI::err\n$DBI::errstr\n$DBI::state\n";
> }
> $drh = DBI->install_driver("mysqlPP");
> $ary_ref = $dbh->selectcol_arrayref("SELECT pui,spuid FROM inven WHERE
> dispatchdate=\"0000-00-00\" and dupli is NULL LIMIT 0, 5000", {
> Columns=>[1,2] });
> %masterdb = @$ary_ref; # build hash from key-value pairs so $hash{$id} =>
> name
> $sth = $dbh->prepare("SELECT DISTINCT spuid FROM inven WHERE
> dispatchdate<>\"0000-00-00\" and dupli is NULL LIMIT 0, 1000");
> $sth->execute();
> while ( @row = $sth->fetchrow_array ) {
> push(@dspu, "@row\.dat");
> }

This code is really bad:

1. It lacks "use strict;" and "use warnings;".

2. It doesn't throw an exception when "$dbh" is undef.

3. It is not properly indented.

4. It lacks empty lines between code paragraphs.

Please fix all those. See the link
http://perl-begin.org/tutorials/bad-elements/ on The Perl Beginners Site, which
is a site I maintain.

>
> The above code which uses mysqlPP module is giving our of memory exception
> and not getting executed.

Why are you using mysqlPP instead of https://metacpan.org/release/DBD-mysql ?

>
> Where as if it uses ODBC connection it is working without any exception.
>
> first query will fetch 3000 records and 2nd query fetches 500 records. it
> may increase in later stages.
>
> $dbh = DBI->connect("dbi:ODBC:$dsn", $user, $pw,
> {PrintError => 1, RaiseError => 1});
> if (!$dbh) {
> print "error: connection: $DBI::err\n$DBI::errstr\n$DBI::state\n";
> }
>
> is there any bug in mysqlPP? or am i missing something obvious.
>

There may be.

> Please help in resolving this error.
>
> Regards,
> Ganesh


Regards,

Shlomi Fish


--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
List of Portability Libraries - http://shlom.in/port-libs

For every A, Chuck Norris is both A and not-A.
Chuck Norris is freaking everything.
http://www.shlomifish.org/humour/bits/facts/Chuck-Norris/

Please reply to list if it's a mailing list post - http://shlom.in/reply .

Ganesh Babu N

unread,
May 19, 2013, 1:41:52 PM5/19/13
to Shlomi Fish, Perl
Dear Shlomi Fish,
.
Thank you for pointing to the right website I will follow the rules.

The above code is only part of the large program. I have posted only the Database related portion only.

Regards,
Ganesh

DBD::mysql is asking for mysql.dll in the module folder when we create EXE using PDK which is not present. I am using Activestate Perl
 
>
> Where as if it uses ODBC connection it is working without any exception.
>
> first query will fetch 3000 records and 2nd query fetches 500 records. it
> may increase in later stages.
>
> $dbh = DBI->connect("dbi:ODBC:$dsn", $user, $pw,
> {PrintError => 1, RaiseError => 1});
> if (!$dbh) {
>     print "error: connection: $DBI::err\n$DBI::errstr\n$DBI::state\n";
> }
>
> is there any bug in mysqlPP? or am i missing something obvious.
>

There may be.

> Please help in resolving this error.
>
> Regards,
> Ganesh


Regards,

        Shlomi Fish


--
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
List of Portability Libraries - http://shlom.in/port-libs

For every A, Chuck Norris is both A and not-A.
Chuck Norris is freaking everything.
    — http://www.shlomifish.org/humour/bits/facts/Chuck-Norris/

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-...@perl.org
For additional commands, e-mail: beginne...@perl.org
http://learn.perl.org/



0 new messages