Re: Design Pattern to keep a connection opened?

2011-11-06 Thread John R Pierce
On 11/05/11 11:59 PM, Brandon Phelps wrote: $local_db->do("SELECT insert_message(" . $local_db->quote($field1) . ", " . $local_db->quote($field2) . ", " . $local_db->quote($field3) . ", " . $local_db->quote($field4) . ")"); } btw, thats a rather poor way of passing arguments to SQL. yo

Re: Design Pattern to keep a connection opened?

2011-11-06 Thread John R Pierce
On 11/05/11 11:59 PM, Brandon Phelps wrote: sub get_database { if (defined($dbh) && $dbh->ping) { return $dbh; } else { $dbh = DBI->connect($DB_dsn, $DB_user, $DB_pass); return $dbh; } } if $dbh is defined but doesn't ping, I suspect you should free it befor

Re: Design Pattern to keep a connection opened?

2011-11-06 Thread Brandon Phelps
On 11/5/2011 11:46 PM, Bruce Johnson wrote: On Nov 5, 2011, at 3:57 PM, Brandon Phelps wrote: Can anyone point me in the right direction for keeping a connection to my database opened? The script I need to write will run 24/7 executing a postgresql stored procedure which inserts records into