top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

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

0 votes
373 views
$dbh = DBI->connect("dbi:mysqlPP:$dsn;host=$host", $user, $pw,
{PrintError => 1, RaiseError => 1});
if (!$dbh) {
    print "error: connection: $DBI::errn$DBI::errstrn$DBI::staten";
 }
$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::errn$DBI::errstrn$DBI::staten";
}

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

posted May 18, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

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.

Why are you using mysqlPP instead of https://metacpan.org/release/DBD-mysql ?
There may be a bug in mysqlPP also.

answer May 19, 2013 by anonymous
Similar Questions
+2 votes

I have moderate level PHP programming skills. I am also interested in merging those skills inside of the WordPress app. With their advanced responsive design themes and many other functions it seems like a good idea. I have tried loading some PHP plug-ins in WP – but I don't seem to get them to do more than basics.

Can anybody help me on how I can get started working with PHP/MySQL inside of the WordPress app?

0 votes

I'm looking for a very good, pre made, working PDO and/or mysqli database class (in a wrapper) - to get started with, that has all the basic needs like UPDATE - INSERT - DELETE - QUERY etc. That would be very helpful. I'm also trying to learn OOP, and creating my own class to start out is over my head, so one that is recommended here would be a good start.

There are many examples on the net - The problem is that commenters often have issues with the code, and as a beginner in this area - these issues are sometimes over my head and it would be best for me if someone could recommend a good working standard model to start.

Q: DOES ANYONE HAVE ANY OPINIONS ON THE ONES BELOW?
https://github.com/ajillion/PHP-MySQLi-Database-Class
http://www.phpclasses.org/package/2359-PHP-MySQL-database-wrapper-using-MySQLi-extension.html
http://snipplr.com/view/22992/

Jeffrey Way...
http://forrst.com/posts/Mysqli_Database_Class-hxb
http://www.dotred.be/blog/database-classes-for-mysql-mysqli-and-mssql/

PDO...
Jeffrey Way - some issues here in comments
http://net.tutsplus.com/tutorials/php/php-database-access-are-you-doing-it-correctly/
http://www.phpclasses.org/package/7533-PHP-Access-SQL-databases-using-PDO.html
http://www.doctrine-project.org/projects/dbal.html
http://pear.php.net/package/MDB2

+1 vote

In my web application I have a requirement database password should be stored in properties fie and that should be encrypted and during login that it needs to check the username password and database password database password should be decrypt during login and and encrypt during log out.

...