--- Francesco Scaglioni <[EMAIL PROTECTED]> wrote:
> Thanks and Hi again,
> 
> Tried unescaping and got no joy so tried the following - still with no
> joy -any suggestions as to which obvious thing I am missing.
> 
> #!/usr/bin/perl -w
> #
> # test script to query an mysql database
> #
> use strict;
> use DBI;

Francesco,

I'm afraid I don't have any answers, but I have some debugging suggestions.

After the use DBI statement, try adding this:

    DBI->trace( 2, "dbi_debug.log" );

When this method is called on DBI, it will start a "trace" of you interactions with 
the DBI and
the trace will be saved to the filename you specify.  If all else fails, this can be 
*incredibly*
useful.  You may wish to consider upping the trace level (the number 2) to output more
information.

>From the documentation:

    `trace'
          DBI->trace($trace_level)
          DBI->trace($trace_level, $trace_filename)

        DBI trace information can be enabled for all handles using the
        `trace' DBI class method. To enable trace information for a specific
        handle, use the similar `$h-'>`trace' method described elsewhere.

        Trace levels are as follows:

          0 - Trace disabled.
          1 - Trace DBI method calls returning with results or errors.
          2 - Trace method entry with parameters and returning with results.
          3 - As above, adding some high-level information from the driver
              and some internal information from the DBI.
          4 - As above, adding more detailed information from the driver.
              Also includes DBI mutex information when using threaded Perl.
          5 and above - As above but with more and more obscure information.

        Trace level 1 is best for a simple overview of what's happening.
        Trace level 2 is a good choice for general purpose tracing. Levels 3
        and above (up to 9) are best reserved for investigating a specific
        problem, when you need to see "inside" the driver and DBI.

        The trace output is detailed and typically very useful. Much of the
        trace output is formatted using the the neat entry elsewhere in this
        document function, so strings in the trace output may be edited and
        truncated.

        Initially trace output is written to `STDERR'. If `$trace_filename'
        is specified, then the file is opened in append mode and all trace
        output (including that from other handles) is redirected to that
        file. Further calls to `trace' without a `$trace_filename' do not
        alter where the trace output is sent. If `$trace_filename' is
        undefined, then trace output is sent to `STDERR' and the previous
        trace file is closed.

        See also the $h->trace and $h->trace_msg methods and the the
        DEBUGGING entry elsewhere in this document section for information
        about the `DBI_TRACE' environment variable.

I'd also set the "RaiseError" property.  When you do that, errors will be raised 
automatically
with each call to the DBI object and you won't have to check for them individually.  
Here's how I
would instantiate the object:

    $dbh = DBI->connect( "DBI:mysql:ami","fgs",{ RaiseError => 1 } )
           or die DBI->errstr;

Cheers,
Curtis Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Reply via email to