Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Dec 24, 2013
  1. Richard Schneeman

    Raise NoDatabaseError when db does not exist

    schneems authored
    Building on the work of #13427 this PR adds a helpful error message to the adapters: mysql, mysql2, and sqlite3
Commits on Dec 13, 2013
  1. Kassio Borges

    Fix mysql to support duplicated column names

    kassio authored
    This will fix the [broken
    test](4a26508)
     `test_with_limiting_with_custom_select`.
    
    The query's result was built in a hash with column name as key, if the
    result have a duplicated column name the last value was
    overriding the first one.
Commits on Nov 15, 2013
  1. Aaron Patterson

    Merge pull request #12779 from dougbarth/dont_swallow_exceptions_duri…

    tenderlove authored
    …ng_transactional_statements_in_mysql
    
    Don't swallow exceptions in transctional statements
Commits on Nov 11, 2013
  1. Yves Senn
Commits on Nov 9, 2013
  1. Rafael Mendonça França
  2. Yves Senn

    log bind variables after they were type casted.

    senny authored
    The log output used to be confusing in situation where type casting has
    "unexpected" effects. For example when finding records with a `String`.
    
    BEFORE:
    
    irb(main):002:0> Event.find("im-no-integer")
    D, [2013-11-09T11:10:28.998857 #1706] DEBUG -- :   Event Load (4.5ms)  SELECT "events".* FROM "events" WHERE "events"."id" = $1 LIMIT 1  [["id", "im-no-integer"]]
    
    AFTER:
    
    irb(main):002:0> Event.find("im-no-integer")
    D, [2013-11-09T11:10:28.998857 #1706] DEBUG -- :   Event Load (4.5ms)  SELECT "events".* FROM "events" WHERE "events"."id" = $1 LIMIT 1  [["id", 0]]
Commits on Nov 5, 2013
  1. Doug Barth

    Don't swallow exceptions in transctional statements

    dougbarth authored
    The MySQL connection adapater swallows all StandardError exceptions,
    which includes Mysql::Error and Mysql2::Error. The comment in the
    exception clause claims errors thrown here indicate that transactions
    aren't supported by the server but that isn't necessarily true. It's
    possible the MySQL server has gone away and swallowing a failed commit
    may let the application return a successful response when the data has
    not been saved. Also, replication libraries like Galera require that the
    application handle exceptions thrown at BEGIN/COMMIT.
    
    I'm unable to determine what version of MySQL threw an exception for
    transactional statements. I tried as far back as 3.23.49 with InnoDB
    disabled but BEGIN & COMMIT statements do not throw an error. If there's
    a real case for this logic to continue, we could instead push this
    behavior into a configuration setting.
    
    The exception swallowing has been there since the beginning:
    db045db
Commits on Oct 30, 2013
  1. Yves Senn
Commits on Sep 11, 2013
  1. Rafael Mendonça França

    Remove invalid comment

    rafaelfranca authored
    This is not valid anymore after 08477a6
  2. Rafael Mendonça França

    Check if the SQL is not a prepared statement

    rafaelfranca authored
    When the adapter is with prepared statement disabled and the binds array
    is not empty the connection adapter will try to set the binds values and
    will fail. Now we are checking if the adapter has the prepared statement
    disabled.
    
    Fixes #12023
Commits on Aug 11, 2013
  1. Akira Matsuda

    chmod -x

    amatsuda authored
Commits on Aug 8, 2013
  1. Koichi Sasada
Commits on Aug 5, 2013
  1. Peter Kovacs

    Free result_metadata directly instead of freeing 2nd, redundant call.

    peterkovacs authored
    `result_metadata` returns a new object each time it is called, so calling `result_metadata.free` is essentially a noop.  Instead call `free` directly on the metadata when we're done with it.
Commits on Jul 17, 2013
  1. Yves Senn

    Revert "Merge pull request #11120 from awilliams/ar_mysql2_boolean_qu…

    senny authored
    …oting"
    
    This reverts commit cb1d07e, reversing
    changes made to 754a373.
Commits on Jul 16, 2013
  1. Adam Williams

    Unifies mysql and mysql2 casting of booleans

    awilliams authored
    Using the mysql2 adapter, boolean values were sometimes being incorrectly cast
    to 't' or 'f'. This changes the cast to match the mysql adapter behavior, ie 1 and 0.
Commits on May 16, 2013
  1. Aaron Patterson
Commits on Apr 21, 2013
  1. Vipul A M

    fix typos

    vipulnsward authored
Commits on Mar 30, 2013
  1. Vijay Dev

    Merge branch 'master' of github.com:lifo/docrails

    vijaydev authored
    Conflicts:
    	activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
    	activerecord/test/cases/adapter_test.rb
    	guides/source/testing.md
    
    [ci skip]
Commits on Mar 26, 2013
  1. Vipul A M
Commits on Mar 16, 2013
  1. Francesco Rodríguez
Commits on Feb 24, 2013
  1. Rafael Mendonça França

    Do not type cast all the database url values.

    rafaelfranca authored
    We should only type cast when we need to use.
    
    Related to 4b005fb
Commits on Dec 8, 2012
  1. Aaron Stone

    Session variables for mysql, mysql2, and postgresql adapters can be set

    sodabrew authored
    in the new 'variables:' hash in each database config section in database.yml.
    The key-value pairs of this hash will be sent in a 'SET key = value, ...'
    query on new database connections.
    
    The configure_connection methods from mysql and mysql2 into are
    consolidated into the abstract_mysql base class.
Commits on Nov 19, 2012
  1. Carlos Antonio da Silva
Commits on Nov 18, 2012
  1. Carlos Antonio da Silva
Commits on Oct 19, 2012
  1. Jon Leighton

    The default value of a text/blob in mysql strict mode should be nil

    jonleighton authored
    In non-strict mode it is '', but if someone is in strict mode then we
    should honour the strict semantics.
    
    Also, this removes the need for a completely horrible hack in dirty.rb.
    
    Closes #7780
Commits on Sep 14, 2012
  1. Jon Leighton
Commits on Sep 10, 2012
  1. Toshinori Kajihara
Commits on Aug 21, 2012
  1. Toshinori Kajihara
Commits on Jul 13, 2012
  1. Aaron Patterson
  2. Jeremy Cole Aaron Patterson

    Fixing texts; down to three failing tests.

    jeremycole authored tenderlove committed
    Conflicts:
    	activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
  3. Jeremy Cole Aaron Patterson

    Only use prepared statements when bind variables are present

    jeremycole authored tenderlove committed
    Prepared statements (prepare/execute/close) were being used unnecessarily
    when no bind variables were present, and disabling prepared statement using
    prepared_statements:false was principally broken. While bind variables were
    correctly substituted with prepared_statements:false, the prepared statement
    interface was still used, costing an extra two round trips per query.
    
    In addition to making this behavioral change, I also cleaned up the internals
    of exec_stmt and exec_without_stmt so that they behave the same (calling log
    and constructing the ActiveRecord::Result in the same way).
    
    Moving the check for binds.empty? to exec_query also will mean that several
    code paths explicitly calling exec_without_stmt could be cleaned up to once
    again call exec_query instead. I have also left the check for binds.empty? in
    exec_stmt, since it is not a private method and could be called directly with
    an empty binds array. For the sake of clarity in this patch, I have not made
    those changes.
    
    = The previous behavior =
    
    When issuing a Foo.find(1) with prepared_statements:true, the bind variable
    is present in the prepared query, and execute shows a value passed:
    
        Connect	root@localhost on rails_test
        Query	SET SQL_AUTO_IS_NULL=0
        Statistics
        Query	SHOW FULL FIELDS FROM `foos`
        Query	SHOW TABLES LIKE 'foos'
        Query	SHOW CREATE TABLE `foos`
        Prepare	SELECT  `foos`.* FROM `foos`  WHERE `foos`.`id` = ? LIMIT 1
        Execute	SELECT  `foos`.* FROM `foos`  WHERE `foos`.`id` = 1 LIMIT 1
        Close stmt
        Quit
    
    When issuing a Foo.find(1) with prepared_statements:false, the bind variable
    has already been removed and substituted with the value, but the prepared
    statement interface is used anyway:
    
        Connect	root@localhost on rails_test
        Query	SET SQL_AUTO_IS_NULL=0
        Statistics
        Query	SHOW FULL FIELDS FROM `foos`
        Query	SHOW TABLES LIKE 'foos'
        Query	SHOW CREATE TABLE `foos`
        Prepare	SELECT  `foos`.* FROM `foos`  WHERE `foos`.`id` = 1 LIMIT 1
        Execute	SELECT  `foos`.* FROM `foos`  WHERE `foos`.`id` = 1 LIMIT 1
        Close stmt
        Quit
    
    = With this patch applied =
    
    When issuing a Foo.find(1) with prepared_statements:true, the bind variable
    is present in the prepared query, and execute shows a value passed:
    
        Connect	root@localhost on rails_test
        Query	SET SQL_AUTO_IS_NULL=0
        Statistics
        Query	SHOW FULL FIELDS FROM `foos`
        Query	SHOW TABLES LIKE 'foos'
        Query	SHOW CREATE TABLE `foos`
        Prepare	SELECT  `foos`.* FROM `foos`  WHERE `foos`.`id` = ? LIMIT 1
        Execute	SELECT  `foos`.* FROM `foos`  WHERE `foos`.`id` = 1 LIMIT 1
        Close stmt
        Quit
    
    When issuing a Foo.find(1) with prepared_statements:false, the bind variable
    has been removed and substituted with the value, and the query interface is
    used instead of the prepared statement interface:
    
        Connect	root@localhost on rails_test
        Query	SET SQL_AUTO_IS_NULL=0
        Statistics
        Query	SHOW FULL FIELDS FROM `foos`
        Query	SHOW TABLES LIKE 'foos'
        Query	SHOW CREATE TABLE `foos`
        Query	SELECT  `foos`.* FROM `foos`  WHERE `foos`.`id` = 1 LIMIT 1
        Quit
Commits on May 5, 2012
  1. mipearson
  2. mipearson
Commits on Feb 16, 2012
  1. Aaron Patterson
Commits on Jan 31, 2012
  1. Aaron Patterson
Something went wrong with that request. Please try again.