I'll take a proper look at your patch some time this week, but at first
look I think I'll be applying it.
On Thu, 2003-11-20 at 22:03, Rowe, Neville wrote:
> You are using a ';' delimiter between the two statements which I hadn't
> realised was necessary for Squirrel SQL - if you do it without the ';' so
> Squirrel SQL treats the two statements as a single statement for the
> database (which is valid for both Sybase and MS SQL Server, not sure about
> anything else) then you get the update count but not the results set.
> You also get the problem if you execute a stored procedure which returns an
> update count before a results set, so if there is an SP which runs those two
> sql statements and you run that sp, again you only get the update count
> An example SP might be (MS SQL Server)
> create procedure dbo.Get_Test as
> convert(int, 1) as val1,
> convert(int, 2) as val2
> into #tmp1
> select * from #tmp1
> drop table #tmp1
> if you then run in Squirrel (note the exec is optional)
> exec dbo.Get_Test
> Then you get
> 1 Rows Updated
> Query 1 elapsed time (seconds) - Total: 0.151, SQL query: 0.151,
> Building output: 0
> Which misses the results table. The issue being that the code in
> SQLExecutorTask assumes that one execute on the database will return one (or
> more) results sets or one update count (I think - I haven't got the source
> to hand). This isn't necessarily true - one jdbc execute call can return
> multiple update counts and results sets in any order. There is some
> discussion on how to process this in the javadoc for java.sql.Statement
> under the execute method and the getMoreResults method.
> -----Original Message-----
> From: Colin Bell [mailto:colbelloz@...]
> Sent: 20 November 2003 00:10
> To: squirrel-sql-users@...
> Subject: Re: [Squirrel-sql-users] multi-statement SQL statements
> > From: Neville Rowe <Neville.Rowe@...>
> > Date: Wednesday, November 19, 2003 11:15 pm
> > Subject: [Squirrel-sql-users] multi-statement SQL statements
> > I hope I'm not barking up the wrong tree here.
> > SquirrelSQL has always had problems for me with multiple
> > statements - e.g.
> > select * into #tmp1 from table1
> > select * from #tmp1
> > where there may be (multiple) results sets interspersed with
> > (multiple)
> > update counts.
> Can you give me some details about the problems you're having? The following
> select * into #tmp1 from authors;
> select * from #tmp1
> when executed gives me the following msgs:
> 23 Rows Updated
> Query 1 elapsed time (seconds) - Total: 0.031, SQL query: 0.031, Building
> output: 0
> Query 2 elapsed time (seconds) - Total: 0.594, SQL query: 0.031, Building
> output: 0.563
> which seems to be correct to me.
> This is using Microsoft SQL server 7.0
> Colin Bell