system.db.runPrepQuery View Resulting SQL

Is there any way to see the resulting SQL that is created, with the parameters included, when calling system.db.runPrepQuery or is there another function that can do that?

No, but...why? It's just the query with any parameters replaced.

You can set the gateway.database.Selects (or .Updates) logger to TRACE and see every query being issued by Ignition.

I'm curious what you're trying to diagnose/prove/whatever with this information, though.

So I just tried that, but my query has so many parameters that the debug log doesnt show all of them.

Im trying to troubleshoot a MERGE database statement, and I'm to the point that I need to see the actual merge statement that is generated. There is a way to view this via SQL Profiler, but in my case its a bit hard to get this setup.

So Im looking for a way to do it in Ignition.

That smells like a bad pattern to me, but giving the benefit of the doubt...
Is the log output truly truncated, or is it just that the web UI isn't showing everything? What about the wrapper log, or if you open an exported system log in Kindling?

Looking at the input query should be possible with some logging in your RDBMS; I'm not sure if that's what you mean by SQL profiler, but that's probably going to be the best option. If your database connection isn't set to use encrypted traffic, you could maybe set up Wireshark (and hope it has the ability to decode your DB's wire protocol?)

Is there any chance you are tripping on the limit for parameters? Some DBs only allow a couple thousand. (MS SQL Server, in particular.)

1 Like

Very good point. Im at 1098 on the query that is failing