Skip to content

Export of database table does not honour quote setting #845

Closed

Description

@chrisjlocke

Details for the issue

Testing the export of a database table issue on Windows, and noticed I can't get quotes around field contents with spaces in. Have tried both quote options, and the 'Other'. Nothing.

http://screencast-o-matic.com/watch/cD6T6ijEHX

Tried 3.9.1 and the latest nightly. In my experiments with options, it did do quotes once, even putting quotes round fields that didn't need it. I couldn't reproduce that though, so unsure if something is screwy somewhere.

Edit: Just filling in the info below, and noted I'm using the 64bit version. Unsure if it'll make a difference, but will try on the 32bit version too.

Useful extra information

I'm opening this issue because:

  • DB4S is crashing
  • DB4S has a bug
  • DB4S needs a feature
  • DB4S has another problem

I'm using DB4S on:

  • Windows: ( version: 10 (64 bit)___ )
  • Linux: ( distro: ___ )
  • Mac OS: ( version: ___ )
  • Other: ___

I'm using DB4S version:

  • 3.9.1 (64bit)
  • 3.9.0
  • Other: 3.9.99_

I have also:

Activity

  1. justinclift commented on Oct 25, 2016

    @justinclift
    Member

    Oh, interesting. Something doesn't seem correct there.

    It'd be really useful for us to add some kind of automatic testing for this to catch regressions. Not sure how to achieve it though.

  2. added
    bugConfirmed bugs or reports that are very likely to be bugs.
    on Oct 25, 2016
  3. chrisjlocke commented on Oct 26, 2016

    @chrisjlocke
    MemberAuthor

    32bit was the same, and on a different computer, so its not just me... ;)
    Haven't tried older versions to pick out where it went wrong. I'm sure it used to work...
    Looked (briefly) through the code, but without debug info, its hard to find out whats going on .... it should work. Guess I'll add some...

  4. prutz1311 commented on Nov 2, 2016

    @prutz1311
    Contributor

    It seems like it has to do with these lines

    std::string special_chars = newlineStr.toStdString() + sepChar.toLatin1() + quoteChar.toLatin1();
    and
    if(content.toStdString().find_first_of(special_chars) != std::string::npos)
    stream << quoteChar << content.replace(quoteChar, quotequoteChar) << quoteChar;
    else
    stream << content;
    , that is, it quotes the contents of a field only if there are characters to be escaped. For example, if you have the following data:
    image
    you can export like this:

    id,flag
    a,"E""E"
    b,D D
    c,C C
    d,B B
    e,A A

    So maybe we should introduce something like chars_to_quote alongside with special_chars?

  5. justinclift commented on Nov 3, 2016

    @justinclift
    Member

    Interesting thought. 😄

    Thinking about this more, it sounds like Chris wants an option to "quote all fields", even if the quotes are not strictly needed.

    Hmmm... trying to think of a use for that though... not sure what it would be useful for? 😄

  6. chrisjlocke commented on Nov 3, 2016

    @chrisjlocke
    MemberAuthor

    Aah, might just be me then. I was under the mis-conception that fields with spaces in would need quoting (not just escaping quote characters). Thats why 'A' would not need quoting, but 'A A' would. I must just be having a brain fart then. I'll close this then, and revisit it if its an issue. 😄

  7. removed
    bugConfirmed bugs or reports that are very likely to be bugs.
    on Nov 3, 2016
  8. justinclift commented on Nov 3, 2016

    @justinclift
    Member

    Cool. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions