@@ -82,29 +82,25 @@ ClassMethod GetOtherDeveloperChanges() As %Boolean
8282{
8383 set numEntries = 0
8484 set fileToOtherDevelopers = {}
85- set query = " Select ItemFile, ChangedBy FROM SourceControl_Git.Change WHERE Committed = '0' AND ChangedBy <> ?"
86- set statement = ##class (%SQL.Statement ).%New ()
87- set status = statement .%Prepare (query , 0 )
88- $$$ThrowOnError(status )
89- set rset = statement .%Execute ($username )
90- if (rset .%SQLCODE < 0 ) {
91- throw ##class (%Exception.SQL ).CreateFromSQLCODE (rset .%SQLCODE ,rset .%Message )
92- }
93- set tempFolder = ##class (SourceControl.Git.Utils ).TempFolder ()
94- while rset .%Next (.sc ) {
95- $$$ThrowOnError(sc )
9685
97- if $FIND (rset .ItemFile , tempFolder ) {
98- set filePath = $PIECE (rset .ItemFile , tempFolder , 2 )
99- } else {
100- continue
86+ set username = $username
87+ &sql (DECLARE DeveloperCursor CURSOR FOR SELECT ItemFile, ChangedBy into :itemFile, :changedBy from SourceControl_Git .Change WHERE Committed = 0 and ChangedBy <> :username)
88+ &sql (OPEN DeveloperCursor)
89+ throw :SQLCODE <0 ##class (%Exception.SQL ).CreateFromSQLCODE (SQLCODE , %msg )
90+ &sql (FETCH DeveloperCursor)
91+ set tempFolder = ##class (SourceControl.Git.Utils ).TempFolder ()
92+ while (SQLCODE = 0 ) {
93+ if $FIND (itemFile , tempFolder ) {
94+ set filePath = $PIECE (itemFile , tempFolder , 2 )
95+ set otherDevelopers = fileToOtherDevelopers .%Get (filePath , [])
96+ do otherDevelopers .%Push (changedBy )
97+ do fileToOtherDevelopers .%Set (filePath , otherDevelopers )
10198 }
10299
103- set otherDevelopers = fileToOtherDevelopers .%Get (filePath , [])
104- do otherDevelopers .%Push (rset .ChangedBy )
105- do fileToOtherDevelopers .%Set (filePath , otherDevelopers )
100+ &sql (FETCH DeveloperCursor)
106101 }
107- $$$ThrowOnError(sc )
102+ &sql (CLOSE DeveloperCursor)
103+
108104 return fileToOtherDevelopers
109105}
110106
@@ -193,6 +189,7 @@ Query InstanceUncommitted() As %Query(ROWSPEC = "InternalName:%String,User:%Stri
193189ClassMethod InstanceUncommittedExecute (ByRef qHandle As %Binary ) As %Status
194190{
195191 set qHandle (" q" ) = " SELECT InternalName, ChangedBy FROM SourceControl_Git.Change"
192+ &sql (DECLARE InstanceCursor CURSOR FOR SELECT InternalName, ChangedBy into :internalName, :changedBy from SourceControl_Git .Change )
196193 set namespaces = ##class (SourceControl.Git.Utils ).GetGitEnabledNamespaces ()
197194 set tPtr = 0
198195 set qHandle (" i" ) = 1
@@ -201,16 +198,17 @@ ClassMethod InstanceUncommittedExecute(ByRef qHandle As %Binary) As %Status
201198 set namespace = $ZCONVERT (tValue , " U" )
202199 if '(namespace [ " ^" ) {
203200 set $NAMESPACE = namespace
204- set statement = ##class (%SQL.Statement ).%New ()
205- $$$ThrowOnError(statement .%Prepare (qHandle (" q" ), 0 ))
206- set resultSet = statement .%Execute ()
207- throw :resultSet .%SQLCODE <0 ##class (%Exception.SQL ).CreateFromSQLCODE (resultSet .%SQLCODE ,resultSet .%Message )
208- while resultSet .%Next (.sc ) {
209- $$$ThrowOnError(sc )
210- set qHandle (" changes" , $increment (qHandle (" changes" )), " InternalName" ) = resultSet .%GetData (1 )
211- set qHandle (" changes" , qHandle (" changes" ), " User" ) = resultSet .%GetData (2 )
212- set qHandle (" changes" , qHandle (" changes" ), " Namespace" ) = namespace
213- }
201+
202+ &sql (OPEN InstanceCursor)
203+ throw :SQLCODE <0 ##class (%Exception.SQL ).CreateFromSQLCODE (SQLCODE , %msg )
204+ &sql (FETCH InstanceCursor)
205+ while (SQLCODE = 0 ) {
206+ set qHandle (" changes" , $increment (qHandle (" changes" )), " InternalName" ) = internalName
207+ set qHandle (" changes" , qHandle (" changes" ), " User" ) = changedBy
208+ set qHandle (" changes" , qHandle (" changes" ), " Namespace" ) = namespace
209+ &sql (FETCH InstanceCursor)
210+ }
211+ &sql (CLOSE InstanceCursor)
214212 }
215213 }
216214
@@ -283,4 +281,3 @@ Storage Default
283281}
284282
285283}
286-
0 commit comments