Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#225 Line wrap in generated select statement destroys quoting for column names

v1.0
closed
Michael Hieke
None
1
2013-10-13
2012-12-18
Anonymous
No

The names of the columns in my table contain spaces, therefore quoting is essential.
The select statement generated from "browse data" is word wrapped in the "sel"-window, disregarding the quotes ("view" -> "wrap long lines" does not change anything) - looks like this:

SELECT r."Res A lower", r."Res A upper", r."Res B lower", r."Res B upper", r."Res C
lower", r."Res C upper", r."Res D lower", r."Res D upper", r."Time (UTC)",
r."Time (local)"
FROM "Citobloc-Raw" r

of course I get something like:

Dynamic SQL Error
SQL error code = -206
Column unknown
R.Res C
lower
At line 1, column 73

until I fix the quotes manually.

Discussion

  • Here's an easy way to confirm the bug. Execute the following code:

    create table test (testcol int);
    create view testview as
    SELECT test.testcol AS "a a a a a a a", test.testcol AS "a a a a a a a a a a a a a a a b", test.testcol AS "a a a a a a a a a a a a a a a c"
    from test;

    Now right-click on TESTVIEW and select Browse data.

    UPDATE: I've discovered that you can prevent line-wrapping of generated code (at least in this case) if you go to View -> Preferences -> SQL Editor and set "Draw long line marker after column" to 0. It doesn't seem to matter if "Show long line marker" is ticked or not.

    Also, after digging through the code a bit, I think I've found that the root of the problem is wrapText in StringUtils.cpp, which is only aware of words, but not quotes. wrapText implements the %wrap template command which is used in the file browse_data.template to wrap the SELECT part of the statement. The file is in turn processed in MainFrame::executeSysTemplate when called from MainFrame::OnMenuBrowseData.

     
    Last edit: Miroslav Policki 2013-10-12


Anonymous


Cancel   Add attachments