List:MySQL and Perl« Previous MessageNext Message »
From:Patrick Galbraith Date:August 7 2004 8:46pm
Subject:Re: DBD::mysql and mysql_use_result
View as plain text  
On Aug 6, 2004, at 9:19 AM, Alan Burlison wrote:

> Alexey Stroganov wrote:
>
>> It was already implemented in my tree with the same behaviour as for 
>> 'mysql_server_prepare' attribute:
>>  - attribute 'mysql_use_result' on dbh level, this allows to
>>    enable/disable mode for all new statements:
>>      - DBI->connect("DBI:mysql:test;mysql_use_result=1", "root", "");
>>      - $dbh->{'mysql_use_result'}=0; #disable
>>        $dbh->{'mysql_use_result'}=1; #enable
>>      When new sth is created we set default value of attribute      
>> 'mysql_use_result' from $dbh. One can override the default      
>> value:
>>          - $sth=$dbh->prepare(statement, {'mysql_use_result' => 1});
>>      - $sth->{'mysql_use_result'}=0; #disable
>>        $sth->{'mysql_use_result'}=1; #enable
>
> Oooh, I'd *love* a copy, pretty please ;-)
>
> What does 'mysql_server_prepare' do BTW, I can't find it in the docs?

It's not public yet, and therefore not documented as such, but 
mysql_server_prepare enables the server to prepare the statement as 
opposed to emulating the prepare in the driver. Prior to mysql 4.1, 
there was no support for server prepare statements, so it was up to the 
driver to parse placeholders and then substitute values upon execution. 
The current DBD::mysql that is public does this. With the latest 
changes, the server will prepare the statement. This can bring some 
performance increase, especially if you are dealing with a lot of 
inserts.

As far as use_result vs. store result, the server prepared statements 
(mysql 4.1 and greater) will always use 'store result', as this has no 
affect on performance as per the API documentation.

I will make my OSCON slides public which explain how this works, and 
also be glad to answer anyone's questions about this.

regards

Patrick
>
> -- 
> Alan Burlison
> --
>
Patrick Galbraith Senior Software Developer
patg@stripped http://www.mysql.com

"Whatever action a great man performs, common men follow. Whatever 
standards he sets by exemplary acts, all the world pursues"  -- 
Bhagavad Gita

Thread
DBD::mysql and mysql_use_resultAlan Burlison6 Aug
  • Re: DBD::mysql and mysql_use_resultJochen Wiedmann6 Aug
    • Re: DBD::mysql and mysql_use_resultPatrick Galbraith9 Aug
  • Re: DBD::mysql and mysql_use_resultRudy Lippan6 Aug
  • Re: DBD::mysql and mysql_use_resultTim Bunce6 Aug
Re: DBD::mysql and mysql_use_resultAlan Burlison6 Aug
  • Re: DBD::mysql and mysql_use_resultPatrick Galbraith9 Aug
    • Re: DBD::mysql and mysql_use_resultRudy Lippan10 Aug
      • Re: DBD::mysql and mysql_use_resultTim Bunce12 Aug
        • Re: DBD::mysql and mysql_use_resultAlan Burlison14 Aug
          • Re: DBD::mysql and mysql_use_resultTim Bunce17 Aug
      • Re: DBD::mysql and mysql_use_resultPatrick Galbraith18 Aug
Re: DBD::mysql and mysql_use_resultTim Bunce7 Aug
  • Re: DBD::mysql and mysql_use_resultPatrick Galbraith9 Aug
Re: DBD::mysql and mysql_use_resultAlan Burlison9 Aug