Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

ADS Rdd EoF function 10 Jun 2022 11:33 #22733

  • lorenzi@moduline.ch's Avatar
  • Topic Author


  • Posts: 93
  • Hi Robert

    I use the function:
    XSharp.RDD.Functions.AdsAtEOF(SELF:nCursor, OUT nRet)
    to check the EoF state in my own server class.
    This function now always returns false if the cursor has no records.
    It happens with the last build: 2.12.2.1
    If I go back to 2.11.0.1 it works as expected.

    Markus

    Please Log in or Create an account to join the conversation.

    ADS Rdd EoF function 10 Jun 2022 11:48 #22734

    • robert
    • robert's Avatar


  • Posts: 3276
  • Markus,
    That function is directly mapped to the underlying ADS API.
    So if there is a problem it is most likely coming from another location.
    And I cannot remember changing anything in this area (the ADS code) that could explain this.
    Can you create a small example demonstrating the problem ?

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    ADS Rdd EoF function 11 Jun 2022 11:03 #22738

    • lorenzi@moduline.ch's Avatar
    • Topic Author


  • Posts: 93
  • Hi Robert
    I just sent you a link to the sample project file on onedrive.
    The problem must be in the Execute() method of the class dbAdsServer.
    No statement and therefore no cursor is created.
    This code worked until version 2.11.0.1.

    HTH Markus

    Please Log in or Create an account to join the conversation.

    ADS Rdd EoF function 13 Jun 2022 11:27 #22739

    • robert
    • robert's Avatar


  • Posts: 3276
  • Markus,
    Check your mail.
    I have created a ticket for this:
    github.com/X-Sharp/XSharpPublic/issues/1054

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    ADS Rdd EoF function 13 Jun 2022 16:40 #22740

    • lorenzi@moduline.ch's Avatar
    • Topic Author


  • Posts: 93
  • Thank you very much for your great support!

    Please Log in or Create an account to join the conversation.

    ADS Rdd EoF function 13 Jun 2022 17:06 #22741

    • lorenzi@moduline.ch's Avatar
    • Topic Author


  • Posts: 93
  • Robert,
    I just did your recommended workaround. It still does not work. I broke it down to this line of code (in the execute() method:


    self:nAdsRet := XSharp.RDD.Functions.AdsCreateSQLStatement(self:nConnection, @nStat)

    The self:nConnection holds a valid connection handle. After this call the nStat (statement handel) remains a null object.
    The return value of this function is 0 (=no error).

    Markus

    Please Log in or Create an account to join the conversation.

    ADS Rdd EoF function 13 Jun 2022 23:23 #22742

    • robert
    • robert's Avatar


  • Posts: 3276
  • Markus,

    In the example that you have given me is nStat an IntPtr and it gets set to a valid statement handle.


    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    ADS Rdd EoF function 14 Jun 2022 09:24 #22743

    • lorenzi@moduline.ch's Avatar
    • Topic Author


  • Posts: 93
  • Robert,

    thats really strange. If I call in my fixed sample the AdsCreateSQLStaement() function ADS returns a 5024 (The application deleted an Advantage handle at the same time it attempted to use the handle.) error which makes no sense here. I just put this version of the sample to the same location on OneDrive which you can access with the link I sent before. Perhaps (for sure) I oversee something.

    Markus

    Please Log in or Create an account to join the conversation.

    ADS Rdd EoF function 01 Jul 2022 11:00 #22934

    • lorenzi@moduline.ch's Avatar
    • Topic Author


  • Posts: 93
  • Robert,
    I just found the real reason why the code was failing. There must something have changed with the codeblock handling.
    In the failing version the variables needed in the codeblock were declared outside the codeblock:
    method Execute()	
    [b]	local nStat		as	IntPtr
    	local nCurs		as	IntPtr
    	local nRet as dword[/b]	
    	
    	
    	local adsBlock as codeblock
    	local successBlock as codeblock
    	local errorBlock as codeblock
    	
    	adsBlock := { | |
    
    
    
    		if self:lCursorAktiv
    			XSharp.RDD.Functions.AdsCloseSQLStatement(self:nStatement) 
    		
    		endif
    
    		self:lCursorAktiv := true
    
    		self:nAdsRet := XSharp.RDD.Functions.AdsCreateSQLStatement(self:nConnection, @nStat)
    	
    	
    		//Statement ausführen
    		self:nAdsRet := XSharp.RDD.Functions.AdsExecuteSQLDirect(nStat, self:cStatement, @nCurs)
    	
    	
    		self:nStatement := nStat
    		self:nCursor    := nCurs
    	
    		return self:nAdsRet
    		}
    		
    	errorBlock := { | adsErrorMessage |
    	
    		TrissWarning:LogWarning(adsErrorMessage) // TODO vielleicht sollte man stattdessen eine Exception werfen? Siehe nächste Zeile
    		// throw TrissFatalException{adsErrorMessage}
    		return false
    		}
    		
    	successBlock := { | |
    
    		
    		self:nAdsRet  := XSharp.RDD.Functions.AdsGetRecordCount(self:nCursor, ADS_IGNOREFILTERS, @nRet)
    		self:nLastRec := nRet
    
    		self:CreateStruct()
    		return true
    	}
    	
    	dbAdsServer:WrapAds(adsBlock, successBlock, errorBlock)
    	return true

    This code crashes in 2.12.2 and worked up to 2.11.0.1.

    Moving the declaration inside the block it works now also with 2.12.2.
    method Execute()	
    
    	local adsBlock as codeblock
    	local successBlock as codeblock
    	local errorBlock as codeblock
    	
    	adsBlock := { | |
    
    [b]		local nStat		as	IntPtr
    		local nCurs		as	IntPtr[/b]
    
    		if self:lCursorAktiv
    			XSharp.RDD.Functions.AdsCloseSQLStatement(self:nStatement) 
    		
    		endif
    
    		self:lCursorAktiv := true
    
    		self:nAdsRet := XSharp.RDD.Functions.AdsCreateSQLStatement(self:nConnection, @nStat)
    	
    	
    		//Statement ausführen
    		self:nAdsRet := XSharp.RDD.Functions.AdsExecuteSQLDirect(nStat, self:cStatement, @nCurs)
    	
    	
    		self:nStatement := nStat
    		self:nCursor    := nCurs
    	
    		return self:nAdsRet
    		}
    		
    	errorBlock := { | adsErrorMessage |
    	
    		TrissWarning:LogWarning(adsErrorMessage) // TODO vielleicht sollte man stattdessen eine Exception werfen? Siehe nächste Zeile
    		// throw TrissFatalException{adsErrorMessage}
    		return false
    		}
    		
    	successBlock := { | |
    [b]		local nRet as dword[/b]
    		
    		self:nAdsRet  := XSharp.RDD.Functions.AdsGetRecordCount(self:nCursor, ADS_IGNOREFILTERS, @nRet)
    		self:nLastRec := nRet
    
    		self:CreateStruct()
    		return true
    	}
    	
    	dbAdsServer:WrapAds(adsBlock, successBlock, errorBlock)
    	return true


    Markus

    Please Log in or Create an account to join the conversation.

    ADS Rdd EoF function 01 Jul 2022 11:34 #22935

    • robert
    • robert's Avatar


  • Posts: 3276
  • Markus,
    We had indeed a problem in the codeblock handling in 2.12.2

    This is fixed in the upcoming 2.13 release for which we have a compiler fix for our beta testers already.
    I have added you to the betatesters list. You should be able to see the download in the Downloads area of this website.

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    ADS Rdd EoF function 01 Jul 2022 14:09 #22937

    • lorenzi@moduline.ch's Avatar
    • Topic Author


  • Posts: 93
  • Robert,
    perfect, thanks.
    Markus

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1