Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: error dbi

by bigup401 (Pilgrim)
on Oct 16, 2020 at 14:05 UTC ( [id://11122906]=note: print w/replies, xml ) Need Help??


in reply to Re: error dbi
in thread error dbi

i tried to call finish on after execute, but db can't allow fetch without excute

i dont think you can call finish when your still fetching info

Replies are listed 'Best First'.
Re^3: error dbi
by Fletch (Bishop) on Oct 16, 2020 at 14:09 UTC

    o.O

    • prepare your statement to get a handle
    • execute to fetch results
    • call whatever fetch routines to retrieve all the results
    • WHEN YOU ARE DONE FETCHING RESULTS call finish on the handle

    *plonk*

    Edit: Obviously from the errors in the OP he's not fetching all the results from the queries and he's not scoping his handles such that they're destroyed before the DB handle is cleaned up, so he either needs to explicitly finish when he's not going to fetch anything more or properly scope the handles so they're cleaned up automagically as documented. Given the historical behavior of the source that's unlikely.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      DBI:

      > When all the data has been fetched from a SELECT statement, the driver will automatically call finish for you. So you should not call it explicitly except when you know that you've not fetched all the data from a statement handle and the handle won't be destroyed soon.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      thanks its working now

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11122906]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-19 06:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found