Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 6 of 6 total |
TEDBScript AV |
Wed, Mar 20 2013 12:38 AM | Permanent Link |
Peter | Hello
I am having problems with the TEDBScript component. I use it to run a script that creates an in-memory table, and that process has just started giving an AV in the TEDBScript.CreateCursor area. I recently updated to 2.12 Build 1, then Build 2. As far as I can tell, it is not the fault of the script, or the SQL that the script uses to create the in-memory table, as both of those work perfectly in EDBManager; together and separately. I recently moved away from having the engine created on the fly to a TEDBEngine component in a DataModule, but apart from that I can't imagine what other change is causing the AV. MadExcept tells me that it is in edbcomps in TEDBScript.CreateCursor, but apart from that I can't suggest what it might be. The script (named SQLSCR) is: SCRIPT (IN SQLStatement VARCHAR, IN TableName VARCHAR, IN AddBool BOOLEAN) BEGIN DECLARE InfoCursor SENSITIVE CURSOR FOR InfoStmt; DECLARE ResultCursor SENSITIVE CURSOR WITH RETURN FOR ResultStmt; PREPARE InfoStmt FROM 'SELECT * FROM Information.Tables WHERE Name=?'; OPEN InfoCursor USING TableName; IF (ROWCOUNT(InfoCursor) > 0) THEN EXECUTE IMMEDIATE 'DROP TABLE "'+TableName+'"'; END IF; CLOSE InfoCursor; PREPARE ResultStmt FROM 'CREATE TABLE "' + TableName + '" AS ' + SQLStatement + ' WITH DATA'; EXECUTE ResultStmt; IF AddBool THEN EXECUTE IMMEDIATE 'ALTER TABLE "'+TableName+'" ADD COLUMN "SelRow" BOOLEAN DEFAULT %s'; END IF; END and the parameters are: TableName = InMemOne AddBool = False SQLStatement = SELECT * FROM PlanB.Client WHERE ClientID = 1 The Delphi XE3 code is: ... var aScript: TEDBScript; begin aScript := TEDBScript.Create(nil); try aScript.SessionName := DM.EDBDatabase1.SessionName; aScript.DatabaseName := INMEMDB; aScript.SQL.Add(Format(SQLSCR, [GetTF_YNStr(False, BoolVal)])); aScript.Prepare; aScript.ParamByName('SQLStatement').AsString := SSQL; aScript.ParamByName('TableName').AsString := STableName; aScript.ParamByName('AddBool').AsBoolean := UsesBool; try aScript.ExecScript; except raise; end; finally aScript.Free; end; Is there a bug in the script component, or could there be something connected to the new Engine component? Regards Peter |
Wed, Mar 20 2013 5:05 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Peter
Obligatory reminder: EDBManager and your application are just two applications written using Delphi and ElevateDB. There is no magic in EDBManager so if it works in there and not in your app there must be a difference. Caveat: The above is generally true but sometimes seems not to be so First question: are you using the same version of ElevateDB in the app and EDBManager Second question: are you working on the same database in both cases I can't see anything obvious in the script or your code that could produce the fault, and I doubt that its just using an engine component. However, you do get the source to edbcomps so you could have a look and see where in there its coming from. Unless you bought full source it won't allow you to trace right the way down but it may give you a clue. The other thing is to post the relevant section of the MadExcept report here. It may give someone a clue. Roy Lambert [Team Elevate] |
Wed, Mar 20 2013 7:09 AM | Permanent Link |
Peter | Roy
Both the EDB Manager and the components are 2.12 Build 2. I've attached the MadExcept report, and while it is pointing to the TEDBScript.CreateCursor method as the last man standing, that may not be the cause of the AV. Regards Peter Attachments: MadExceptReportProj1.txt |
Wed, Mar 20 2013 9:02 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Peter
I'm no expert at deciphering those (my bugs are generally obvious) I'd say the problem comes from TEDBLocalExprEvaluator.EvaluateReturnCursor Tim will know. But reading the script code again I meant to ask about this before IF AddBool THEN EXECUTE IMMEDIATE 'ALTER TABLE "'+TableName+'" ADD COLUMN "SelRow" BOOLEAN DEFAULT %s'; What is the %s - should that not be either TRUE or FALSE? Roy Lambert [Team Elevate] |
Wed, Mar 20 2013 2:55 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Peter,
<< I am having problems with the TEDBScript component. I use it to run a script that creates an in-memory table, and that process has just started giving an AV in the TEDBScript.CreateCursor area. I recently updated to 2.12 Build 1, then Build 2. >> It's a bug. As a workaround, change this: DECLARE ResultCursor SENSITIVE CURSOR WITH RETURN FOR ResultStmt; to this: DECLARE ResultCursor SENSITIVE CURSOR FOR ResultStmt; I'll have a fix for this in the next build. Tim Young Elevate Software www.elevatesoft.com |
Thu, Mar 21 2013 12:28 AM | Permanent Link |
Peter | Tim
Thanks - I almost gave up drinking for a while there Roy The %s is for the format call in: aScript.SQL.Add(Format(SQLSCR, [GetTF_YNStr(False, BoolVal)])); I format the 'TRUE' or 'FALSE' string in, depending on the table being created. Thanks for your time, it is appreciated. Regards Peter |
This web page was last updated on Monday, April 29, 2024 at 05:23 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |