Browse Source

* Removed totally useless "try .. except raise end" block

git-svn-id: trunk@12514 -
joost 16 years ago
parent
commit
f722533e9a
1 changed files with 36 additions and 41 deletions
  1. 36 41
      packages/fcl-db/src/sqldb/sqldb.pp

+ 36 - 41
packages/fcl-db/src/sqldb/sqldb.pp

@@ -1183,61 +1183,56 @@ var tel, fieldc : integer;
     IndexFields : TStrings;
     IndexFields : TStrings;
     ReadFromFile: Boolean;
     ReadFromFile: Boolean;
 begin
 begin
-  try
-    ReadFromFile:=IsReadFromPacket;
-    Prepare;
-    if FCursor.FStatementType in [stSelect,stExecProcedure] then
+  ReadFromFile:=IsReadFromPacket;
+  Prepare;
+  if FCursor.FStatementType in [stSelect,stExecProcedure] then
+    begin
+    if not ReadFromFile then
       begin
       begin
-      if not ReadFromFile then
+      Execute;
+      // InternalInitFieldDef is only called after a prepare. i.e. not twice if
+      // a dataset is opened - closed - opened.
+      if FCursor.FInitFieldDef then InternalInitFieldDefs;
+      if DefaultFields then
         begin
         begin
-        Execute;
-        // InternalInitFieldDef is only called after a prepare. i.e. not twice if
-        // a dataset is opened - closed - opened.
-        if FCursor.FInitFieldDef then InternalInitFieldDefs;
-        if DefaultFields then
-          begin
-          CreateFields;
+        CreateFields;
 
 
-          if FUpdateable then
+        if FUpdateable then
+          begin
+          if FusePrimaryKeyAsKey then
             begin
             begin
-            if FusePrimaryKeyAsKey then
+            UpdateServerIndexDefs;
+            for tel := 0 to ServerIndexDefs.count-1 do
               begin
               begin
-              UpdateServerIndexDefs;
-              for tel := 0 to ServerIndexDefs.count-1 do
+              if ixPrimary in ServerIndexDefs[tel].options then
                 begin
                 begin
-                if ixPrimary in ServerIndexDefs[tel].options then
-                  begin
-                    IndexFields := TStringList.Create;
-                    ExtractStrings([';'],[' '],pchar(ServerIndexDefs[tel].fields),IndexFields);
-                    for fieldc := 0 to IndexFields.Count-1 do
-                      begin
-                      F := Findfield(IndexFields[fieldc]);
-                      if F <> nil then
-                        F.ProviderFlags := F.ProviderFlags + [pfInKey];
-                      end;
-                    IndexFields.Free;
-                  end;
+                  IndexFields := TStringList.Create;
+                  ExtractStrings([';'],[' '],pchar(ServerIndexDefs[tel].fields),IndexFields);
+                  for fieldc := 0 to IndexFields.Count-1 do
+                    begin
+                    F := Findfield(IndexFields[fieldc]);
+                    if F <> nil then
+                      F.ProviderFlags := F.ProviderFlags + [pfInKey];
+                    end;
+                  IndexFields.Free;
                 end;
                 end;
               end;
               end;
             end;
             end;
-          end
-        else
-          BindFields(True);
+          end;
         end
         end
       else
       else
         BindFields(True);
         BindFields(True);
-      if not ReadOnly and not FUpdateable then
-        begin
-        if (trim(FDeleteSQL.Text) <> '') or (trim(FUpdateSQL.Text) <> '') or
-           (trim(FInsertSQL.Text) <> '') then FUpdateable := True;
-        end
       end
       end
     else
     else
-      DatabaseError(SErrNoSelectStatement,Self);
-  except
-    on E:Exception do
-      raise;
-  end;
+      BindFields(True);
+    if not ReadOnly and not FUpdateable then
+      begin
+      if (trim(FDeleteSQL.Text) <> '') or (trim(FUpdateSQL.Text) <> '') or
+         (trim(FInsertSQL.Text) <> '') then FUpdateable := True;
+      end
+    end
+  else
+    DatabaseError(SErrNoSelectStatement,Self);
   inherited InternalOpen;
   inherited InternalOpen;
 end;
 end;