![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Incident Reports » Incident Reports Addressed for Version 2.13 » View Incident Report |
![]() |
Reported By: Peter Reported On: 3/20/2013 For: Version 2.12 Build 2 |
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;
This web page was last updated on Wednesday, October 30, 2024 at 11:41 AM | Privacy Policy![]() © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |