example delphi

72 views
Skip to first unread message

Jucélio Moura

unread,
Jun 28, 2013, 5:03:06 PM6/28/13
to sqlp...@googlegroups.com
var
  lParams :TStringList;
  lResponse : TStringStream;
begin
  if Trim(mmo_valueOld.Text) <> EmptyStr then
    begin
      try
        with idhtp_base.ProxyParams do
          begin
            BasicAuthentication:= chk_BasicAutentication.IsChecked;
            if chk_BasicAutentication.IsChecked then
              begin
                ProxyPassword:= Trim(edt_senha.Text);
                ProxyPort:= StrToIntDef(edt_porta.Text, 8080);
                ProxyServer:= Trim(edt_servidor.Text);
                ProxyUsername:= Trim(edt_usuario.Text);
              end;
          end;
        lParams := TStringList.Create;
        lResponse := TStringStream.Create('');
        try
          lParams.Add('data='+Trim(mmo_valueOld.Text));
          lParams.Add('format=text');
          lParams.Add('keyword_case=upper');
          lParams.Add('reindent=True');
          lParams.Add('n_indents=2');
          idhtp_base.Post('http://sqlformat.appspot.com/format/', lParams, lResponse);

          lResponse.Position := 0;
          mmo_valueNew.Lines.Clear;
          mmo_valueNew.Lines.LoadFromStream(lResponse);
        finally
          lParams.Free;
          lResponse.Free;
        end;
      except
        vcl.Dialogs.MessageDlg('Ocorreu um erro', mtError, [mbOK], 0);
      end;
    end
  else
    vcl.Dialogs.MessageDlg('Não há script para formatação', mtInformation, [mbOK], 0);

Andi Albrecht

unread,
Jun 30, 2013, 5:47:58 AM6/30/13
to sqlp...@googlegroups.com
Hi,

thanks for the example!

Andi
--
You received this message because you are subscribed to the Google Groups "sqlparse" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlparse+u...@googlegroups.com.
To post to this group, send email to sqlp...@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlparse.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages