|
@@ -167,6 +167,8 @@ Type
|
|
Public
|
|
Public
|
|
Function AddSchema (aSchema : TSQLDBRestSchema) : TSQLDBRestSchemaRef;
|
|
Function AddSchema (aSchema : TSQLDBRestSchema) : TSQLDBRestSchemaRef;
|
|
Function IndexOfSchema(aSchemaName : String) : Integer;
|
|
Function IndexOfSchema(aSchemaName : String) : Integer;
|
|
|
|
+ Function FindSchemaRef(aSchemaName : String) : TSQLDBRestSchemaRef;
|
|
|
|
+ Function FindSchema(aSchemaName : String) : TSQLDBRestSchema;
|
|
Property Schemas[aIndex :Integer] : TSQLDBRestSchemaRef Read GetSchema Write SetSchema;default;
|
|
Property Schemas[aIndex :Integer] : TSQLDBRestSchemaRef Read GetSchema Write SetSchema;default;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -484,6 +486,32 @@ begin
|
|
Dec(Result);
|
|
Dec(Result);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function TSQLDBRestSchemaList.FindSchemaRef(aSchemaName: String): TSQLDBRestSchemaRef;
|
|
|
|
+
|
|
|
|
+Var
|
|
|
|
+ Idx : integer;
|
|
|
|
+
|
|
|
|
+begin
|
|
|
|
+ Idx:=IndexOfSchema(aSchemaName);
|
|
|
|
+ if Idx=-1 then
|
|
|
|
+ Result:=Nil
|
|
|
|
+ else
|
|
|
|
+ Result:=Schemas[Idx];
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function TSQLDBRestSchemaList.FindSchema(aSchemaName: String): TSQLDBRestSchema;
|
|
|
|
+
|
|
|
|
+Var
|
|
|
|
+ Ref : TSQLDBRestSchemaRef;
|
|
|
|
+
|
|
|
|
+begin
|
|
|
|
+ Ref:=FindSchemaRef(aSchemaName);
|
|
|
|
+ if Ref=Nil then
|
|
|
|
+ Result:=Nil
|
|
|
|
+ else
|
|
|
|
+ Result:=Ref.Schema;
|
|
|
|
+end;
|
|
|
|
+
|
|
{ TSQLDBRestDispatcher }
|
|
{ TSQLDBRestDispatcher }
|
|
|
|
|
|
procedure TSQLDBRestDispatcher.SetConnections(AValue: TSQLDBRestConnectionList);
|
|
procedure TSQLDBRestDispatcher.SetConnections(AValue: TSQLDBRestConnectionList);
|
|
@@ -2114,16 +2142,26 @@ function TSQLDBRestDispatcher.ExposeConnection(aOwner: TComponent;
|
|
Var
|
|
Var
|
|
Conn : TSQLConnection;
|
|
Conn : TSQLConnection;
|
|
TR : TSQLTransaction;
|
|
TR : TSQLTransaction;
|
|
|
|
+ Ref : TSQLDBRestSchemaRef;
|
|
S : TSQLDBRestSchema;
|
|
S : TSQLDBRestSchema;
|
|
|
|
+ SName : String;
|
|
|
|
|
|
begin
|
|
begin
|
|
Conn:=GetSQLConnection(aConnection,TR);
|
|
Conn:=GetSQLConnection(aConnection,TR);
|
|
- S:=TSQLDBRestSchema.Create(aOwner);
|
|
|
|
- S.Name:='Schema'+aConnection.Name;
|
|
|
|
- S.PopulateResources(Conn,aTables,aMinFieldOpts);
|
|
|
|
- if not (rdoConnectionInURL in DispatchOptions) then
|
|
|
|
- S.ConnectionName:=aConnection.Name;
|
|
|
|
- Schemas.AddSchema(S).Enabled:=true;
|
|
|
|
|
|
+ SName:='Schema'+aConnection.Name;
|
|
|
|
+ Ref:=Schemas.FindSchemaRef(SName);
|
|
|
|
+ if Ref<>Nil then
|
|
|
|
+ S:=Ref.Schema
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ S:=TSQLDBRestSchema.Create(aOwner);
|
|
|
|
+ S.Name:='Schema'+aConnection.Name;
|
|
|
|
+ S.PopulateResources(Conn,aTables,aMinFieldOpts);
|
|
|
|
+ if not (rdoConnectionInURL in DispatchOptions) then
|
|
|
|
+ S.ConnectionName:=aConnection.Name;
|
|
|
|
+ Ref:=Schemas.AddSchema(S);
|
|
|
|
+ end;
|
|
|
|
+ Ref.Enabled:=true;
|
|
Result:=S;
|
|
Result:=S;
|
|
end;
|
|
end;
|
|
|
|
|