Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6983427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:25:02+00:00 2026-05-27T18:25:02+00:00

I am tasked with changing what a delphi program does here at work. The

  • 0

I am tasked with changing what a delphi program does here at work. The application used to connect too a mysql server and, with ado, run queries. Now that the server has changed to one that won’t accept external connections it was decided that we would convert the application to connect to a webservice and send the mysql update query thru there.

I have everything working except for one thing. Since I did not want to change too many things (did a lot of c++builder back in the days but thats 10 years back now) I decided to leave the ado object in place and try to have it output the mysql it generates so I can send it to the webservice (hope I make sense).
The problem I have is the only thing I found was

ShowMessage (DataModuleDB.adoqClients.SQL.Text);

But this outputs the mysql before it is changed by ado:

insert into table clients (id, name) values (:id, :name)

So my question is how (if its possible) could I get the “real” mysql query to show without executing it.

Obviously if I cannot do it like that I’ll just change everything and construct the query myself.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:25:03+00:00Added an answer on May 27, 2026 at 6:25 pm

    The actual parameter substitution is happening outside the VCL and as late as in the SQL Server itself (allowing reusing the query plan).
    If you still need the substituted SQL, you can use the ADOQuery’s Command.CommandObject.CommandText and replace the ‘?’ with the parameters value yourself.
    AFAIK, ADO only cares for the right order and type…

    Something like:

    type
      THackADOQuery = class(TADOQuery);
    
    function DecodeSQL(AADOQuery: TADOQuery): string;
    var
      curParam: TCollectionItem;
    begin
      Result := THackADOQuery(AADOQuery).Command.CommandObject.CommandText;
      for curParam in AADOQuery.Parameters do
      begin
        case TParameter(curParam).DataType of
          ftString, ftWideString: Result := StringReplace(Result, '?', QuotedStr(TParameter(curParam).Value), []);
          else
            Result := StringReplace(Result, '?', TParameter(curParam).Value, []);
        end;
      end;
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      ShowMessage(DecodeSQL(ADOQuery1));
      ADOQuery1.ExecSQL;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been tasked to replace the hardware an existing Apache/Tomcat/MySQL application is running.
I have been tasked for university to program a mobile phone application. I have
I'm currently tasked with replacing an Apache + Resin Java web server with a
I've been tasked (by my wife) with creating a program to allow her to
I've been tasked with improving the performance of an ASP.NET 2.0 application . The
I'm tasked with writing an application that acts as a central storage point for
I'm tasked with exporting data from an old application that is using SQL Anywhere,
I was recently tasked with upgrading a classic ASP web application to C#. Everything
I'm a Flex rookie tasked with enhancing an existing application. One of those enhancements
I've been tasked at work to create a 'website' on a CD for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.