dump_results

Discussion in 'Perl Misc' started by aaron80v@yahoo.com.au, Jul 3, 2007.

  1. Guest

    Does anyone know if DBI dump results API allow a dump without putting
    single quotes around the column values?
    I don't see an option.

    Aaron
     
    , Jul 3, 2007
    #1
    1. Advertising

  2. On Tue, 03 Jul 2007 04:13:25 -0700,
    <> wrote:
    >
    > Does anyone know if DBI dump results API allow a dump without putting
    > single quotes around the column values?


    DBI::dump_results() calls DBI::neat_list() for each row, which calls
    DBI::neat() for each element. DBI::neat() quotes string valuess, which
    is, I presume, what you're asking about?

    > I don't see an option.


    I don't know of a (documented) option either. You could always replace
    DBI::neat() with your own method, but I wouldn't recommend that without
    knowing what the puprose is.

    What is the purpose of your question?

    Martien
    --
    |
    Martien Verbruggen | Unix is user friendly. It's just selective
    | about its friends.
    |
     
    Martien verbruggen, Jul 3, 2007
    #2
    1. Advertising

  3. Guest

    On Jul 3, 8:34 pm, Martien verbruggen <> wrote:
    > On Tue, 03 Jul 2007 04:13:25 -0700,
    > <> wrote:
    >
    >
    >
    > > Does anyone know if DBI dump results API allow a dump without putting
    > > single quotes around the column values?

    >
    > DBI::dump_results() calls DBI::neat_list() for each row, which calls
    > DBI::neat() for each element. DBI::neat() quotes string valuess, which
    > is, I presume, what you're asking about?
    >
    > > I don't see an option.

    >
    > I don't know of a (documented) option either. You could always replace
    > DBI::neat() with your own method, but I wouldn't recommend that without
    > knowing what the puprose is.
    >
    > What is the purpose of your question?
    >
    > Martien
    > --
    > |
    > Martien Verbruggen | Unix is user friendly. It's just selective
    > | about its friends.
    > |


    The purpose is to get the right value delimiter such as double-quote,
    no quote at all etc for batch load data into database. For example, by
    default using dump_results(), even integer, smallint, decimal are
    delimited with single quote which during loaded will be mistaken to be
    varchar.

    Aaron
     
    , Jul 3, 2007
    #3
  4. On Tue, 03 Jul 2007 06:49:02 -0700,
    <> wrote:
    > On Jul 3, 8:34 pm, Martien verbruggen <> wrote:
    >> On Tue, 03 Jul 2007 04:13:25 -0700,
    >> <> wrote:
    >>
    >>
    >>
    >> > Does anyone know if DBI dump results API allow a dump without putting
    >> > single quotes around the column values?

    >>
    >> DBI::dump_results() calls DBI::neat_list() for each row, which calls
    >> DBI::neat() for each element. DBI::neat() quotes string valuess, which
    >> is, I presume, what you're asking about?


    >> What is the purpose of your question?


    > The purpose is to get the right value delimiter such as double-quote,
    > no quote at all etc for batch load data into database. For example, by
    > default using dump_results(), even integer, smallint, decimal are
    > delimited with single quote which during loaded will be mistaken to be
    > varchar.


    dump_results() is meant, according to the DBI documentation, to provide
    output for humans. Specifically it states:

    Since it uses "neat_list" to format and edit the string for reading
    by humans, it is not recomended for data transfer applications.

    So you're using a function for a purpose for which it is specifically
    documented not to be meant. I suggest that maybe you need to have a look
    at the DBI::Dumper module, or maybe you should simply override
    DBI::neat() as I suggested.

    Martien
    --
    |
    Martien Verbruggen | Failure is not an option. It comes bundled
    | with your Microsoft product.
    |
     
    Martien verbruggen, Jul 7, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page