Browse Source

* Fixed uninitialized string results

git-svn-id: trunk@22403 -
michael 13 years ago
parent
commit
9d8235c9d8
1 changed files with 30 additions and 8 deletions
  1. 30 8
      packages/fcl-db/src/sql/fpsqltree.pp

+ 30 - 8
packages/fcl-db/src/sql/fpsqltree.pp

@@ -1940,6 +1940,7 @@ Var
     I,Ind : Integer;
     I,Ind : Integer;
 
 
   begin
   begin
+    S:='';
     if Not Assigned(List) or (List.Count=0) then
     if Not Assigned(List) or (List.Count=0) then
       exit;
       exit;
     If (AkeyWord<>'') then
     If (AkeyWord<>'') then
@@ -2039,6 +2040,7 @@ Var
   UseNewLine : Boolean;
   UseNewLine : Boolean;
 
 
 begin
 begin
+  S:='';
   Result:=SQLKeyword('INSERT INTO ',Options);
   Result:=SQLKeyword('INSERT INTO ',Options);
   If Assigned(FTableName) then
   If Assigned(FTableName) then
     Result:=Result+TableName.GetAsSQL(Options,AIndent);
     Result:=Result+TableName.GetAsSQL(Options,AIndent);
@@ -2308,6 +2310,7 @@ Var
   Sep : String;
   Sep : String;
 
 
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   If Assigned(FArguments) and (FArguments.Count>0) then
   If Assigned(FArguments) and (FArguments.Count>0) then
     For I:=0 to FArguments.Count-1 do
     For I:=0 to FArguments.Count-1 do
@@ -2317,7 +2320,6 @@ begin
       Result:=Result+Farguments[i].GetAsSQL(Options,AIndent);
       Result:=Result+Farguments[i].GetAsSQL(Options,AIndent);
       end;
       end;
   Result:=SQLKeyWord(Identifier,Options)+'('+Result+')';
   Result:=SQLKeyWord(Identifier,Options)+'('+Result+')';
-
 end;
 end;
 
 
 { TSQLTernaryExpression }
 { TSQLTernaryExpression }
@@ -2487,6 +2489,7 @@ Var
   S : String;
   S : String;
 
 
 begin
 begin
+  Result:='';
   GetSepPrefixIndent(sfoOneFieldPerLine in Options,sfoIndentfields in Options,Sep,Pref,Ind);
   GetSepPrefixIndent(sfoOneFieldPerLine in Options,sfoIndentfields in Options,Sep,Pref,Ind);
   For I:=0 to FieldDefs.Count-1 do
   For I:=0 to FieldDefs.Count-1 do
     begin
     begin
@@ -2541,6 +2544,7 @@ end;
 function TSQLConstraintDef.GetAsSQL(Options: TSQLFormatOptions; AIndent: Integer
 function TSQLConstraintDef.GetAsSQL(Options: TSQLFormatOptions; AIndent: Integer
   ): TSQLStringType;
   ): TSQLStringType;
 begin
 begin
+  Result:='';
   If Assigned(FConstraintName) then
   If Assigned(FConstraintName) then
     Result:=SQLKeyWord('CONSTRAINT ',Options)+FConstraintname.GetAsSQl(Options,AIndent);
     Result:=SQLKeyWord('CONSTRAINT ',Options)+FConstraintname.GetAsSQl(Options,AIndent);
 end;
 end;
@@ -2589,6 +2593,7 @@ Var
   I : Integer;
   I : Integer;
 
 
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   For I:=0 to FieldList.Count-1 do
   For I:=0 to FieldList.Count-1 do
     begin
     begin
@@ -2713,6 +2718,7 @@ Var
 
 
 
 
 begin
 begin
+  Result:='';
   GetSepPrefixIndent(sfoOneFieldPerLine in Options,sfoIndentFields in Options,Sep,Pref,Ind);
   GetSepPrefixIndent(sfoOneFieldPerLine in Options,sfoIndentFields in Options,Sep,Pref,Ind);
   For I:=0 to Operations.Count-1 do
   For I:=0 to Operations.Count-1 do
     begin
     begin
@@ -2985,6 +2991,7 @@ Var
   I : integer;
   I : integer;
 
 
 begin
 begin
+  Result:='';
   If Assigned(FParams) and (FParams.Count>0) then
   If Assigned(FParams) and (FParams.Count>0) then
     begin
     begin
     For I:=0 to FParams.Count-1 do
     For I:=0 to FParams.Count-1 do
@@ -3167,6 +3174,7 @@ Var
   I : Integer;
   I : Integer;
   Sep : TSQLStringType;
   Sep : TSQLStringType;
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   For I:=0 to FIndexes.Count-1 do
   For I:=0 to FIndexes.Count-1 do
     begin
     begin
@@ -3233,6 +3241,7 @@ Var
   I : Integer;
   I : Integer;
   Sep : String;
   Sep : String;
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   For I:=0 to Fitems.Count-1 do
   For I:=0 to Fitems.Count-1 do
     begin
     begin
@@ -3281,6 +3290,7 @@ Var
   Sep : String;
   Sep : String;
 
 
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   For I:=0 to List.Count-1 do
   For I:=0 to List.Count-1 do
     begin
     begin
@@ -3336,6 +3346,7 @@ Var
   I: Integer;
   I: Integer;
 
 
 begin
 begin
+  S:='';
   Result:=SQLKeyWord('EXECUTE PROCEDURE',Options);
   Result:=SQLKeyWord('EXECUTE PROCEDURE',Options);
   If Assigned(FTN) then
   If Assigned(FTN) then
     Result:=Result+' '+TransactionName.GetAsSQl(Options,AIndent);
     Result:=Result+' '+TransactionName.GetAsSQl(Options,AIndent);
@@ -3528,6 +3539,8 @@ Var
   I : Integer;
   I : Integer;
 
 
 begin
 begin
+  S:='';
+  Result:='';
   If Self is TSQLAlterProcedureStatement then
   If Self is TSQLAlterProcedureStatement then
     Result:=SQLKeyword('ALTER ',Options)
     Result:=SQLKeyword('ALTER ',Options)
   else
   else
@@ -3619,6 +3632,7 @@ Var
   I,J : Integer;
   I,J : Integer;
   S : String;
   S : String;
 begin
 begin
+  S:='';
   Result:=SQLKeyword('BEGIN',Options)+slineBreak;
   Result:=SQLKeyword('BEGIN',Options)+slineBreak;
   For I:=0 to Statements.Count-1 do
   For I:=0 to Statements.Count-1 do
     begin
     begin
@@ -3683,6 +3697,7 @@ Var
   DoNewLine : Boolean;
   DoNewLine : Boolean;
 
 
 begin
 begin
+  S:='';
   Result:=SQLKeyWord('FOR ',Options);
   Result:=SQLKeyWord('FOR ',Options);
   If Assigned(FSelect) then
   If Assigned(FSelect) then
     Result:=Result+Select.GetAsSQL(Options,AIndent)+sLineBreak;
     Result:=Result+Select.GetAsSQL(Options,AIndent)+sLineBreak;
@@ -3856,6 +3871,7 @@ Var
   S : TSQLStringType;
   S : TSQLStringType;
 
 
 begin
 begin
+  Result:='';
   For I:=0 to LocalVariables.Count-1 do
   For I:=0 to LocalVariables.Count-1 do
     begin
     begin
     Result:=Result+SQLKeyWord('DECLARE VARIABLE ',Options);
     Result:=Result+SQLKeyWord('DECLARE VARIABLE ',Options);
@@ -4489,6 +4505,7 @@ Var
   I : Integer;
   I : Integer;
 
 
 begin
 begin
+  Result:='';
   For I:=0 to List.Count-1 do
   For I:=0 to List.Count-1 do
     begin
     begin
     If (Result<>'') then
     If (Result<>'') then
@@ -4513,6 +4530,7 @@ Var
   Sep : TSQLStringType;
   Sep : TSQLStringType;
   I : Integer;
   I : Integer;
 begin
 begin
+  Result:='';
   If Assigned(FColumns) then
   If Assigned(FColumns) then
     begin
     begin
     Sep:=SQLListSeparator(Options);
     Sep:=SQLListSeparator(Options);
@@ -4536,6 +4554,7 @@ Var
   I : Integer;
   I : Integer;
 
 
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   For I:=0 to Grantees.Count-1 do
   For I:=0 to Grantees.Count-1 do
     begin
     begin
@@ -4584,6 +4603,7 @@ Var
   I : Integer;
   I : Integer;
 
 
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   For I:=0 to Privileges.Count-1 do
   For I:=0 to Privileges.Count-1 do
     begin
     begin
@@ -4637,13 +4657,14 @@ Var
   Sep : TSQLStringType;
   Sep : TSQLStringType;
   I : Integer;
   I : Integer;
 begin
 begin
-   Sep:=SQLListSeparator(Options);
-   For I:=0 to Roles.Count-1 do
-      begin
-      If (Result<>'') then
-        Result:=Result+Sep;
-      Result:=Result+Roles[i].GetAsSQl(Options,AIndent);
-      end;
+  Result:='';
+  Sep:=SQLListSeparator(Options);
+  For I:=0 to Roles.Count-1 do
+    begin
+    If (Result<>'') then
+      Result:=Result+Sep;
+     Result:=Result+Roles[i].GetAsSQl(Options,AIndent);
+    end;
   Result:=SQLKeyWord('GRANT ',Options)+Result;
   Result:=SQLKeyWord('GRANT ',Options)+Result;
   Result:=Result+GranteesAsSQL(Options,AIndent);
   Result:=Result+GranteesAsSQL(Options,AIndent);
   If AdminOption then
   If AdminOption then
@@ -4791,6 +4812,7 @@ Var
   Sep : TSQLStringType;
   Sep : TSQLStringType;
   I : Integer;
   I : Integer;
 begin
 begin
+  Result:='';
   Sep:=SQLListSeparator(Options);
   Sep:=SQLListSeparator(Options);
   For I:=0 to Roles.Count-1 do
   For I:=0 to Roles.Count-1 do
     begin
     begin