Recent

Author Topic: question on how to retrieve the text of a SQL query with params in readable way  (Read 1131 times)

rvk

  • Hero Member
  • *****
  • Posts: 6572
And DATE isn't a reserved word but I would also avoid that one as fieldname  ;)

MarkMLl

  • Hero Member
  • *****
  • Posts: 7999
Possibly also 'User', although I'd suggest that we're entering a minefield based on different servers' case-significance rules.

I know people like to knock it (because of slack case-significance rules plus lots else), but all in all I think the SQL designers did a fairly creditable job 50 years ago.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

pjtuloup

  • New Member
  • *
  • Posts: 45
Yikes.
INSERT INTO ehistocreaop (IdEvt,IdItem,Date, Heure, Domaine, User, Profil, Table)

Do you have "Table" as a fieldname.
Isn't Table a reserved word in MySQL ???
(I'm almost sure it is !)

You might want to rename that field or use quotes around "Table" in the field definitions.
But I would definitely avoid reserved words in this case !!

Edit: Yep. TABLE is a reserved word ! (See the R after it in this list)
https://dev.mysql.com/doc/refman/8.4/en/keywords.html

Lord! How could I have been so stupid? I didn't even think about it for a second... Shame on me!

So my problem is solved, thanks, (but the question I raised in the title of this thread remains interesting)

MarkMLl

  • Hero Member
  • *****
  • Posts: 7999
Lord! How could I have been so stupid? I didn't even think about it for a second... Shame on me!

"When a programmer has a hard time finding a bug, it's because he's looking in the wrong place".

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

TRon

  • Hero Member
  • *****
  • Posts: 3619
"When a programmer has a hard time finding a bug, it's because he's looking in the wrong place".
Or, in my case often, staring me right in the face when looking at least at the correct place but keep on overlooking it no matter how many times I've read it (out aloud)  :-X

Those are (still) the hardest ones to solve because there isn't a real cure for stupidity  :)
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

rvk

  • Hero Member
  • *****
  • Posts: 6572
Lord! How could I have been so stupid? I didn't even think about it for a second... Shame on me!
Haha, we've all been there  :)

CharlyTango

  • Jr. Member
  • **
  • Posts: 90
I only use descriptive names for SQL parameters to minimise sources of error.
Then you can immediately see which parameter you are currently editing.


On the subject of SQL logging: Both current access systems on SQL servers have the option of logging incoming and outgoing SQL statements.

SQLDB: You can add your own logging directly in the SQLConnector in the OnLog event.

ZEOS: use a TZSQLMonitor component
Lazarus stable, Win32/64

 

TinyPortal © 2005-2018