DBI and xml:parser

Discussion in 'Perl' started by bugs, Oct 21, 2003.

  1. bugs

    bugs Guest

    i have created a script that uses the DBI and the XML::parser modules.
    i have created a connection in the main scope and then i create & execute a
    statment in one of the start_handler of the xml::parser, along the lines of

    $dbh = DBI->connect("my connection");
    $xp = new XML:parser(HANDLERS =>{Start => \&myStartSub}

    sub myStartSub {
    # creates sql statment
    $dbh->do("the sql statment")
    }

    the problem i'm having is that the sql statment is not executing, it doesn't
    return any errors.
    if i move the $dbh->do("the sql statment") out of the sub it works fine, but
    that's not much good to me up there, it also works if i place $dbh =
    DBI->connect("my connection"); inside the sub, but i don't want to be
    creating a db connection evertime i parse an element.
    How do i get around this?
    Mark
     
    bugs, Oct 21, 2003
    #1
    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.
Similar Threads
  1. ulloa
    Replies:
    1
    Views:
    537
    Juha Laiho
    Jul 22, 2004
  2. Asby

    Mason, DBI, and DBI::Pg

    Asby, Jul 24, 2003, in forum: Perl Misc
    Replies:
    0
    Views:
    185
  3. arne
    Replies:
    0
    Views:
    371
  4. Sean
    Replies:
    3
    Views:
    308
    robic0
    Oct 3, 2006
  5. Sean
    Replies:
    0
    Views:
    383
Loading...

Share This Page