#! /usr/bin/perl -w
#file name: exampleADB.pl
use strict ;
use ADB; #to use this module

my $adb = new ADB( airgenDBName=>"xji01_ms1409" ) ; #specify DB to use
my  $SQLStatement = "


SELECT * 
FROM mgr  ;


                   ";


my @allValueRecords = $adb->getSelectResults( $SQLStatement ) ; #get query results
                                              #one query statement at a time please
my $rowCount = $adb->getRowCount( ) ; #get row count
print "You may want to maximize your screen to see results clearly\n" ;
print "rowCount = $rowCount\n" ;
my @fieldNames = $adb->getFieldNames( ) ; #get column names
for ( my $i = 0 ; $i < @fieldNames ; $i++ )
{
    printf ("%-15s", $fieldNames[$i] ) ;
}

print "\n" ;
#we can randomly and easily access the results values from database, as shown below
for ( my $rowNum = 0 ; $rowNum < @allValueRecords ; $rowNum++ )
{ 
    #print "\#$rowNum:" ;
    for ( my $colNum = 0 ; $colNum < @{$allValueRecords[$rowNum]} ; $colNum++ )
    {
        printf ( "%-15s",  "${$allValueRecords[$rowNum]}[$colNum],") ;
    }
    print "\n" ;
}

my $changeResult = $adb->changeMyDB ( "
                    create table xji01Table ( a int , b int ) ;
                    insert into xji01Table ( a, b ) values ( 1, 2 ) ;
                    delete from xji01Table ;
                    drop table xji01Table ; " ) ;
if ( $changeResult == 1 ) { print "change DB success\n" ; }





Hosted by www.Geocities.ws

1