ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chris oberle <chris.obe...@gmail.com>
Subject MSSQL, schema migrations format issue
Date Thu, 25 Mar 2010 16:03:45 GMT
Hello,

I have a keen interest in using Ibatis Schema MIgrations but am having an
issue and am hoping someone can tell me if there is anything I can do about
it.

For some reason, when I use the system to define my stored procedures and
views, the text formatting is not preserved.  In other words, after the SQL
sucessfully runs and I go to view the procedure or view in my console, most
everything is all on one line regardless of how I have it formatted in my
source for readability.

I'm using these settings in my environment properties:

# If set to true, each statement is isolated
# in its own transaction.  Otherwise the entire
# script is executed in one transaction.
auto_commit=false

# This controls how statements are delimited.
# By default statements are delimited by an
# end of line semicolon.  Some databases may
# (e.g. MS SQL Server) may require a full line
# delimiter such as GO.
delimiter=GO
full_line_delimiter=true

# This ignores the line delimiters and
# simply sends the entire script at once.
# Use with JDBC drivers that can accept large
# blocks of delimited text at once.
send_full_script=true


Here's an example block of the source:

--// create MyProcedure procedure
-- Migration SQL that makes the change goes here.

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

 CREATE PROCEDURE [dbo].[usp_MyProcedure]

 @NPA CHAR(3),
 @NXX CHAR(3)

 AS

 IF @NPA IS NULL
     BEGIN
        RAISERROR('Warning!! @NPA parameter cannot have NULL value passed
in! Procedure has ended!',16,1)
        RETURN
     END

 IF @NXX IS NULL
    BEGIN
        RAISERROR('Warning!! @NXX parameter cannot have NULL value passed
in! Procedure has ended!',16,1)
        RETURN
    END

     SET NOCOUNT ON;

 BEGIN

     SELECT DISTINCT P.OCN_CODE
     FROM MyDb.dbo.MyTable P
                INNER JOIN OtherDB.dbo.[OTHER TABLE] l6
                    ON P.field1 = l6.[field1] AND [BLOCK ID] = 'A'
     WHERE L6.NPA = @NPA AND l6.NXX = @NXX

 END

     SET NOCOUNT OFF;
GO


--//@UNDO
-- SQL to undo the change goes here.

DROP PROCEDURE [dbo].[usp_MyProcedure]
GO


Any ideas or help is greatly appreciated!


Thanks!

Mime
View raw message