in reply to Re^3: Reading (the same) data in different ways & memory usage
in thread Reading (the same) data in different ways & memory usage

If the target fields in the database are of type CHAR (not VARCHAR), you can make DBI do so by:

$dbh->{ChopBlanks} = 1;

Some DBD's do extend this behavior to VARCHAR fields (when the database it too stupid to do so itself, as the ANSI standard tells it to) or when VARCHAR effectively is a CHAR internally (because the database doesn't support VARCHAR).

YMMV


Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^5: Reading (the same) data in different ways & memory usage
by BrowserUk (Patriarch) on Apr 19, 2011 at 19:27 UTC
    (when the database it too stupid to do so itself, as the ANSI standard tells it to)

    Erm. If I store the string 'fred          ' into a DB, I'd expect to get that same string back. Does ANSI mandate otherwise?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      Try to read (and understand) this sheet from one of my presentations. All Orange fields do NOT meet my expectations or the standard.

      The page is old, but most of those still hold true.


      Enjoy, Have FUN! H.Merijn

        Wow. I don't know what to say about that.

        I'd be interesting to see the info for the two DBs I've used most in the past. DB2 & MSSQL. I'd expect the former to do the "right thing"; and that latter to do something 'non-standard' for very well thought through but barely documented reasons.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.