1. 25 11月, 2014 1 次提交
  2. 11 11月, 2014 1 次提交
  3. 03 11月, 2014 1 次提交
  4. 21 10月, 2014 1 次提交
    • C
      Remove duplicate 'select' database statement · ec981aa1
      claudiob 提交于
      The `select` method has the same definition in almost all database
      adapters, so it can be moved from the database-specific adapters
      (PostgreSQl, MySQL, SQLite) to the abstract `database_statement`:
      
      ```ruby
      def select(sql, name = nil, binds = [])
        exec_query(sql, name, binds)
      end
      ```
      
      ---
      
      More details about this commit: the only two DB-specific adapters
      that have a different definition of `select` are MySQLAdapter and
      MySQL2Adapter.
      
      In MySQLAdapter, `select` invokes `exec_query(sql, name, binds)`, so
      calling `super` achieves the same goal with less repetition.
      
      In MySQL2Adapter, `select` invokes `exec_query(sql, name)`, that is,
      it does not pass the `binds` parameter like other methods do. However,
      [MySQL2Adapter's `exec_query`](https://github.com/rails/rails/blob/74a527cc63ef56f3d0a42cf638299958dc7cb08c/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb#L228L231)
      works exactly the same whether this parameters is passed or not, so the output
      does not change:
      
      ```ruby
      def exec_query(sql, name = 'SQL', binds = [])
        result = execute(sql, name)
        ActiveRecord::Result.new(result.fields, result.to_a)
      end
      ```
      ec981aa1
  5. 09 9月, 2014 1 次提交
  6. 05 9月, 2014 1 次提交
  7. 26 7月, 2014 1 次提交
  8. 11 7月, 2014 1 次提交
  9. 07 7月, 2014 1 次提交
  10. 06 7月, 2014 1 次提交
  11. 05 7月, 2014 1 次提交
  12. 01 7月, 2014 1 次提交
  13. 03 6月, 2014 1 次提交
  14. 29 5月, 2014 1 次提交
  15. 21 5月, 2014 1 次提交
    • S
      Replace `type_cast` case statement with delegation · e781aa31
      Sean Griffin 提交于
      All subclasses of column were now delegating `type_cast` to their
      injected type object. We can remove the overriding methods, and
      generalize it on the `Column` class itself. This also enabled us to
      remove several column classes completely, as they no longer had any
      meaningful behavior of their own.
      e781aa31
  16. 20 5月, 2014 2 次提交
    • S
      36fde2b7
    • S
      Remove :timestamp column type · d0f8c46e
      Sean Griffin 提交于
      The `:timestamp` type for columns is unused. All database adapters treat
      them as the same database type. All code in `ActiveRecord` which changes
      its behavior based on the column's type acts the same in both cases.
      However, when the type is passed to code that checks for the `:datetime`
      type, but not `:timestamp` (such as XML serialization), the result is
      unexpected behavior.
      
      Existing schema definitions will continue to work, and the `timestamp`
      type is transparently aliased to `datetime`.
      d0f8c46e
  17. 18 5月, 2014 1 次提交
    • S
      Add a type object to Column constructor · 4bd5dffc
      Sean Griffin 提交于
      Part of #15134. In order to perform typecasting polymorphically, we need
      to add another argument to the constructor. The order was chosen to
      match the `oid_type` on `PostgreSQLColumn`.
      4bd5dffc
  18. 04 5月, 2014 1 次提交
  19. 18 4月, 2014 1 次提交
  20. 10 4月, 2014 3 次提交
  21. 04 4月, 2014 1 次提交
    • Y
      PostgreSQL and SQLite, remove varchar limit. [Vladimir Sazhin & Toms Mikoss & Yves Senn] · f4226c3a
      Yves Senn 提交于
      There is no reason for the PG adapter to have a default limit of 255 on :string
      columns. See this snippet from the PG docs:
      
          Tip: There is no performance difference among these three types, apart
          from increased storage space when using the blank-padded type, and a
          few extra CPU cycles to check the length when storing into a
          length-constrained column. While character(n) has performance
          advantages in some other database systems, there is no such advantage
          in PostgreSQL; in fact character(n) is usually the slowest of the
          three because of its additional storage costs. In most situations text
          or character varying should be used instead.
      f4226c3a
  22. 02 4月, 2014 1 次提交
    • J
      Clarify 'database does not exist' message and implementation. · 9aa7c25c
      Jeremy Kemper 提交于
      * Clarify what the situation is and what to do.
      * Advise loading schema using `rake db:setup` instead of migrating.
      * Use a rescue in the initializer rather than extending the error
        message in-place.
      * Preserve the original backtrace of other errors by using `raise`
        rather than raising again with `raise error`.
      
      References 0ec45cd1
      9aa7c25c
  23. 14 2月, 2014 1 次提交
  24. 31 1月, 2014 1 次提交
    • A
      Fix regression on `.select_*` methods. · b7fcad8f
      Arthur Neves 提交于
      This was a common pattern:
      ```
      query = author.posts.select(:title)
      connection.select_one(query)
      ```
      
      However `.select` returns a ActiveRecord::AssociationRelation, which has
      the bind information, so we can use that to get the right sql query.
      
      Also fix select_rows on postgress and sqlite3 that were not using the binds
      
      [fixes #7538]
      [fixes #12017]
      [related #13731]
      [related #12056]
      b7fcad8f
  25. 18 1月, 2014 1 次提交
  26. 16 1月, 2014 1 次提交
  27. 15 1月, 2014 1 次提交
  28. 14 1月, 2014 2 次提交
  29. 24 12月, 2013 1 次提交
  30. 12 12月, 2013 1 次提交
  31. 12 11月, 2013 2 次提交
  32. 10 11月, 2013 1 次提交
  33. 09 11月, 2013 1 次提交
    • Y
      log bind variables after they were type casted. · 97f0d9a0
      Yves Senn 提交于
      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]]
      97f0d9a0
  34. 14 10月, 2013 1 次提交
  35. 30 9月, 2013 1 次提交