execute w/triggers returning 0 rows
- From: Perl@xxxxxxxxxxxx (Marc M. Adkins)
- Date: Thu, 21 Apr 2005 16:01:26 -0400
I added some triggers to an existing SQL Server database. I noticed in testing the triggers using their ad hoc query tool that inserting a row (thus triggering other insertions) would print out:
(0 row(s) affected)
(1 row(s) affected)
(1 row(s) affected)
OK, that was interesting. Then I ran my Perl program and inserted a row. The program was working fine before the triggers. Suddenly it kept telling me that the insertion wasn't returning the right number of rows. This was my own error message:
unless ($stmt->execute == 1) {
Log->Warn('Insertion of item returned ', $rows, ' rows');
}I added some code in the unless statement body to double-check: was the row really inserted? This involved checking for the inserted row using a select statement. The row was actually there. Whaddyaknow.
So I'm wondering if SQL Server returns multiple row counts in this type of situation or just the first one. And if the former, whether ODBC understands that. And if so, whether the DBD::ODBC driver understands that. And if so, how would I get the program to understand?
But I'm probably barking up the wrong tree. Some silly misunderstanding on my part. Like the trigger should be returning a value and (d'oh!) it's not.
Which documentation didn't I read?
mma
===========================================================
The usual details:
Windows 2000 SP 4 (?) ------------------ SQL Server 7 ------------------ This is perl, v5.8.4 built for MSWin32-x86-multi-thread (with 3 registered patches, see perl -V for more detail)
Copyright 1987-2004, Larry Wall
Binary build 810 provided by ActiveState Corp. http://www.ActiveState.com ActiveState is a division of Sophos. Built Jun 1 2004 11:52:21 ------------------ Name: DBI Version: 1.45 Author: Tim Bunce (dbi-users@xxxxxxxx) Title: DBI Abstract: Database independent interface for Perl Available Platforms: 1. MSWin32-x86-multi-thread-5.8 ---------------------------------------------------------- Name: DBD-ODBC Version: 1.11 Author: Jeff Urlwin (jurlwin@xxxxxxx) Title: DBD-ODBC Abstract: ODBC Driver for DBI InstDate: 14:42:55 2004 Location: http://ppm.ActiveState.com/cgibin/PPM/ppmserver-5.8-windows.pl?urn:/PPMServe r Available Platforms: 1. MSWin32-x86-multi-thread-5.8
.
- References:
- RE: :Oracle install problem On Solaris 8
- From: Hemanth Kumar
- RE: :Oracle install problem On Solaris 8
- Prev by Date: Re: inserting data coming from a hash
- Next by Date: Re: Problem in connecting the DB
- Previous by thread: RE: :Oracle install problem On Solaris 8
- Next by thread: RE: :Oracle install problem On Solaris 8
- Index(es):
Relevant Pages
|