How to save schema on database field?

edited 6:44AM in FastCube 2

How to save schema on database field?

I use

fcxSlice1.SaveToStream( vs );

to get stream, but not return the same xml on the *.mds

Comments

  • I use Oracle 12 , with Delphi 10.4 and Firedac to save the cube file and Schema File , on CLob database Field.

    TABLE SCRIPT

    Create Table TabelaSchema

    (

    ID Number not null,

    usuario varchar2(15) not null,

    nomearquivo varchar2(100) not null,

    Arquivo_Schema clob not null,

    DATAGRAVACAO date not null,

    TIPO varchar2(1)

    ) TABLESPACE ....(so here i don´t know the name you can use)

    alter table TabelaSchema

     add constraint PK_ID primary key (ID)

     using index;

      

    create sequence SQ_TabelaSchema

    minvalue 1

    maxvalue 99999999999999999999999

    start with 1

    increment by 1;

    ---------------------------------------------------------------------

    Procedure TFrm.SalvarCubo;

    var Qry_Leitura,Qry : TFDQuery;

       arq: TextFile;

       vNomeArquivo: string;

    begin

      if SaveDialogCube.Execute then

      begin

      fcxCube.SaveToFile(SaveDialogCube.fileName);

       vNomeArquivo := vcUsuario + '_' + Copy(SaveDialogCube.fileName,LastDelimiter('\', SaveDialogCube.fileName)+1,50);

      end

      else

      exit;


     Qry:= TFDQuery.Create(nil);

     If not vcDatabase.InTransaction then

        vcDatabase.StartTransaction;

     try

      Qry.ConnectionName := cDataBaseName;

      Qry.SQL.Clear;

      Qry.SQL.Add('INSERT INTO TabelaSchema(ID, USUARIO , NOMEARQUIVO, ARQUIVO_SCHEMA, DATAGRAVACAO, TIPO) VALUES');

      Qry.SQl.Add('(SQ_table.NextVal, :P_USUARIO, :P_NOMEARQUIVO , :P_ARQUIVO_SCHEMA, :P_DATAGRAVACAO, :P_TIPO)');


      try

        Qry.ParamByName('P_USUARIO').AsString:= vcUsuario;

        Qry.ParamByName('P_NOMEARQUIVO').AsString:= vNomeArquivo;

        Qry.ParamByName('PARQUIVOSCHEMA' ).LoadFromFile(SaveDialogCube.fileName, ftOraClob);

        Qry.ParamByName('P_DATAGRAVACAO').AsDateTime:= Now;

       Qry.ParamByName('P_TIPO').AsString:= 'C';

        Qry.ExecSQL;

      except on E: Exception do

        begin

           ShowMessage(e.Message);

           vcDatabase.Rollback;

         end;

    End;

      if vcDatabase.InTransaction then

       vcDatabase.Commit;

     finally

      Qry.Free;

     end;

    end;

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.