Hello,
Here is a code in Delphi:
program Project1; {$APPTYPE CONSOLE} uses SysUtils, uROComInit, uDAClasses, uDAInterfaces, uROClasses, uDAIBXDriver, uDADriverManager; const aConnStr = 'IBX?Server=localhostatabase=C:\Program Files\Firebird\Firebird_2_1\examples\empbuild\EMPLOYEE.FDB;UserID=sysdba;Password=masterkey;'; aConnName = 'IBX Connection'; aSchemaFileName = 'c:\TestSchema.daSchema'; aConnFileName = 'c:\TestSchema.daConnections'; var aSchema:TDASchema; aConnManager:TDAConnectionManager; aDriverManager:TDADriverManager; aConn:IDAConnection; aTables, aViews, entities:IROStrings; aFields:TDAFieldCollection; aDataSet:TDADataset; aStatement:TDAStatement; I,J:Integer; begin aSchema := TDASchema.Create(nil); aConnManager := TDAConnectionManager.Create(nil); aDriverManager := TDADriverManager.Create(nil); try aConnManager.PoolingEnabled := False; aConnManager.DriverManager := aDriverManager; aSchema.ConnectionManager := aConnManager; with aConnManager.Connections.Add do begin Name := aConnName; ConnectionString := aConnStr; Default := True; end; aConn := aConnManager.NewConnection(aConnName); aConn.GetTableNames(aTables); aConn.GetViewNames(aViews); entities := NewROStrings(); entities.AddStrings(aTables.Strings); entities.AddStrings(aViews.Strings); for I: to entities.Count-1 do begin aConn.GetTableFields(entities[I], aFields); aDataSet := aSchema.Datasets.Add(); aDataSet.Name := entities[I]; aStatement := aDataSet.Statements.Add(); aStatement.StatementType := stSQL; aStatement.TargetTable := aDataSet.Name; aStatement.Default := True; aStatement.Connection := aConn.Name; aStatement.TargetTable := entities[I]; aStatement.StatementType := stAutoSQL; aConn.GetTableFields(entities[I], aFields); aDataSet.Fields.AssignFieldCollection(aFields); with aStatement.ColumnMappings do begin for J := 0 to (aFields.Count-1) do begin if not (aFields[J].Calculated or aFields[J].ServerCalculated) then begin with Add do begin DatasetField := aFields[J].Name; TableField := aFields[J].Name; SQLOrigin := TableField; end; end; end; end; end; aSchema.SaveToFile(aSchemaFileName); aConnManager.SaveToFile(aConnFileName); aConn := nil; finally FreeAndNil(aSchema); FreeAndNil(aConnManager); FreeAndNil(aDriverManager); end; end.