ADS Rdd EoF function
-
- Posts: 114
- Joined: Mon May 02, 2016 9:10 am
- Location: Schweiz
ADS Rdd EoF function
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
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
ADS Rdd EoF function
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
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
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
-
- Posts: 114
- Joined: Mon May 02, 2016 9:10 am
- Location: Schweiz
ADS Rdd EoF function
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
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
ADS Rdd EoF function
Markus,
Check your mail.
I have created a ticket for this:
https://github.com/X-Sharp/XSharpPublic/issues/1054
Robert
Check your mail.
I have created a ticket for this:
https://github.com/X-Sharp/XSharpPublic/issues/1054
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
-
- Posts: 114
- Joined: Mon May 02, 2016 9:10 am
- Location: Schweiz
ADS Rdd EoF function
Thank you very much for your great support!
-
- Posts: 114
- Joined: Mon May 02, 2016 9:10 am
- Location: Schweiz
ADS Rdd EoF function
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
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
ADS Rdd EoF function
Markus,
In the example that you have given me is nStat an IntPtr and it gets set to a valid statement handle.
Robert
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
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
-
- Posts: 114
- Joined: Mon May 02, 2016 9:10 am
- Location: Schweiz
ADS Rdd EoF function
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
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
-
- Posts: 114
- Joined: Mon May 02, 2016 9:10 am
- Location: Schweiz
ADS Rdd EoF function
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:
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.
Markus
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:
Code: Select all
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
Moving the declaration inside the block it works now also with 2.12.2.
Code: Select all
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
ADS Rdd EoF function
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
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
robert@xsharp.eu
The Netherlands
robert@xsharp.eu