##########################################################################
#
# routine: runsql.pl
#
# purpose: Runs a SQL database query.  Meant for inserts, updates, and
#          deletes, since only a count of affected records is returned
#          to the caller.
#
# Input:   db - database object
#          query - the text of the query
#
# Returns: count of the number of records affected by the query
#
# modification history:
#
#   date    opr     who     reason
# -------- -----  --------  --------------------------------------
# 06/03/00 43165  MSwam     first version
# 
##########################################################################
sub RunSql
{
    my ( $db, $query ) = @_;
    my $rec_count;
    my $count =0;

    #
    # initialize database
    use ST_DBlib;

    die if $db->dbcmd($query) == Sybase::DBlib::FAIL;
    die if $db->dbsqlexec     == Sybase::DBlib::FAIL;
    while ($db->dbresults    != Sybase::DBlib::NO_MORE_RESULTS ) {
        $rec_count = $db->DBCOUNT;
        if ($rec_count>0){$count += $rec_count};
    }
    $count;
}
1;
