Tabs in SQL queries...
What do people think to stripping out tabs in xlated SQL queries so that the debug output is actually readable? Is it likely to cause problems for different SQL dialects? -Arran
On 22 Jul 2012, at 21:28, Arran Cudbard-Bell wrote:
What do people think to stripping out tabs in xlated SQL queries so that the debug output is actually readable?
Is it likely to cause problems for different SQL dialects?
This would be done prior to xlating the query… -Arran
Hi,
What do people think to stripping out tabs in xlated SQL queries so that the debug output is actually readable?
why play with the queries? Why not just strip the space in the debug output - that way, you get the clean/readable debug output you want...but arent altering the core which may have some wierd side-effects on installations...who knows what eg firebird or MS-SQL will do without thorough analysis and experts in such systems on this list? alan
On 23/07/12 10:10, alan buxey wrote:
Hi,
What do people think to stripping out tabs in xlated SQL queries so that the debug output is actually readable?
why play with the queries? Why not just strip the space in the debug output - that way, you get
This is a safer approach IMO. Certainly munging them for readability would be good, though. One other option, that might be more generally usable, is to modify the config file parser to strip the indent present on the 1st from 2nd and subsequent lines when using continuations. At the moment, this: some_query = "select foo from \ bar where x=1" ...becomes: "select foo from bar where x=1" ...whereas the more intuitive result is: "select foo from bar where x=1" I think this is what leads to the whitespace in debugged SQL queries?
Hi, On Mon, Jul 23, 2012 at 11:40:30AM +0100, Phil Mayers wrote:
On 23/07/12 10:10, alan buxey wrote:
Hi,
What do people think to stripping out tabs in xlated SQL queries so that the debug output is actually readable?
why play with the queries? Why not just strip the space in the debug output - that way, you get
This is a safer approach IMO.
It's safer... until you find some (really unusual) SQL server that *does* for some unknown reason depend on tabs. At which point, your debugging output becomes rather useless :) At least if they're stripped while in use, if it breaks the debug output might have a hint at showing why. Alternative is to have a 'tidy_debug_sql_output' option, I guess. But should you selectively munge the debug output? Maybe better is a (default enabled) option 'tidy_sql_queries' option to selectively enable the tidy, so it can be disabled with the unknown wierd SQL server. At least that way the debug output is consistent. Cheers, Matthew -- Matthew Newton, Ph.D. <mcn4@le.ac.uk> Systems Architect (UNIX and Networks), Network Services, I.T. Services, University of Leicester, Leicester LE1 7RH, United Kingdom For IT help contact helpdesk extn. 2253, <ithelp@le.ac.uk>
On 23 Jul 2012, at 11:40, Phil Mayers wrote:
On 23/07/12 10:10, alan buxey wrote:
Hi,
What do people think to stripping out tabs in xlated SQL queries so that the debug output is actually readable?
why play with the queries? Why not just strip the space in the debug output - that way, you get
This is a safer approach IMO.
Certainly munging them for readability would be good, though.
One other option, that might be more generally usable, is to modify the config file parser to strip the indent present on the 1st from 2nd and subsequent lines when using continuations. At the moment, this:
some_query = "select foo from \ bar where x=1"
...becomes:
"select foo from bar where x=1"
...whereas the more intuitive result is:
"select foo from bar where x=1"
I think this is what leads to the whitespace in debugged SQL queries?
Partially, the other part is arranging the fields into neat columns, and something happening to the line endings if they're escaped. The problem is more pronounced with the V3.0 style SQL configuration. https://github.com/arr2036/freeradius-server/blob/ad8813369daa240ce75a3a7563...
Phil Mayers wrote:
One other option, that might be more generally usable, is to modify the config file parser to strip the indent present on the 1st from 2nd and subsequent lines when using continuations. At the moment, this:
some_query = "select foo from \ bar where x=1"
...becomes:
"select foo from bar where x=1"
...whereas the more intuitive result is:
"select foo from bar where x=1"
Yes.
I think this is what leads to the whitespace in debugged SQL queries?
Exactly. But knowing *which* spaces to remove is hard. They're just data inside of a double-quoted string. Alan DeKok.
participants (5)
-
alan buxey -
Alan DeKok -
Arran Cudbard-Bell -
Matthew Newton -
Phil Mayers