<?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::Column</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::Column</td> </tr> <tr class="top-aligned-row"> <td><strong>In:</strong></td> <td> <a href="../../../files/lib/active_record/connection_adapters/abstract/schema_definitions_rb.html"> lib/active_record/connection_adapters/abstract/schema_definitions.rb </a> <br /> </td> </tr> <tr class="top-aligned-row"> <td><strong>Parent:</strong></td> <td> Object </td> </tr> </table> </div> <!-- banner header --> <div id="bodyContent"> <div id="contextContent"> <div id="description"> <p> An abstract definition of a column in a table. </p> </div> </div> <div id="method-list"> <h3 class="section-bar">Methods</h3> <div class="name-list"> <a href="#M000192">binary_to_string</a> <a href="#M000190">extract_default</a> <a href="#M000203">fallback_string_to_date</a> <a href="#M000204">fallback_string_to_time</a> <a href="#M000201">fast_string_to_date</a> <a href="#M000202">fast_string_to_time</a> <a href="#M000185">has_default?</a> <a href="#M000189">human_name</a> <a href="#M000186">klass</a> <a href="#M000198">microseconds</a> <a href="#M000182">new</a> <a href="#M000199">new_date</a> <a href="#M000200">new_time</a> <a href="#M000184">number?</a> <a href="#M000191">string_to_binary</a> <a href="#M000193">string_to_date</a> <a href="#M000195">string_to_dummy_time</a> <a href="#M000194">string_to_time</a> <a href="#M000183">text?</a> <a href="#M000187">type_cast</a> <a href="#M000188">type_cast_code</a> <a href="#M000196">value_to_boolean</a> <a href="#M000197">value_to_decimal</a> </div> </div> </div> <!-- if includes --> <div id="section"> <div id="class-list"> <h3 class="section-bar">Classes and Modules</h3> Module <a href="Column/Format.html" class="link">ActiveRecord::ConnectionAdapters::Column::Format</a><br /> </div> <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">TRUE_VALUES</td> <td>=</td> <td class="context-item-value">[true, 1, '1', 't', 'T', 'true', 'TRUE'].to_set</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">FALSE_VALUES</td> <td>=</td> <td class="context-item-value">[false, 0, '0', 'f', 'F', 'false', 'FALSE'].to_set</td> </tr> </table> </div> </div> <div id="attribute-list"> <h3 class="section-bar">Attributes</h3> <div class="name-list"> <table> <tr class="top-aligned-row context-row"> <td class="context-item-name">default</td> <td class="context-item-value"> [R] </td> <td class="context-item-desc"></td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">limit</td> <td class="context-item-value"> [R] </td> <td class="context-item-desc"></td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">name</td> <td class="context-item-value"> [R] </td> <td class="context-item-desc"></td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">null</td> <td class="context-item-value"> [R] </td> <td class="context-item-desc"></td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">precision</td> <td class="context-item-value"> [R] </td> <td class="context-item-desc"></td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">primary</td> <td class="context-item-value"> [RW] </td> <td class="context-item-desc"></td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">scale</td> <td class="context-item-value"> [R] </td> <td class="context-item-desc"></td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">sql_type</td> <td class="context-item-value"> [R] </td> <td class="context-item-desc"></td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">type</td> <td class="context-item-value"> [R] </td> <td class="context-item-desc"></td> </tr> </table> </div> </div> <!-- if method_list --> <div id="methods"> <h3 class="section-bar">Public Class methods</h3> <div id="method-M000192" class="method-detail"> <a name="M000192"></a> <div class="method-heading"> <a href="Column.src/M000192.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000192.html');return false;"> <span class="method-name">binary_to_string</span><span class="method-args">(value)</span> </a> </div> <div class="method-description"> <p> Used to convert from BLOBs to Strings </p> </div> </div> <div id="method-M000182" class="method-detail"> <a name="M000182"></a> <div class="method-heading"> <a href="Column.src/M000182.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000182.html');return false;"> <span class="method-name">new</span><span class="method-args">(name, default, sql_type = nil, null = true)</span> </a> </div> <div class="method-description"> <p> Instantiates a <a href="Column.html#M000182">new</a> column in the table. </p> <p> <tt>name</tt> is the column‘s name, such as <tt>supplier_id</tt> in <tt>supplier_id int(11)</tt>. <tt>default</tt> is the type-casted default value, such as <tt><a href="Column.html#M000182">new</a></tt> in <tt>sales_stage varchar(20) default ‘<a href="Column.html#M000182">new</a>‘</tt>. <tt>sql_type</tt> is only used to extract the column‘s length, if necessary. For example +60+ in <tt>company_name varchar(60)</tt>. <tt>null</tt> determines if this column allows <tt>NULL</tt> values. </p> </div> </div> <div id="method-M000191" class="method-detail"> <a name="M000191"></a> <div class="method-heading"> <a href="Column.src/M000191.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000191.html');return false;"> <span class="method-name">string_to_binary</span><span class="method-args">(value)</span> </a> </div> <div class="method-description"> <p> Used to convert from Strings to BLOBs </p> </div> </div> <div id="method-M000193" class="method-detail"> <a name="M000193"></a> <div class="method-heading"> <a href="Column.src/M000193.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000193.html');return false;"> <span class="method-name">string_to_date</span><span class="method-args">(string)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000195" class="method-detail"> <a name="M000195"></a> <div class="method-heading"> <a href="Column.src/M000195.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000195.html');return false;"> <span class="method-name">string_to_dummy_time</span><span class="method-args">(string)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000194" class="method-detail"> <a name="M000194"></a> <div class="method-heading"> <a href="Column.src/M000194.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000194.html');return false;"> <span class="method-name">string_to_time</span><span class="method-args">(string)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000196" class="method-detail"> <a name="M000196"></a> <div class="method-heading"> <a href="Column.src/M000196.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000196.html');return false;"> <span class="method-name">value_to_boolean</span><span class="method-args">(value)</span> </a> </div> <div class="method-description"> <p> convert something to a boolean </p> </div> </div> <div id="method-M000197" class="method-detail"> <a name="M000197"></a> <div class="method-heading"> <a href="Column.src/M000197.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000197.html');return false;"> <span class="method-name">value_to_decimal</span><span class="method-args">(value)</span> </a> </div> <div class="method-description"> <p> convert something to a BigDecimal </p> </div> </div> <h3 class="section-bar">Protected Class methods</h3> <div id="method-M000203" class="method-detail"> <a name="M000203"></a> <div class="method-heading"> <a href="Column.src/M000203.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000203.html');return false;"> <span class="method-name">fallback_string_to_date</span><span class="method-args">(string)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000204" class="method-detail"> <a name="M000204"></a> <div class="method-heading"> <a href="Column.src/M000204.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000204.html');return false;"> <span class="method-name">fallback_string_to_time</span><span class="method-args">(string)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000201" class="method-detail"> <a name="M000201"></a> <div class="method-heading"> <a href="Column.src/M000201.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000201.html');return false;"> <span class="method-name">fast_string_to_date</span><span class="method-args">(string)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000202" class="method-detail"> <a name="M000202"></a> <div class="method-heading"> <a href="Column.src/M000202.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000202.html');return false;"> <span class="method-name">fast_string_to_time</span><span class="method-args">(string)</span> </a> </div> <div class="method-description"> <p> Doesn‘t handle time zones. </p> </div> </div> <div id="method-M000198" class="method-detail"> <a name="M000198"></a> <div class="method-heading"> <a href="Column.src/M000198.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000198.html');return false;"> <span class="method-name">microseconds</span><span class="method-args">(time)</span> </a> </div> <div class="method-description"> <p> ‘0.123456’ -> 123456 ‘1.123456’ -> 123456 </p> </div> </div> <div id="method-M000199" class="method-detail"> <a name="M000199"></a> <div class="method-heading"> <a href="Column.src/M000199.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000199.html');return false;"> <span class="method-name">new_date</span><span class="method-args">(year, mon, mday)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000200" class="method-detail"> <a name="M000200"></a> <div class="method-heading"> <a href="Column.src/M000200.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000200.html');return false;"> <span class="method-name">new_time</span><span class="method-args">(year, mon, mday, hour, min, sec, microsec)</span> </a> </div> <div class="method-description"> </div> </div> <h3 class="section-bar">Public Instance methods</h3> <div id="method-M000190" class="method-detail"> <a name="M000190"></a> <div class="method-heading"> <a href="Column.src/M000190.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000190.html');return false;"> <span class="method-name">extract_default</span><span class="method-args">(default)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000185" class="method-detail"> <a name="M000185"></a> <div class="method-heading"> <a href="Column.src/M000185.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000185.html');return false;"> <span class="method-name">has_default?</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000189" class="method-detail"> <a name="M000189"></a> <div class="method-heading"> <a href="Column.src/M000189.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000189.html');return false;"> <span class="method-name">human_name</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Returns the human name of the column name. </p> <h5>Examples</h5> <pre> Column.new('sales_stage', ...).human_name # => 'Sales stage' </pre> </div> </div> <div id="method-M000186" class="method-detail"> <a name="M000186"></a> <div class="method-heading"> <a href="Column.src/M000186.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000186.html');return false;"> <span class="method-name">klass</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Returns the Ruby class that corresponds to the abstract data type. </p> </div> </div> <div id="method-M000184" class="method-detail"> <a name="M000184"></a> <div class="method-heading"> <a href="Column.src/M000184.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000184.html');return false;"> <span class="method-name">number?</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Returns <tt>true</tt> if the column is either of type integer, float or decimal. </p> </div> </div> <div id="method-M000183" class="method-detail"> <a name="M000183"></a> <div class="method-heading"> <a href="Column.src/M000183.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000183.html');return false;"> <span class="method-name">text?</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Returns <tt>true</tt> if the column is either of type string or text. </p> </div> </div> <div id="method-M000187" class="method-detail"> <a name="M000187"></a> <div class="method-heading"> <a href="Column.src/M000187.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000187.html');return false;"> <span class="method-name">type_cast</span><span class="method-args">(value)</span> </a> </div> <div class="method-description"> <p> Casts value (which is a String) to an appropriate instance. </p> </div> </div> <div id="method-M000188" class="method-detail"> <a name="M000188"></a> <div class="method-heading"> <a href="Column.src/M000188.html" target="Code" class="method-signature" onclick="popupCode('Column.src/M000188.html');return false;"> <span class="method-name">type_cast_code</span><span class="method-args">(var_name)</span> </a> </div> <div class="method-description"> </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>