Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6887 dpurdie 1
########################################################################
2
# Copyright (c) VIX TECHNOLOGY (AUST) LTD
3
#
4
# Module name   : jats_rm_play24.pl
5
# Module type   : Makefile system
6
# Compiler(s)   : n/a
7
# Environment(s): jats
8
#
9
# Description   : Exeriment with invoking a store proceedure
10
#                       Convert Package Name into pkgid
11
#
12
#
13
#......................................................................#
14
 
15
require 5.006_001;
16
use strict;
17
use warnings;
18
use JatsError;
19
use JatsSystem;
20
use Getopt::Long;
21
use Pod::Usage;                             # required for help support
22
use JatsRmApi;
23
 
24
use DBI;
25
 
26
my $VERSION = "1.2.3";                      # Update this
27
my $opt_verbose = 1;
28
my $opt_help = 0;
29
my $opt_manual;
30
my $RM_DB;
31
 
32
#-------------------------------------------------------------------------------
33
# Function        : Main Entry
34
#
35
# Description     :
36
#
37
# Inputs          :
38
#
39
# Returns         :
40
#
41
my $result = GetOptions (
42
                "help+"         => \$opt_help,          # flag, multiple use allowed
43
                "manual"        => \$opt_manual,        # flag
44
                "verbose+"      => \$opt_verbose,       # flag
45
                );
46
 
47
#
48
#   Process help and manual options
49
#
50
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
51
pod2usage(-verbose => 1)  if ($opt_help == 2 );
52
pod2usage(-verbose => 2)  if ($opt_manual || ($opt_help > 2));
53
 
54
 
55
ErrorConfig( 'name'    =>'PLAY24' );
56
getInvokeStoredProcedure('core_devl');
57
exit;
58
 
59
sub getInvokeStoredProcedure
60
{
61
    my $foundDetails = 0;
62
    my (@row);
63
 
64
    # if we are not or cannot connect then return 0 as we have not found anything
65
    connectRM(\$RM_DB);
66
 
67
    # First get all packages that are referenced in a Release
68
    # This will only get the top level packages
69
    # From non-archived releases
70
 
71
    my $pvid = 129265;
72
    my $m_sqlstr0 = "SELECT release_manager.PK_RMAPI.return_vcs_tag($pvid)".
73
                   " FROM RELEASE_MANAGER.PACKAGE_VERSIONS pv" .
74
                   " WHERE pv.PV_ID = \'$pvid\'";
75
 
76
    my $m_sqlstrx =  "begin ? := release_manager.PK_RMAPI.return_vcs_tag($pvid); end;";
77
    my $m_sqlstr =  "begin release_manager.pk_buildapi.set_resume(); end;";
78
 
79
    my $sth = $RM_DB->prepare($m_sqlstr);
80
    if ( defined($sth) )
81
    {
82
        if ( $sth->execute( ) )
83
        {
84
            print "--- Execute\n";
85
            if ( $sth->rows )
86
            {
87
                print "--- Execute ROWS\n";
88
                while ( @row = $sth->fetchrow_array )
89
                {
90
                    print "Data: @row\n";
91
                }
92
            }
93
            print "--- Finish\n";
94
            $sth->finish();
95
        }
96
        else
97
        {
98
            Error("Execute failure: $m_sqlstr", $sth->errstr() );
99
        }
100
    }
101
    else
102
    {
103
        Error("Prepare failure" );
104
    }
105
}
106
 
107