in reply to Re^5: How to Limit MySql Execution Time?
in thread How to Limit MySql Execution Time?

OK..Fine and Dandy.

But you've not responded to my request of editing my script to show me how to do them.

Here's my script again, kindly edit them:
#!/usr/bin/perl require 'myconfigure.cgi'; $timeout = 5; use DBI; $keywords = "Whether rocking natural-curls, a-short"; print "Content-type: text/html\n\n"; sub do_search { $time1 = time; $dbh=DBI->connect("dbi:mysql:$database:localhost","$username","$pa +ssword"); $keywords_quoted = $dbh ->quote ($keywords); $query="SELECT count(*) FROM $websites_table WHERE MATCH(title) AG +AINST ($keywords_quoted)"; $sth=$dbh->prepare(qq{$query}); $sth->execute(); $total_count = $sth->fetchrow_array (); $sth->finish; $dbh->disconnect ||die("Couldn't disconnect to database!\n"); $time2 = time; $time_ran = $time2 - $time1; } eval { local $SIG{ALRM} = sub { die "alarm\n" }; alarm $timeout; &do_search; alarm 0; }; if($@) { $time2 = time; $time_ran = $time2 - $time1; print "$@, Time Ran: $time_ran, Total Count: $total_count\n"; exit; } print "Time Ran: $time_ran, Total Count: $total_count\n"; exit;

Replies are listed 'Best First'.
Re^7: How to Limit MySql Execution Time?
by BrowserUk (Patriarch) on Dec 22, 2010 at 07:18 UTC
    OK..Fine and Dandy. But you've not responded to my request of editing my script to show me how to do them. Here's my script again, kindly edit them:

    Contact me via the email address on my home node and we can discuss my rates.

    Alternatively, make some effort yourself and then post the code that shows that, along with a description of the problems you are having and maybe someone here will see fit to expend some of their time to assist you.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Contact me via the email address on my home node and we can discuss my rates.

      Thanks, but no thanks.

      First of all, I've a feeling that the method you propose does not work.

      Secondly, you've shown me a script nobody understands and you seem to evade my question when I ask you about it.
        First of all, I've a feeling that the method you propose does not work.

        It will work; it is fairly standard, well known, approach to the problem, straight out of the manual.

        Secondly, you've shown me a script nobody understands

        It is very simple script understood by many. It is mentioned in many manuals, perlfunc in open section, in perlipc, and many books, tutorials and internet postings.

        you seem to evade my question when I ask you about it.

        So sorry, but you did not ask BrowserUk a question, you asked for a favor; a work request -- the kind of favor done in exchange for cash.

        Okay. Good luck then.