Exception when loading a function into Source Control

Early Access Program for SQL Source Control

Moderators: Chris Auckland, David Atkinson, sherr

Exception when loading a function into Source Control

Postby jimithing1980 » Mon Mar 08, 2010 11:31 pm

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

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: Select all
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
jimithing1980
 
Posts: 8
Joined: Mon Mar 08, 2010 11:26 pm

Exception when loading a function into Source Control

Postby sherr » Tue Mar 09, 2010 12:02 pm

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.
sherr
 
Posts: 126
Joined: Thu Mar 19, 2009 12:45 pm
Location: Cambridge

Exception when loading a function into Source Control

Postby jimithing1980 » Tue Mar 09, 2010 5:45 pm

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.
jimithing1980
 
Posts: 8
Joined: Mon Mar 08, 2010 11:26 pm

Exception when loading a function into Source Control

Postby sherr » Tue Mar 09, 2010 6:00 pm

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.
sherr
 
Posts: 126
Joined: Thu Mar 19, 2009 12:45 pm
Location: Cambridge


Return to SQL Source Control EAP

Who is online

Users browsing this forum: No registered users and 0 guests