Separate multiple items encoded into a single field with ';'
authorTilghman Lesher <tilghman@meg.abyt.es>
Fri, 27 Jun 2008 20:38:59 +0000 (20:38 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Fri, 27 Jun 2008 20:38:59 +0000 (20:38 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@126021 65c4cc65-6c06-0410-ace0-fbb531ad65f3

contrib/scripts/dbsep.cgi

index dd060f7..8010b21 100755 (executable)
@@ -57,7 +57,9 @@ if ($mode eq 'single') {
        $sth->execute() || throw_error("Invalid query: $sql");
        $row = $sth->fetchrow_hashref();
        foreach (keys %$row) {
-               push @answer, encode($_) . "=" . encode($row->{$_});
+               foreach my $item (split /\;/, $row->{$_}) {
+                       push @answer, encode($_) . "=" . encode($item);
+               }
        }
        $sth->finish();
        $dbh->disconnect();
@@ -74,7 +76,9 @@ if ($mode eq 'single') {
        while (my $row = $sth->fetchrow_hashref()) {
                @answer = ();
                foreach (keys %$row) {
-                       push @answer, encode($_) . "=" . encode($row->{$_});
+                       foreach my $item (split /\;/, $row->{$_}) {
+                               push @answer, encode($_) . "=" . encode($item);
+                       }
                }
                print join("&", @answer) . "\n";
        }