in reply to Re: Can not get the same output from $dbh->do and $dbh->prepare
in thread Can not get the same output from $dbh->do and $dbh->prepare

To: boftx,

Well first of all the link that you provide is not working. Second of all not all of us can find and understand the information that clearly and that fast.

But any way, thank you for your time and effort replying to my question.

Seeking for Perl wisdom...on the process...not there...yet!
  • Comment on Re^2: Can not get the same output from $dbh->do and $dbh->prepare

Replies are listed 'Best First'.
Re^3: Can not get the same output from $dbh->do and $dbh->prepare
by hippo (Archbishop) on May 25, 2014 at 10:26 UTC
    not all of us can find and understand the information that clearly and that fast.

    Interesting. The first thing any user should be taught (after switching on and logging in/out) is the man command. Were you not?

    Of course you may use a platform which doesn't feature this brilliant command, but that's OK because every perl user's first lesson should include a reference to perldoc. Did yours?

    The thing is that even if your lessons did not include mention of these 2 fundamental commands, your favourite search engine should have helped.

    You'll notice that the first result there comes straight back here to perlmonks. Further, the second is the page to which boftx linked. Both are excellent resources.

    It would be my recommendation that you take the time to familiarise yourself with man and perldoc and get to grips with the query syntax of your favourite search engine. That way many answers can be found and much time saved.

Re^3: Can not get the same output from $dbh->do and $dbh->prepare
by boftx (Deacon) on May 25, 2014 at 03:41 UTC

    The link just worked for me, but then again, CPAN has been a bit flaky lately.

    That said, here is the wording from the relevant section:

    do $rows = $dbh->do($statement) or die $dbh->errstr; $rows = $dbh->do($statement, \%attr) or die $dbh->errstr; $rows = $dbh->do($statement, \%attr, @bind_values) or die ... Prepare and execute a single statement. Returns the number of rows aff +ected or undef on error. A return value of -1 means the number of row +s is not known, not applicable, or not available. This method is typically most useful for non-SELECT statements that ei +ther cannot be prepared in advance (due to a limitation of the driver +) or do not need to be executed repeatedly. It should not be used for + SELECT statements because it does not return a statement handle (so +you can't fetch any data).
    The key to using do is that it can only return the number of row affected by an operation. This makes it ideal for INSERT, UPDATE and DELETE, but it simply can't do what you want when it comes to a SELECT statement.

    Sorry if the first post came across as a bit harsh, I should have put a smiley in there somewhere. Now that you beginning your endeavor to grok "DBI" you should probably a browser window open to the CPAN docs for it constantly. Hell, I still go back and check details on calls.

    It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.

      To: boftx

      I want to say sorry to, my message was intended to be offensive, on the contrariwise I appreciate the time of each person who spends to assist beginners like me. To be 100% honest I had to read it twice to understand the meaning of do and prepare, well I guess lately I am pushing my self to much and I need to get some sleep eventually this might give me a more clear point of view.

      Again I ought to say thank you, and my apologies if some how I offended you.

      BR, Thanos

      Seeking for Perl wisdom...on the process...not there...yet!

        No problems! No offense was taken. I read your reply and thought I probably came off a bit more harsh than I normally do. The people I work with have gotten use to me being a bit of an arrogant prick. :)

        It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.