MySQL Forums
Forum List  »  Perl

Re: Perl MySQL Connection [urgent]
Posted by: Abdul Lateef Khan
Date: June 18, 2006 10:13PM

Hello Bill,

Here is my connection code, i am using speedy to keep connection as global.

#!/usr/bin/speedy
use DBI;
use POSIX qw(ceil floor);
use vars qw($dbh);
unless (defined($dbh)) {
$dbh = DBI->connect("dbi:mysql:dbname=voipradius;host=localhost",'root','123456',
{ RaiseError => 1,PrintError => 0, AutoCommit => 1});
}

Here is my script description how it is working.

Exec-Program-Wait = "/usr/local/etc/update.pl %{Acct-Session-Id} %{Called-Station-Id} %u %{Acct-Session-Time}"

Radius engine is waiting to finish the call till this file will be execute, and it sends some variable to the file.

Here is my update.pl file description.

1- Selecting Agent Id from the caller Id %u
2- Selecting Balance of Agent from AgentID
3- Selecting Balance for Caller Id
4- Selecting Buy rate for pariticular country from called-station-id (called number)
SQL: Select If(SRT.Rate Is Null,?*STC.Percentage,SRT.Rate) As Sell_Rate From Tariff_Classes AS STC Left Join Reseller_Tariff As SRT ON STC.ID = SRT.Groupn And SRT.Code = ? Where STC.ID = ?

5- Some mathmetic for calculation of GP and Billing Increament for the priticular
6- Updating Agent Balance
7- Updating Caller ID balance
8- Final Inserting records in call history table.


This is all process which we are executing in our script.

I hope this will more explain about our problem.

Abdul,

Options: ReplyQuote


Subject
Written By
Posted
Re: Perl MySQL Connection [urgent]
June 18, 2006 10:13PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.