Red Gate forums :: View topic - Exception when loading a function into Source Control
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Source Control EAP
SQL Source Control EAP forum

Exception when loading a function into Source Control

Search in SQL Source Control EAP forum
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
Jump to:  
Author Message
jimithing1980



Joined: 08 Mar 2010
Posts: 8

PostPosted: Mon Mar 08, 2010 11:31 pm    Post subject: Exception when loading a function into Source Control Reply with quote

I'm receiving the following Stack Trace when loading a function into Source Control using version 0.3:

Quote:
Failed to update:
#oEc.#8Jf: Failed to parse file C:\Documents and Settings\Jason.M\Local Settings\Application Data\Red Gate\SQL Source Control 0\WorkingBases\64c806c3-9830-434b-9d93-b60c32841002\Functions\dbo.GetGreatCirckeDistanceKilometers.sql ---> #Eyg.#Ryg: Failed to parse file C:\Documents and Settings\Jason.M\Local Settings\Application Data\Red Gate\SQL Source Control 0\WorkingBases\64c806c3-9830-434b-9d93-b60c32841002\Functions\dbo.GetGreatCirckeDistanceKilometers.sql ---> line 42:22: unexpected char: 0xD
--- End of inner exception stack trace ---
at #oEc.#7Jf.#t.#B3.#sKf()
at #oEc.#7Jf.#gKf(Action action)
--- End of inner exception stack trace ---

Server stack trace:
at RedGate.SQLSourceControl.Engine.Cancellables.CancellableOperation.#t.#izb.#j5f()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]:
at RedGate.SQLSourceControl.CommonUI.Forms.ErrorDialog.DoWithObviousExceptionsThrowAll(Action action)
at #JLc.#PLc.#CTc(ICancellableOperation`1 operation, Object token)



The Function I'm loading is below:


Code:
ALTER function [dbo].[GetGreatCirckeDistanceKilometers]
   (
   @Latitude1  float,
   @Longitude1 float,
   @Latitude2  float,
   @Longitude2 float
   )
returns float
as

/*
FUNCTION: GetGreatCirckeDistanceKilometers

   Computes the Great Circle distance in kilometers
   between two points on the Earth using the
   Haversine formula distance calculation.

Input Parameters:
   @Longitude1 - Longitude in degrees of point 1
   @Latitude1  - Latitude  in degrees of point 1
   @Longitude2 - Longitude in degrees of point 2
   @Latitude2  - Latitude  in degrees of point 2
*/

begin
declare @radius float

declare @lon1  float
declare @lon2  float
declare @lat1  float
declare @lat2  float

declare @a float
declare @distance float

-- Sets average radius of Earth in Kilometers
set @radius = 6376.5E

-- Sets average radius of Earth in Miles
--set @radius = 3956.0E

-- Convert degrees to radians
set @lon1 = radians( @Longitude1 )
set @lon2 = radians( @Longitude2 )
set @lat1 = radians( @Latitude1 )
set @lat2 = radians( @Latitude2 )

set @a = sqrt(square(sin((@lat2-@lat1)/2.0E)) +
   (cos(@lat1) * cos(@lat2) * square(sin((@lon2-@lon1)/2.0E))) )

set @distance =
   @radius * ( 2.0E *asin(case when 1.0E < @a then 1.0E else @a end ))

return @distance

end
Back to top
View user's profile Send private message
sherr



Joined: 19 Mar 2009
Posts: 125
Location: Cambridge

PostPosted: Tue Mar 09, 2010 12:02 pm    Post subject: Exception when loading a function into Source Control Reply with quote

Thank you so much for including the stack track and the code for the function. We were able to replicate your issue. We are looking into a fix for this now. Our internal reference number is SOC-800.
Back to top
View user's profile Send private message
jimithing1980



Joined: 08 Mar 2010
Posts: 8

PostPosted: Tue Mar 09, 2010 5:45 pm    Post subject: Exception when loading a function into Source Control Reply with quote

I have already fixed it for now by removing the E in the float variables. I had to do it in a couple places (on the server, in source control, and in a temp directory) but that seems to be the bug.
Back to top
View user's profile Send private message
sherr



Joined: 19 Mar 2009
Posts: 125
Location: Cambridge

PostPosted: Tue Mar 09, 2010 6:00 pm    Post subject: Exception when loading a function into Source Control Reply with quote

Thanks for letting us know how you fixed it. The 3 places you mentioned make sense. I'll add this workaround to your issue and we'll see if there's a way we could prevent it from having this problem in the first place.
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies. All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group