Changeset 37 for trunk/USystem.pas


Ignore:
Timestamp:
Mar 8, 2012, 3:11:10 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Direct acces using Database: TSqlDatabase replaced by TChronisClient interface.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/USystem.pas

    r35 r37  
    106106    Types: TChronisTypeList;
    107107    Client: TChronisClient;
    108     Database: TSqlDatabase;
     108    //Database: TSqlDatabase;
    109109    Modules: TListObject; // TListObject<TChronisModule>
    110110    ModuleSystem: TChronisModule;
     
    207207      Properties.Client := Base.Client;
    208208      Properties.ObjectName := PropertyTable;
    209       Properties.SchemaName := Base.Database.Database;
    210       Properties.SetCondition('Object', IntToStr(Obj.Id));
     209      Properties.SchemaName := Base.Client.Schema;
     210      Properties.Condition := 'Object="' + IntToStr(Obj.Id) + '"';
    211211      Properties.Load;
    212212      Columns.Clear;
     
    262262function TChronisBase.AddType(Name, DataType: string; TypeIndex: TDbValueType): Integer;
    263263var
    264   DbRows: TDbRows;
    265   Data: TDictionaryStringString;
    266 begin
    267   try
    268     DbRows := TDbRows.Create;
    269     Data := TDictionaryStringString.Create;
    270     Data.Add('Name', Name);
    271     Data.Add('DbType', DataType);
    272     Data.Add('Id', IntToStr(Integer(TypeIndex)));
    273     Database.Insert(PropertyTypeTable, Data);
    274     Result := Database.LastInsertId;
    275   finally
    276     Data.Free;
    277     DbRows.Free;
     264  Proxy: TObjectProxy;
     265begin
     266  try
     267    Proxy := TObjectProxy.Create;
     268    Proxy.Client := Client;
     269    Proxy.ObjectName := PropertyTypeTable;
     270    Proxy.Properties.Add('Name', Name);
     271    Proxy.Properties.Add('DbType', DataType);
     272    Proxy.Properties.Add('Id', IntToStr(Integer(TypeIndex)));
     273    Proxy.Save;
     274    Result := Proxy.Id;
     275  finally
     276    Proxy.Free;
    278277  end;
    279278end;
     
    281280function TChronisBase.AddGroup(Name: string; ParentGroupId: Integer): Integer;
    282281var
    283   DbRows: TDbRows;
    284   Data: TDictionaryStringString;
    285 begin
    286   try
    287     DbRows := TDbRows.Create;
    288     Data := TDictionaryStringString.Create;
    289     Data.Add('Name', Name);
    290     Data.Add('Parent', IntToStr(ParentGroupId));
    291     Database.Insert(ObjectGroupTable, Data);
    292     Result := Database.LastInsertId;
    293   finally
    294     Data.Free;
    295     DbRows.Free;
     282  Proxy: TObjectProxy;
     283begin
     284  try
     285    Proxy := TObjectProxy.Create;
     286    Proxy.Client := Client;
     287    Proxy.ObjectName := ObjectGroupTable;
     288    Proxy.Properties.Add('Name', Name);
     289    Proxy.Properties.Add('Parent', IntToStr(ParentGroupId));
     290    Proxy.Save;
     291    Result := Proxy.Id;
     292  finally
     293    Proxy.Free;
    296294  end;
    297295end;
     
    300298  GroupId: Integer): Integer;
    301299var
    302   DbRows: TDbRows;
    303   Data: TDictionaryStringString;
    304 begin
    305   try
    306     DbRows := TDbRows.Create;
    307     Data := TDictionaryStringString.Create;
    308     Data.Add('Name', Name);
    309     Data.Add('Schema', Schema);
    310     Data.Add('Table', TableName);
    311     Data.Add('Group', IntToStr(GroupId));
    312     Database.Insert(ObjectTable, Data);
    313     Result := Database.LastInsertId;
    314   finally
    315     Data.Free;
    316     DbRows.Free;
     300  Proxy: TObjectProxy;
     301begin
     302  try
     303    Proxy := TObjectProxy.Create;
     304    Proxy.Client := Client;
     305    Proxy.ObjectName := ObjectTable;
     306    Proxy.Properties.Add('Name', Name);
     307    Proxy.Properties.Add('Schema', Schema);
     308    Proxy.Properties.Add('Table', TableName);
     309    Proxy.Properties.Add('Group', IntToStr(GroupId));
     310    Proxy.Save;
     311    Result := Proxy.Id;
     312  finally
     313    Proxy.Free;
    317314  end;
    318315end;
     
    321318  CustomType: Integer; Editable: Boolean): Integer;
    322319var
    323   DbRows: TDbRows;
    324   Data: TDictionaryStringString;
    325 begin
    326   try
    327     DbRows := TDbRows.Create;
    328     Data := TDictionaryStringString.Create;
    329     Data.Add('Name', Name);
    330     Data.Add('Object', IntToStr(ObjectId));
    331     Data.Add('ColumnName', ColumnName);
    332     Data.Add('CustomType', IntToStr(CustomType));
    333     Data.Add('Editable', IntToStr(Integer(Editable)));
    334     Database.Insert(PropertyTable, Data);
    335     Result := Database.LastInsertId;
    336   finally
    337     Data.Free;
    338     DbRows.Free;
     320  Proxy: TObjectProxy;
     321begin
     322  try
     323    Proxy := TObjectProxy.Create;
     324    Proxy.Client := Client;
     325    Proxy.ObjectName := PropertyTable;
     326    Proxy.Properties.Add('Name', Name);
     327    Proxy.Properties.Add('Object', IntToStr(ObjectId));
     328    Proxy.Properties.Add('ColumnName', ColumnName);
     329    Proxy.Properties.Add('CustomType', IntToStr(CustomType));
     330    Proxy.Properties.Add('Editable', IntToStr(Integer(Editable)));
     331    Proxy.Save;
     332    Result := Proxy.Id;
     333  finally
     334    Proxy.Free;
    339335  end;
    340336end;
     
    344340  Max: Integer = High(Integer)): Integer;
    345341var
    346   DbRows: TDbRows;
    347   Data: TDictionaryStringString;
     342  Proxy: TObjectProxy;
    348343  CustomTypeId: Integer;
    349344begin
    350345  try
    351     DbRows := TDbRows.Create;
    352     Data := TDictionaryStringString.Create;
    353 
    354     Data.Clear;
    355     Data.Add('Type', IntToStr(Integer(vtInteger)));
    356     Database.Insert(CustomTypeTableName, Data);
    357     CustomTypeId := Database.LastInsertId;
    358 
    359     Data.Clear;
    360     Data.Add('CustomType', IntToStr(CustomTypeId));
    361     Data.Add('Min', IntToStr(Min));
    362     Data.Add('Max', IntToStr(Max));
    363     Data.Add('Default', IntToStr(Default));
    364     Database.Insert(TypeNumber, Data);
     346    Proxy := TObjectProxy.Create;
     347    Proxy.Client := Client;
     348    Proxy.ObjectName := CustomTypeTableName;
     349    Proxy.Properties.Add('Type', IntToStr(Integer(vtInteger)));
     350    CustomTypeId := Proxy.Id;
     351
     352    Proxy.ObjectName := TypeNumber;
     353    Proxy.Properties.Clear;
     354    Proxy.Properties.Add('CustomType', IntToStr(CustomTypeId));
     355    Proxy.Properties.Add('Min', IntToStr(Min));
     356    Proxy.Properties.Add('Max', IntToStr(Max));
     357    Proxy.Properties.Add('Default', IntToStr(Default));
     358    Proxy.Save;
    365359    //CustomTypeId := Database.LastInsertId;
    366360
    367361    Result := AddProperty(ObjectId, Name, ColumnName, CustomTypeId, Editable);
    368   finally
    369     Data.Free;
    370     DbRows.Free;
     362    Result := Proxy.Id;
     363  finally
     364    Proxy.Free;
    371365  end;
    372366end;
     
    375369  ColumnName: string; Editable: Boolean; Default: Double; Min: Double; Max: Double): Integer;
    376370var
    377   DbRows: TDbRows;
    378   Data: TDictionaryStringString;
     371  Proxy: TObjectProxy;
    379372  CustomTypeId: Integer;
    380373begin
    381374  try
    382     DbRows := TDbRows.Create;
    383     Data := TDictionaryStringString.Create;
    384 
    385     Data.Clear;
    386     Data.Add('Type', IntToStr(Integer(vtFloat)));
    387     Database.Insert(CustomTypeTableName, Data);
    388     CustomTypeId := Database.LastInsertId;
    389 
    390     Data.Clear;
    391     Data.Add('CustomType', IntToStr(CustomTypeId));
    392     Data.Add('Min', MySQLFloatToStr(Min));
    393     Data.Add('Max', MySQLFloatToStr(Max));
    394     Data.Add('Default', MySQLFloatToStr(Default));
    395     Database.Insert(TypeFloat, Data);
     375    Proxy := TObjectProxy.Create;
     376    Proxy.Client := Client;
     377    Proxy.ObjectName := CustomTypeTableName;
     378    Proxy.Properties.Add('Type', IntToStr(Integer(vtFloat)));
     379    CustomTypeId := Proxy.Id;
     380
     381    Proxy.ObjectName := TypeFloat;
     382    Proxy.Properties.Clear;
     383    Proxy.Properties.Add('CustomType', IntToStr(CustomTypeId));
     384    Proxy.Properties.Add('Min', MySQLFloatToStr(Min));
     385    Proxy.Properties.Add('Max', MySQLFloatToStr(Max));
     386    Proxy.Properties.Add('Default', MySQLFloatToStr(Default));
     387    Proxy.Save;
    396388    //CustomTypeId := Database.LastInsertId;
    397389
    398390    Result := AddProperty(ObjectId, Name, ColumnName, CustomTypeId, Editable);
    399391  finally
    400     Data.Free;
    401     DbRows.Free;
     392    Proxy.Free;
    402393  end;
    403394end;
     
    407398  ): Integer;
    408399var
    409   DbRows: TDbRows;
    410   Data: TDictionaryStringString;
     400  Proxy: TObjectProxy;
    411401  CustomTypeId: Integer;
    412402begin
    413403  try
    414     DbRows := TDbRows.Create;
    415     Data := TDictionaryStringString.Create;
    416 
    417     Data.Clear;
    418     Data.Add('Type', IntToStr(Integer(vtDateTime)));
    419     Database.Insert(CustomTypeTableName, Data);
    420     CustomTypeId := Database.LastInsertId;
    421 
    422     Data.Clear;
    423     Data.Add('CustomType', IntToStr(CustomTypeId));
    424     Data.Add('Min', DateTimeToSQL(Min));
    425     Data.Add('Max', DateTimeToSQL(Max));
    426     Data.Add('Default', DateTimeToSQL(Default));
    427     Database.Insert(TypeDateTime, Data);
     404    Proxy := TObjectProxy.Create;
     405    Proxy.Client := Client;
     406    Proxy.ObjectName := CustomTypeTableName;
     407    Proxy.Properties.Add('Type', IntToStr(Integer(vtDateTime)));
     408    Proxy.Save;
     409    CustomTypeId := Proxy.Id;
     410
     411    Proxy.ObjectName := TypeDateTime;
     412    Proxy.Properties.Clear;
     413    Proxy.Properties.Add('CustomType', IntToStr(CustomTypeId));
     414    Proxy.Properties.Add('Min', DateTimeToSQL(Min));
     415    Proxy.Properties.Add('Max', DateTimeToSQL(Max));
     416    Proxy.Properties.Add('Default', DateTimeToSQL(Default));
     417    Proxy.Save;
    428418    //CustomTypeId := Database.LastInsertId;
    429419
    430420    Result := AddProperty(ObjectId, Name, ColumnName, CustomTypeId, Editable);
    431421  finally
    432     Data.Free;
    433     DbRows.Free;
     422    Proxy.Free;
    434423  end;
    435424end;
     
    438427  ColumnName: string; Editable: Boolean; Default: string = ''; MaxLength: Integer = 255): Integer;
    439428var
    440   DbRows: TDbRows;
    441   Data: TDictionaryStringString;
     429  Proxy: TObjectProxy;
    442430  CustomTypeId: Integer;
    443431begin
    444432  try
    445     DbRows := TDbRows.Create;
    446     Data := TDictionaryStringString.Create;
    447 
    448     Data.Clear;
    449     Data.Add('Type', IntToStr(Integer(vtString)));
    450     Database.Insert(CustomTypeTableName, Data);
    451     CustomTypeId := Database.LastInsertId;
    452 
    453     Data.Clear;
    454     Data.Add('CustomType', IntToStr(CustomTypeId));
    455     Data.Add('MaxLength', IntToStr(MaxLength));
    456     Data.Add('Default', Default);
    457     Database.Insert(TypeString, Data);
     433    Proxy := TObjectProxy.Create;
     434    Proxy.Client := Client;
     435    Proxy.ObjectName := CustomTypeTableName;
     436    Proxy.Properties.Add('Type', IntToStr(Integer(vtString)));
     437    Proxy.Save;
     438    CustomTypeId := Proxy.Id;
     439
     440    Proxy.ObjectName := TypeString;
     441    Proxy.Properties.Clear;
     442    Proxy.Properties.Add('CustomType', IntToStr(CustomTypeId));
     443    Proxy.Properties.Add('MaxLength', IntToStr(MaxLength));
     444    Proxy.Properties.Add('Default', Default);
     445    Proxy.Save;
    458446    //CustomTypeId := Database.LastInsertId;
    459447
    460448    Result := AddProperty(ObjectId, Name, ColumnName, CustomTypeId, Editable);
    461449  finally
    462     Data.Free;
    463     DbRows.Free;
     450    Proxy.Free;
    464451  end;
    465452end;
     
    468455  ColumnName: string; Editable: Boolean; Default: string): Integer;
    469456var
    470   DbRows: TDbRows;
    471   Data: TDictionaryStringString;
     457  Proxy: TObjectProxy;
    472458  CustomTypeId: Integer;
    473459begin
    474460  try
    475     DbRows := TDbRows.Create;
    476     Data := TDictionaryStringString.Create;
    477 
    478     Data.Clear;
    479     Data.Add('Type', IntToStr(Integer(vtText)));
    480     Database.Insert(CustomTypeTableName, Data);
    481     CustomTypeId := Database.LastInsertId;
    482 
    483     Data.Clear;
    484     Data.Add('CustomType', IntToStr(CustomTypeId));
    485     Data.Add('Default', Default);
    486     Database.Insert(TypeString, Data);
     461    Proxy := TObjectProxy.Create;
     462    Proxy.Client := Client;
     463    Proxy.ObjectName := CustomTypeTableName;
     464    Proxy.Properties.Add('Type', IntToStr(Integer(vtText)));
     465    Proxy.Save;
     466    CustomTypeId := Proxy.Id;
     467
     468    Proxy.ObjectName := TypeString;
     469    Proxy.Properties.Clear;
     470    Proxy.Properties.Add('CustomType', IntToStr(CustomTypeId));
     471    Proxy.Properties.Add('Default', Default);
     472    Proxy.Save;
    487473    //CustomTypeId := Database.LastInsertId;
    488474
    489475    Result := AddProperty(ObjectId, Name, ColumnName, CustomTypeId, Editable);
    490476  finally
    491     Data.Free;
    492     DbRows.Free;
     477    Proxy.Free;
    493478  end;
    494479end;
     
    497482  ColumnName: string; Editable: Boolean; ReferedObject: Integer): Integer;
    498483var
    499   DbRows: TDbRows;
    500   Data: TDictionaryStringString;
     484  Proxy: TObjectProxy;
    501485  CustomTypeId: Integer;
    502486begin
    503487  try
    504     DbRows := TDbRows.Create;
    505     Data := TDictionaryStringString.Create;
    506 
    507     Data.Clear;
    508     Data.Add('Type', IntToStr(Integer(vtRelationOne)));
    509     Database.Insert(CustomTypeTableName, Data);
    510     CustomTypeId := Database.LastInsertId;
    511 
    512     Data.Clear;
    513     Data.Add('CustomType', IntToStr(CustomTypeId));
    514     Data.Add('Object', IntToStr(ReferedObject));
    515     Database.Insert(TypeRelationOne, Data);
     488    Proxy := TObjectProxy.Create;
     489    Proxy.Client := Client;
     490    Proxy.ObjectName := CustomTypeTableName;
     491    Proxy.Properties.Add('Type', IntToStr(Integer(vtRelationOne)));
     492    Proxy.Save;
     493    CustomTypeId := Proxy.Id;
     494
     495    Proxy.ObjectName := TypeRelationOne;
     496    Proxy.Properties.Clear;
     497    Proxy.Properties.Add('CustomType', IntToStr(CustomTypeId));
     498    Proxy.Properties.Add('Object', IntToStr(ReferedObject));
     499    Proxy.Save;
    516500    //CustomTypeId := Database.LastInsertId;
    517501
    518502    Result := AddProperty(ObjectId, Name, ColumnName, CustomTypeId, Editable);
    519503  finally
    520     Data.Free;
    521     DbRows.Free;
     504    Proxy.Free;
    522505  end;
    523506end;
     
    526509  ColumnName: string; Editable: Boolean; ReferedObjectProperty: Integer): Integer;
    527510var
    528   DbRows: TDbRows;
    529   Data: TDictionaryStringString;
     511  Proxy: TObjectProxy;
    530512  CustomTypeId: Integer;
    531513begin
    532514  try
    533     DbRows := TDbRows.Create;
    534     Data := TDictionaryStringString.Create;
    535 
    536     Data.Clear;
    537     Data.Add('Type', IntToStr(Integer(vtRelationMany)));
    538     Database.Insert(CustomTypeTableName, Data);
    539     CustomTypeId := Database.LastInsertId;
    540 
    541     Data.Clear;
    542     Data.Add('CustomType', IntToStr(CustomTypeId));
    543     Data.Add('ObjectProperty', IntToStr(ReferedObjectProperty));
    544     Database.Insert(TypeRelationMany, Data);
     515    Proxy := TObjectProxy.Create;
     516    Proxy.Client := Client;
     517    Proxy.ObjectName := CustomTypeTableName;
     518
     519    Proxy.Properties.Clear;
     520    Proxy.Properties.Add('Type', IntToStr(Integer(vtRelationMany)));
     521    Proxy.Save;
     522    CustomTypeId := Proxy.Id;
     523
     524    Proxy.ObjectName := TypeRelationMany;
     525    Proxy.Properties.Clear;
     526    Proxy.Properties.Add('CustomType', IntToStr(CustomTypeId));
     527    Proxy.Properties.Add('ObjectProperty', IntToStr(ReferedObjectProperty));
     528    Proxy.Save;
    545529    //CustomTypeId := Database.LastInsertId;
    546530
    547531    Result := AddProperty(ObjectId, Name, ColumnName, CustomTypeId, Editable);
    548532  finally
    549     Data.Free;
    550     DbRows.Free;
     533    Proxy.Free;
    551534  end;
    552535end;
     
    554537function TChronisBase.AddObjectGroup(Name: string): Integer;
    555538var
    556   DbRows: TDbRows;
    557   Data: TDictionaryStringString;
    558 begin
    559   try
    560     DbRows := TDbRows.Create;
    561     Data := TDictionaryStringString.Create;
    562     Data.Add('Name', Name);
    563     Database.Insert(ObjectGroupTable, Data);
    564     Result := Database.LastInsertId;
    565   finally
    566     Data.Free;
    567     DbRows.Free;
     539  Proxy: TObjectProxy;
     540begin
     541  try
     542    Proxy := TObjectProxy.Create;
     543    Proxy.Client := Client;
     544    Proxy.ObjectName := ObjectGroupTable;
     545    Proxy.Properties.Add('Name', Name);
     546    Proxy.Save;
     547    Result := Proxy.Id;
     548  finally
     549    Proxy.Free;
    568550  end;
    569551end;
     
    571553function TChronisBase.AddEnumeration(Name: string): Integer;
    572554var
    573   DbRows: TDbRows;
    574   Data: TDictionaryStringString;
    575 begin
    576   try
    577     DbRows := TDbRows.Create;
    578     Data := TDictionaryStringString.Create;
    579     Data.Add('Name', Name);
    580     Database.Insert(Enumeration, Data);
    581     Result := Database.LastInsertId;
    582   finally
    583     Data.Free;
    584     DbRows.Free;
     555  Proxy: TObjectProxy;
     556begin
     557  try
     558    Proxy := TObjectProxy.Create;
     559    Proxy.Client := Client;
     560    Proxy.ObjectName := Enumeration;
     561    Proxy.Properties.Add('Name', Name);
     562    Proxy.Save;
     563    Result := Proxy.Id;
     564  finally
     565    Proxy.Free;
    585566  end;
    586567end;
     
    589570  ): Integer;
    590571var
    591   DbRows: TDbRows;
    592   Data: TDictionaryStringString;
    593 begin
    594   try
    595     DbRows := TDbRows.Create;
    596     Data := TDictionaryStringString.Create;
    597     Data.Add('Enumeration', IntToStr(Enum));
    598     Data.Add('Name', Name);
    599     Database.Insert(EnumerationState, Data);
    600     Result := Database.LastInsertId;
    601   finally
    602     Data.Free;
    603     DbRows.Free;
     572  Proxy: TObjectProxy;
     573begin
     574  try
     575    Proxy := TObjectProxy.Create;
     576    Proxy.Client := Client;
     577    Proxy.ObjectName := EnumerationState;
     578    Proxy.Properties.Add('Enumeration', IntToStr(Enum));
     579    Proxy.Properties.Add('Name', Name);
     580    Proxy.Save;
     581    Result := Proxy.Id;
     582  finally
     583    Proxy.Free;
    604584  end;
    605585end;
     
    608588  License: string): Integer;
    609589var
    610   DbRows: TDbRows;
    611   Data: TDictionaryStringString;
    612 begin
    613   try
    614     DbRows := TDbRows.Create;
    615     Data := TDictionaryStringString.Create;
    616     Data.Add('Name', Name);
    617     Data.Add('Author', Author);
    618     Data.Add('Website', Website);
    619     Data.Add('Version', Version);
    620     Data.Add('Description', Description);
    621     Data.Add('License', License);
    622     Database.Insert(ModuleTable, Data);
    623     Result := Database.LastInsertId;
    624   finally
    625     Data.Free;
    626     DbRows.Free;
     590  Proxy: TObjectProxy;
     591begin
     592  try
     593    Proxy := TObjectProxy.Create;
     594    Proxy.Client := Client;
     595    Proxy.ObjectName := ModuleTable;
     596    Proxy.Properties.Add('Name', Name);
     597    Proxy.Properties.Add('Author', Author);
     598    Proxy.Properties.Add('Website', Website);
     599    Proxy.Properties.Add('Version', Version);
     600    Proxy.Properties.Add('Description', Description);
     601    Proxy.Properties.Add('License', License);
     602    Proxy.Save;
     603    Result := Proxy.Id;
     604  finally
     605    Proxy.Free;
    627606  end;
    628607end;
     
    630609procedure TChronisBase.LoadTypes;
    631610var
    632   DbRows: TDbRows;
     611  Proxy: TListProxy;
    633612  I: Integer;
    634613begin
    635614  try
    636     DbRows := TDbRows.Create;
     615    Proxy := TListProxy.Create;
     616    Proxy.Client := Client;
     617    Proxy.ObjectName := PropertyTypeTable;
     618    Proxy.Load;
    637619    Types.Clear;
    638     Database.Select(DbRows, PropertyTypeTable);
    639     for I := 0 to DbRows.Count - 1 do begin
     620    for I := 0 to Proxy.Objects.Count - 1 do begin
    640621      with TChronisType(Types.AddNew(TChronisType.Create)) do
    641       with DbRows[I] do begin
    642         Id := StrToInt(Values['Id']);
    643         DbType := Values['DbType'];
    644         //Parent := StrToInt(Values['Parent']);
     622      with TObjectProxy(Proxy.Objects[I]) do begin
     623        Id := StrToInt(Properties.Values['Id']);
     624        DbType := Properties.Values['DbType'];
     625        //Parent := StrToInt(Properties.Values['Parent']);
    645626      end;
    646627    end;
    647628  finally
    648     DbRows.Free;
     629    Proxy.Free;
    649630  end;
    650631end;
     
    652633function TChronisBase.IsDatabaseEmpty: Boolean;
    653634var
    654   DbRows: TDbRows;
    655 begin
    656   try
    657     DbRows := TDbRows.Create;
    658     Database.Query(DbRows, 'SELECT 1 FROM information_schema.tables WHERE table_name = "Information" AND table_schema = "' +
    659       Database.Database + '"');
    660     Result := DbRows.Count = 0;
    661   finally
    662     DbRows.Free;
     635  Proxy: TListProxy;
     636begin
     637  try
     638    Proxy := TListProxy.Create;
     639    Proxy.Client := Client;
     640    Proxy.SchemaName := 'information_schema';
     641    Proxy.ObjectName := 'tables';
     642    Proxy.Condition := 'table_name = "Information" AND table_schema = "' +
     643      Client.Schema + '"';
     644    Proxy.Load;
     645    Result := Proxy.Objects.Count = 0;
     646  finally
     647    Proxy.Free;
    663648  end;
    664649end;
     
    718703    List.Client := Core.System.Client;
    719704    List.ObjectName := ObjectTable;
    720     List.SchemaName := Core.System.Database.Database;
    721     List.SetCondition('Id', IntToStr(ObjectId));
     705    List.SchemaName := Core.System.Client.Schema;
     706    List.Condition := 'Id=' + IntToStr(ObjectId);
    722707    List.Load;
    723708    if List.Objects.Count = 1 then begin
Note: See TracChangeset for help on using the changeset viewer.