<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Class: ActiveRecord::ConnectionAdapters::MysqlAdapter</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> <script type="text/javascript"> // <![CDATA[ function popupCode( url ) { window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") } function toggleCode( id ) { if ( document.getElementById ) elem = document.getElementById( id ); else if ( document.all ) elem = eval( "document.all." + id ); else return false; elemStyle = elem.style; if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else { elemStyle.display = "none" } return true; } // Make codeblocks hidden by default document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) // ]]> </script> </head> <body> <div id="classHeader"> <table class="header-table"> <tr class="top-aligned-row"> <td><strong>Class</strong></td> <td class="class-name-in-header">ActiveRecord::ConnectionAdapters::MysqlAdapter</td> </tr> <tr class="top-aligned-row"> <td><strong>In:</strong></td> <td> <a href="../../../files/lib/active_record/connection_adapters/mysql_adapter_rb.html"> lib/active_record/connection_adapters/mysql_adapter.rb </a> <br /> </td> </tr> <tr class="top-aligned-row"> <td><strong>Parent:</strong></td> <td> <a href="AbstractAdapter.html"> AbstractAdapter </a> </td> </tr> </table> </div> <!-- banner header --> <div id="bodyContent"> <div id="contextContent"> <div id="description"> <p> The MySQL adapter will work with both Ruby/MySQL, which is a Ruby-based MySQL adapter that comes bundled with Active Record, and with the faster C-based MySQL/Ruby adapter (available both as a gem and from <a href="http://www.tmtm.org/en/mysql/ruby">www.tmtm.org/en/mysql/ruby</a>/). </p> <p> Options: </p> <ul> <li><tt>:host</tt> - Defaults to "localhost". </li> <li><tt>:port</tt> - Defaults to 3306. </li> <li><tt>:socket</tt> - Defaults to "/tmp/mysql.sock". </li> <li><tt>:username</tt> - Defaults to "root" </li> <li><tt>:password</tt> - Defaults to nothing. </li> <li><tt>:database</tt> - The name of the database. No default, must be provided. </li> <li><tt>:encoding</tt> - (Optional) Sets the client encoding by executing "SET NAMES <encoding>" after connection. </li> <li><tt>:reconnect</tt> - Defaults to false (See MySQL documentation: <a href="http://dev.mysql.com/doc/refman/5.0/en/auto-reconnect.html">dev.mysql.com/doc/refman/5.0/en/auto-reconnect.html</a>). </li> <li><tt>:sslca</tt> - Necessary to use MySQL with an SSL connection. </li> <li><tt>:sslkey</tt> - Necessary to use MySQL with an SSL connection. </li> <li><tt>:sslcert</tt> - Necessary to use MySQL with an SSL connection. </li> <li><tt>:sslcapath</tt> - Necessary to use MySQL with an SSL connection. </li> <li><tt>:sslcipher</tt> - Necessary to use MySQL with an SSL connection. </li> </ul> </div> </div> <div id="method-list"> <h3 class="section-bar">Methods</h3> <div class="name-list"> <a href="#M000252">active?</a> <a href="#M000270">case_sensitive_equality_operator</a> <a href="#M000266">change_column_null</a> <a href="#M000262">charset</a> <a href="#M000263">collation</a> <a href="#M000260">create_database</a> <a href="#M000257">create_savepoint</a> <a href="#M000261">current_database</a> <a href="#M000254">disconnect!</a> <a href="#M000264">drop_table</a> <a href="#M000271">limited_update_conditions</a> <a href="#M000248">new</a> <a href="#M000269">primary_key</a> <a href="#M000249">quote</a> <a href="#M000251">quoted_false</a> <a href="#M000250">quoted_true</a> <a href="#M000253">reconnect!</a> <a href="#M000259">release_savepoint</a> <a href="#M000265">rename_table</a> <a href="#M000255">reset!</a> <a href="#M000258">rollback_to_savepoint</a> <a href="#M000256">select_rows</a> <a href="#M000268">show_variable</a> <a href="#M000267">type_to_sql</a> </div> </div> </div> <!-- if includes --> <div id="section"> <div id="constants-list"> <h3 class="section-bar">Constants</h3> <div class="name-list"> <table summary="Constants"> <tr class="top-aligned-row context-row"> <td class="context-item-name">ADAPTER_NAME</td> <td>=</td> <td class="context-item-value">'MySQL'.freeze</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">LOST_CONNECTION_ERROR_MESSAGES</td> <td>=</td> <td class="context-item-value">[ "Server shutdown in progress", "Broken pipe", "Lost connection to MySQL server during query", "MySQL server has gone away" ]</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">QUOTED_FALSE</td> <td>=</td> <td class="context-item-value">'1'.freeze, '0'.freeze</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">NATIVE_DATABASE_TYPES</td> <td>=</td> <td class="context-item-value">{ :primary_key => "int(11) DEFAULT NULL auto_increment PRIMARY KEY".freeze, :string => { :name => "varchar", :limit => 255 }, :text => { :name => "text" }, :integer => { :name => "int", :limit => 4 }, :float => { :name => "float" }, :decimal => { :name => "decimal" }, :datetime => { :name => "datetime" }, :timestamp => { :name => "datetime" }, :time => { :name => "time" }, :date => { :name => "date" }, :binary => { :name => "blob" }, :boolean => { :name => "tinyint", :limit => 1 }</td> </tr> </table> </div> </div> <!-- if method_list --> <div id="methods"> <h3 class="section-bar">Public Class methods</h3> <div id="method-M000248" class="method-detail"> <a name="M000248"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000248.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000248.html');return false;"> <span class="method-name">new</span><span class="method-args">(connection, logger, connection_options, config)</span> </a> </div> <div class="method-description"> </div> </div> <h3 class="section-bar">Public Instance methods</h3> <div id="method-M000252" class="method-detail"> <a name="M000252"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000252.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000252.html');return false;"> <span class="method-name">active?</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> CONNECTION MANAGEMENT ==================================== </p> </div> </div> <div id="method-M000270" class="method-detail"> <a name="M000270"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000270.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000270.html');return false;"> <span class="method-name">case_sensitive_equality_operator</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000266" class="method-detail"> <a name="M000266"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000266.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000266.html');return false;"> <span class="method-name">change_column_null</span><span class="method-args">(table_name, column_name, null, default = nil)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000262" class="method-detail"> <a name="M000262"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000262.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000262.html');return false;"> <span class="method-name">charset</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Returns the database character set. </p> </div> </div> <div id="method-M000263" class="method-detail"> <a name="M000263"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000263.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000263.html');return false;"> <span class="method-name">collation</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Returns the database <a href="MysqlAdapter.html#M000263">collation</a> strategy. </p> </div> </div> <div id="method-M000260" class="method-detail"> <a name="M000260"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000260.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000260.html');return false;"> <span class="method-name">create_database</span><span class="method-args">(name, options = {})</span> </a> </div> <div class="method-description"> <p> Create a <a href="MysqlAdapter.html#M000248">new</a> MySQL database with optional <tt>:<a href="MysqlAdapter.html#M000262">charset</a></tt> and <tt>:<a href="MysqlAdapter.html#M000263">collation</a></tt>. Charset defaults to utf8. </p> <p> Example: </p> <pre> create_database 'charset_test', :charset => 'latin1', :collation => 'latin1_bin' create_database 'matt_development' create_database 'matt_development', :charset => :big5 </pre> </div> </div> <div id="method-M000257" class="method-detail"> <a name="M000257"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000257.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000257.html');return false;"> <span class="method-name">create_savepoint</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000261" class="method-detail"> <a name="M000261"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000261.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000261.html');return false;"> <span class="method-name">current_database</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000254" class="method-detail"> <a name="M000254"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000254.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000254.html');return false;"> <span class="method-name">disconnect!</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000264" class="method-detail"> <a name="M000264"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000264.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000264.html');return false;"> <span class="method-name">drop_table</span><span class="method-args">(table_name, options = {})</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000271" class="method-detail"> <a name="M000271"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000271.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000271.html');return false;"> <span class="method-name">limited_update_conditions</span><span class="method-args">(where_sql, quoted_table_name, quoted_primary_key)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000269" class="method-detail"> <a name="M000269"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000269.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000269.html');return false;"> <span class="method-name">primary_key</span><span class="method-args">(table)</span> </a> </div> <div class="method-description"> <p> Returns just a table‘s primary key </p> </div> </div> <div id="method-M000249" class="method-detail"> <a name="M000249"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000249.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000249.html');return false;"> <span class="method-name">quote</span><span class="method-args">(value, column = nil)</span> </a> </div> <div class="method-description"> <p> QUOTING ================================================== </p> </div> </div> <div id="method-M000251" class="method-detail"> <a name="M000251"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000251.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000251.html');return false;"> <span class="method-name">quoted_false</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000250" class="method-detail"> <a name="M000250"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000250.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000250.html');return false;"> <span class="method-name">quoted_true</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000253" class="method-detail"> <a name="M000253"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000253.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000253.html');return false;"> <span class="method-name">reconnect!</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000259" class="method-detail"> <a name="M000259"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000259.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000259.html');return false;"> <span class="method-name">release_savepoint</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000265" class="method-detail"> <a name="M000265"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000265.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000265.html');return false;"> <span class="method-name">rename_table</span><span class="method-args">(table_name, new_name)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000255" class="method-detail"> <a name="M000255"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000255.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000255.html');return false;"> <span class="method-name">reset!</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000258" class="method-detail"> <a name="M000258"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000258.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000258.html');return false;"> <span class="method-name">rollback_to_savepoint</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000256" class="method-detail"> <a name="M000256"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000256.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000256.html');return false;"> <span class="method-name">select_rows</span><span class="method-args">(sql, name = nil)</span> </a> </div> <div class="method-description"> <p> DATABASE STATEMENTS ====================================== </p> </div> </div> <div id="method-M000268" class="method-detail"> <a name="M000268"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000268.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000268.html');return false;"> <span class="method-name">show_variable</span><span class="method-args">(name)</span> </a> </div> <div class="method-description"> <p> SHOW VARIABLES LIKE ‘name‘ </p> </div> </div> <div id="method-M000267" class="method-detail"> <a name="M000267"></a> <div class="method-heading"> <a href="MysqlAdapter.src/M000267.html" target="Code" class="method-signature" onclick="popupCode('MysqlAdapter.src/M000267.html');return false;"> <span class="method-name">type_to_sql</span><span class="method-args">(type, limit = nil, precision = nil, scale = nil)</span> </a> </div> <div class="method-description"> <p> Maps logical Rails types to MySQL-specific data types. </p> </div> </div> </div> </div> <div id="validator-badges"> <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> </div> </body> </html>