…ting for identity
…pters The fix was already in earlier this month, but this change is required so the model will check for an accurate number of rows. Since do/mysql is the only adapter that doesn't support it, just move the override to the adapter.
This should make it easy to grep, since most people looking to disable the json_class entry will grep for json_class and not JSON.create_id.
This commit gives you two separate ways to disable transaction use in migrations. The recommended way to disable them is on a per migration basis by calling no_transaction inside the Sequel.migration block. You can also either disable them completely at the migrator level by passing a :use_transactions=>false option to Migrator.run. Likewise, you can force the use of transactions even when no_transaction is set by using :use_transactions=>true. While here, add the ability to choose the migrator class to use by specifying it directly instead of having Migrator.run guess it. For example, to force use of the TimestampMigrator, you would call TimestampMigrator.run.
With this extension, you just pass a hash of connection options that get merged into the default options. It's designed to work well with the server block plugin, making it possible for to use arbitrary servers easily, such as per-request in a web framework. As you can't be sure if the arbitrary server will be needed again do not cache the connection, disconnect as soon as the connection is finished being used.
…ck to specific shards Multiple people have asked for this over the years, but I only recently thought of a good way to do this. This adds some slight refactoring to the connection pools to move the code the transforms the given server/shard name into the actual server/shard name into it's own method (named pick_server). The extension then overrides the method so it will use a different default server if one has been defined and no specific shard has been set. To handle nested of blocks, the different default servers are stored in an array (thread-local in the threaded case), which is used as a stack with the current default as the last entry.
… in the mysql2 adapter Thanks to brianmario and tenderlove for this.
…apter This is kind of ugly, as it requires parsing the information out of a string using a regular expression. However, there does not appear to be another way to get the information. Unfortunately, neither do_mysql nor mysql2 appear to offer a way to get an accurate number of rows matched.
…for quoting identifiers The specs set global defaults, which override the defaults used by the mock adapter. So unset the global defaults for the related spec in order to test the appropriate default handling.
http://bugs.mysql.com/bug.php?id=64374 indicates that this bug is not present in 5.5.12, though it is present in 5.5.15. Not sure the exact version it broke in, or when it will be fixed, so just allow for <= 5.5.12 for now.
…f not already set Before, if you did not set the position field manually, you could break the functionality of the plugin, and the requirement to do so was not mentioned in the plugin itself. While here, add a note to the documentation about the race conditions that exist in the plugin.
Before on SQLite, only column values stored with the TEXT/BLOB storage class where typecasted. Column values stored via the INTEGER/REAL storage class were returned as ruby Integer/Float values, and were not subject to typecasting. However, in some cases, you want to convert such values. For example, if you want to store boolean values as 1/0 integers (which SQLite recommends), those values are stored in the INTEGER storage class, and the integer needs to be converted to a boolean. Likewise, if you store date/time/datetime values with the INTEGER/REAL storage classes, they should be returned as Date/Time/SQLTime/DateTime values. Since SQLite recommends that booleans be stored as 1/0, add an integer_booleans setting to SQLite databases that stores the boolean values using integers. Currently, only the native sqlite adapter correctly converts the integers to booleans on retrieval, though. The integer_booleans setting currently defaults to false, but that could possibly change in a newer version of Sequel, so if you care about how booleans are stored, set the desired default manually. Any custom type conversion procs used by the SQLite adapter need to be modified so that they work with both String, Integer, and Float values.
Sequel no longer uses the type_translation method, and I think it will be removed in a future version. Also, the sqlite3-ruby gem got renamed to sqlite3. This code was originally written to provide a better error message for people who used the sqlite3 gem before sqlite3-ruby got renamed, but I don't think it serves a purpose any more.
…now return self This makes it possible to use these methods as part of a method chain. Before, they didn't return a useful value.
…d to modified to account for nan and infinity
The schema name needs to be quoted, and we should be checking the method actually works, not just that it produces the expected SQL.
…MySQL 5.5 (Fixes #437) MySQL 5.5 appears not to like savepoints in prepared transactions, which MySQL 5.1 (and I think 5.0) do not have a problem with. Add an additional method to check the support for savepoint/prepared transactions combination, and set it to false on MySQL 5.5+. While here, only support prepared transactions and savepoints on MySQL 5.0+. I never test on MySQL < 5.0, but I don't think earlier versions support those features.
Using an identifier output method makes the adapter significantly slower, since it has to create a new hash, but at least it still works correctly. There should be no measureable decrease in performance if you don't have an identifier output method.