vendor/plugins/ar-extensions-0.7.0a/lib/ar-extensions/adapters/abstract_adapter.rb
# +sql+ can be a single string or an array. If it is an array all 
# elements that are in position >= 1 will be appended to the final SQL.
+sql+ can be a single string or an array. If it is an array all
elements that are in position >= 1 will be appended to the final SQL.
+ sql + can be a single string or an array . If it is an array all elements that are in position > = 1 will be appended to the final SQL .
def insert_many( sql, values, *args ) 
        number_of_inserts = 0
        base_sql,post_sql = if sql.is_a?( String )
          [ sql, '' ]
        elsif sql.is_a?( Array )
          [ sql.shift, sql.join( ' ' ) ]
        end
        sql_size = QUERY_OVERHEAD + base_sql.size + post_sql.size 
        values_in_bytes = self.class.sum_sizes( *values )
        comma_separated_bytes = values.size-1
        total_bytes = sql_size + values_in_bytes + comma_separated_bytes
        max = max_allowed_packet
        if NO_MAX_PACKET == max or total_bytes < max
          number_of_inserts += 1
          sql2insert = base_sql + values.join( ',' ) + post_sql
          insert( sql2insert, *args )
        else
          value_sets = self.class.get_insert_value_sets( values, sql_size, max )
          value_sets.each do |values|
            number_of_inserts += 1
            sql2insert = base_sql + values.join( ',' ) + post_sql
            insert( sql2insert, *args )
          end
        end        
        number_of_inserts
      end
def insert_many ( sql , values , * args ) number_of_inserts = 0 base_sql , post_sql = if sql . is_a? ( String ) [ sql , '' ] elsif sql . is_a? ( Array ) [ sql . shift , sql . join ( ' ' ) ] end sql_size = QUERY_OVERHEAD + base_sql . size + post_sql . size values_in_bytes = self . class . sum_sizes ( * values ) comma_separated_bytes = values . size - 1 total_bytes = sql_size + values_in_bytes + comma_separated_bytes max = max_allowed_packet if NO_MAX_PACKET == max or total_bytes < max number_of_inserts += 1 sql2insert = base_sql + values . join ( ',' ) + post_sql insert ( sql2insert , * args ) else value_sets = self . class . get_insert_value_sets ( values , sql_size , max ) value_sets . each do | values | number_of_inserts += 1 sql2insert = base_sql + values . join ( ',' ) + post_sql insert ( sql2insert , * args ) end end number_of_inserts end
+sql+ can be a single string or an array.
+ sql + can be a single string or an array .
# :nodoc: # the number of inserts default # the number of bytes the requested insert statement values will take up # the number of bytes (commas) it will take to comma separate our values # the total number of bytes required if this statement is one statement # if we can insert it all as one statement
sql
<not_specific>
values
<not_specific>
args
<not_specific>