mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
Add flags column so that we can exclude some records from being published in the output file
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1326 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2,8 +2,9 @@
|
||||
# Retrieves the sip user/peer entries from the database
|
||||
# Use these commands to create the appropriate tables in MySQL
|
||||
#
|
||||
#CREATE TABLE sip (id INT(11) NOT NULL,keyword VARCHAR(20) NOT NULL,data VARCHAR(50),PRIMARY KEY (id,keyword));
|
||||
#CREATE TABLE sip (id INT(11) DEFAULT -1 NOT NULL,keyword VARCHAR(20) NOT NULL,data VARCHAR(50) NOT NULL, flags INT(1) DEFAULT 0 NOT NULL,PRIMARY KEY (id,keyword));
|
||||
#
|
||||
# if flags = 1 then the records are not included in the output file
|
||||
|
||||
use DBI;
|
||||
################### BEGIN OF CONFIGURATION ####################
|
||||
@@ -29,7 +30,7 @@ $additional = "";
|
||||
open EXTEN, ">$sip_conf" || die "Cannot create/overwrite extensions file: $sip_conf\n";
|
||||
|
||||
$dbh = DBI->connect("dbi:mysql:dbname=$database;host=$hostname", "$username", "$password");
|
||||
$statement = "SELECT keyword,data from $table_name where id=0 and keyword <> 'account'";
|
||||
$statement = "SELECT keyword,data from $table_name where id=0 and keyword <> 'account' and flags <> 1";
|
||||
my $result = $dbh->selectall_arrayref($statement);
|
||||
unless ($result) {
|
||||
# check for errors after every single database call
|
||||
@@ -46,7 +47,7 @@ if ( $#resultSet > -1 ) {
|
||||
}
|
||||
}
|
||||
|
||||
$statement = "SELECT data,id from $table_name where keyword='account' group by data";
|
||||
$statement = "SELECT data,id from $table_name where keyword='account' and flags <> 1 group by data";
|
||||
|
||||
$result = $dbh->selectall_arrayref($statement);
|
||||
unless ($result) {
|
||||
@@ -66,7 +67,7 @@ foreach my $row ( @{ $result } ) {
|
||||
my $account = @{ $row }[0];
|
||||
my $id = @{ $row }[1];
|
||||
print EXTEN "[$account]\n";
|
||||
$statement = "SELECT keyword,data from $table_name where id=$id and keyword <> 'account' order by keyword";
|
||||
$statement = "SELECT keyword,data from $table_name where id=$id and keyword <> 'account' and flags <> 1 order by keyword";
|
||||
my $result = $dbh->selectall_arrayref($statement);
|
||||
unless ($result) {
|
||||
# check for errors after every single database call
|
||||
|
Reference in New Issue
Block a user