Persistent MySQL connections to arbitrary databases

Alexander Clouter alex at digriz.org.uk
Wed Feb 9 14:17:15 CET 2011


Jonathan Gazeley <jonathan.gazeley at bristol.ac.uk> wrote:
>
>> However, why do you need to close the handle?  Just when you open it, do
>> your work, store it to the side in a hash and mark it available for use
>> (remember to add locking as it sounds like your script is threaded).
> 
> Please excuse the ignorance - can you elaborate a bit on the process of 
> storing it in a hash, and marking it as available?
> 
Meant to say an array of hashes:
----
my @foobar;
[snipped]
push @foobar, {
	dbh	=> $dbh,
	busy	=> 0,
};
----

An example of dumping objects into an array of hashes can be seen with:
----
alex at berk:~$ perl -e 'use Digest::MD5; use Data::Dumper; my @foobar; my $md5 = Digest::MD5->new; push @foobar, { md5 => $md5, busy => 0 }; print Dumper \@foobar'
$VAR1 = [
          {
            'busy' => 0,
            'md5' => bless( do{\(my $o = 23868256)}, 'Digest::MD5' )
          }
        ];
----

Without knowing what queries and logic you are throwing at your database 
and passing back to FreeRADIUS, I have a hard time understanding why you 
could not just use unlang with sql-xlat?

Cheers

-- 
Alexander Clouter
.sigmonster says: Showing up is 80% of life.
                  		-- Woody Allen




More information about the Freeradius-Users mailing list