sequel 4.3.0 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +34 -0
  3. data/README.rdoc +7 -7
  4. data/Rakefile +2 -2
  5. data/doc/active_record.rdoc +2 -2
  6. data/doc/association_basics.rdoc +21 -7
  7. data/doc/bin_sequel.rdoc +2 -2
  8. data/doc/cheat_sheet.rdoc +2 -1
  9. data/doc/dataset_basics.rdoc +1 -1
  10. data/doc/dataset_filtering.rdoc +1 -1
  11. data/doc/migration.rdoc +2 -2
  12. data/doc/object_model.rdoc +2 -2
  13. data/doc/opening_databases.rdoc +13 -1
  14. data/doc/querying.rdoc +9 -4
  15. data/doc/release_notes/4.4.0.txt +92 -0
  16. data/doc/schema_modification.rdoc +1 -1
  17. data/doc/security.rdoc +2 -2
  18. data/doc/sql.rdoc +3 -3
  19. data/doc/thread_safety.rdoc +1 -1
  20. data/doc/validations.rdoc +1 -1
  21. data/doc/virtual_rows.rdoc +1 -1
  22. data/lib/sequel/adapters/jdbc.rb +85 -19
  23. data/lib/sequel/adapters/jdbc/db2.rb +1 -1
  24. data/lib/sequel/adapters/jdbc/derby.rb +1 -1
  25. data/lib/sequel/adapters/jdbc/h2.rb +2 -2
  26. data/lib/sequel/adapters/jdbc/hsqldb.rb +7 -0
  27. data/lib/sequel/adapters/jdbc/jtds.rb +1 -1
  28. data/lib/sequel/adapters/jdbc/oracle.rb +1 -1
  29. data/lib/sequel/adapters/jdbc/postgresql.rb +34 -3
  30. data/lib/sequel/adapters/jdbc/sqlanywhere.rb +57 -0
  31. data/lib/sequel/adapters/jdbc/sqlserver.rb +2 -2
  32. data/lib/sequel/adapters/oracle.rb +1 -1
  33. data/lib/sequel/adapters/shared/db2.rb +5 -0
  34. data/lib/sequel/adapters/shared/oracle.rb +41 -4
  35. data/lib/sequel/adapters/shared/sqlanywhere.rb +458 -0
  36. data/lib/sequel/adapters/sqlanywhere.rb +177 -0
  37. data/lib/sequel/adapters/utils/emulate_offset_with_row_number.rb +11 -3
  38. data/lib/sequel/core.rb +4 -4
  39. data/lib/sequel/database/connecting.rb +1 -1
  40. data/lib/sequel/database/query.rb +1 -1
  41. data/lib/sequel/database/schema_generator.rb +1 -1
  42. data/lib/sequel/database/schema_methods.rb +2 -2
  43. data/lib/sequel/dataset.rb +1 -1
  44. data/lib/sequel/dataset/actions.rb +2 -0
  45. data/lib/sequel/dataset/graph.rb +1 -1
  46. data/lib/sequel/dataset/prepared_statements.rb +1 -1
  47. data/lib/sequel/dataset/query.rb +37 -16
  48. data/lib/sequel/extensions/constraint_validations.rb +1 -1
  49. data/lib/sequel/extensions/date_arithmetic.rb +2 -2
  50. data/lib/sequel/extensions/migration.rb +1 -1
  51. data/lib/sequel/extensions/mssql_emulate_lateral_with_apply.rb +5 -4
  52. data/lib/sequel/extensions/pg_array.rb +2 -2
  53. data/lib/sequel/extensions/pg_array_ops.rb +2 -2
  54. data/lib/sequel/extensions/pg_hstore.rb +2 -2
  55. data/lib/sequel/extensions/pg_hstore_ops.rb +2 -2
  56. data/lib/sequel/extensions/pg_json.rb +2 -2
  57. data/lib/sequel/extensions/pg_json_ops.rb +2 -2
  58. data/lib/sequel/extensions/pg_range.rb +2 -2
  59. data/lib/sequel/extensions/pg_range_ops.rb +2 -2
  60. data/lib/sequel/extensions/pg_row.rb +2 -2
  61. data/lib/sequel/extensions/pg_row_ops.rb +3 -3
  62. data/lib/sequel/model.rb +1 -1
  63. data/lib/sequel/model/associations.rb +106 -17
  64. data/lib/sequel/model/base.rb +23 -19
  65. data/lib/sequel/plugins/json_serializer.rb +1 -1
  66. data/lib/sequel/plugins/many_through_many.rb +14 -6
  67. data/lib/sequel/plugins/pg_array_associations.rb +28 -0
  68. data/lib/sequel/plugins/rcte_tree.rb +1 -1
  69. data/lib/sequel/plugins/serialization.rb +11 -0
  70. data/lib/sequel/plugins/single_table_inheritance.rb +1 -1
  71. data/lib/sequel/plugins/table_select.rb +41 -0
  72. data/lib/sequel/plugins/tree.rb +1 -1
  73. data/lib/sequel/sql.rb +2 -2
  74. data/lib/sequel/version.rb +1 -1
  75. data/spec/adapters/oracle_spec.rb +22 -1
  76. data/spec/adapters/postgres_spec.rb +31 -48
  77. data/spec/adapters/sqlanywhere_spec.rb +170 -0
  78. data/spec/core/dataset_spec.rb +109 -0
  79. data/spec/core/object_graph_spec.rb +7 -0
  80. data/spec/extensions/constraint_validations_spec.rb +7 -0
  81. data/spec/extensions/core_refinements_spec.rb +1 -1
  82. data/spec/extensions/many_through_many_spec.rb +65 -0
  83. data/spec/extensions/pg_array_associations_spec.rb +44 -0
  84. data/spec/extensions/rcte_tree_spec.rb +3 -3
  85. data/spec/extensions/spec_helper.rb +1 -1
  86. data/spec/extensions/table_select_spec.rb +71 -0
  87. data/spec/integration/associations_test.rb +279 -7
  88. data/spec/integration/dataset_test.rb +13 -4
  89. data/spec/integration/schema_test.rb +12 -14
  90. data/spec/model/associations_spec.rb +472 -3
  91. data/spec/model/class_dataset_methods_spec.rb +1 -0
  92. data/spec/model/model_spec.rb +10 -0
  93. metadata +10 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5cf40a4c3d9c93b6ed7fa958db814a768fbc322
4
- data.tar.gz: 06fb6c46cdf9af739fe547de06aedb598b46b11e
3
+ metadata.gz: 7006f0a52cb0de63ef52daa4eee4f0246b4dff47
4
+ data.tar.gz: e936af319d149dcfdd4cffc7e183f79862e71d9f
5
5
  SHA512:
6
- metadata.gz: 1d05bce34cc981ada0a4429d9cfbb861f8ad52b9fe83ae604f3ea0395f27deffe766e865d4a57e5ebd791df799215570f945b488fd6e7a317bd6b9f5d821e3bd
7
- data.tar.gz: 7bd18b9518488d92f7b45024d93ae31b0b497580e681f65cbc1ee2f1a914f1c4f69a250fd1e4759ddcd37004a6ce4c4125f81cd61b11bf51428652bd7d97fefb
6
+ metadata.gz: f418f71c2c0bf871f80beb3948e03e5dfb531e7d14f612a78d9265cf7e7771781dd0cc0d23fe43c0539ff0b58512eeecac11c4a3c75aa93e887e9dd91fdbcc95
7
+ data.tar.gz: b33de96a8d47aa303998c9ee560a351574a92176ef80adf23d3c749ebdbdfaf0762861cf6d454c72a89705a7b5c7e167161229dd12d8857d97b1ea090f0fcdd9
data/CHANGELOG CHANGED
@@ -1,3 +1,37 @@
1
+ === 4.4.0 (2013-11-01)
2
+
3
+ * Make Database#tables not show tables in the recycle bin on Oracle (jeremyevans) (#728)
4
+
5
+ * Don't automatically order on all columns when emulating offsets for unordered datasets on DB2 (jeremyevans)
6
+
7
+ * Improve PostgreSQL type support in the jdbc/postgresql adapter (jeremyevans)
8
+
9
+ * Make offset emulation on Oracle work when using columns that can't be ordered (jeremyevans, sdeming) (#724, #725)
10
+
11
+ * Make filter by associations support handle associations with :conditions or block (jeremyevans)
12
+
13
+ * Make association cloning handle :block correctly for clones of clones (jeremyevans)
14
+
15
+ * Make association cloning handle :eager_block option correctly (jeremyevans)
16
+
17
+ * Make add_primary_key work on h2 (jeremyevans)
18
+
19
+ * Add support for foreign key parsing on Oracle (jeremyevans)
20
+
21
+ * Add support for foreign key parsing to the jdbc adapter (jeremyevans)
22
+
23
+ * Make add_foreign_key work on HSQLDB (jeremyevans)
24
+
25
+ * Add table_select plugin for selecting table.* instead of * for model datasets (jeremyevans)
26
+
27
+ * Issue constraint_validation table deletes before inserts, so modifying constraint via drop/add in same alter_table block works (jeremyevans)
28
+
29
+ * Support add_*/remove_*/remove_all_* pg_array_to_many association methods on unsaved model objects (jeremyevans)
30
+
31
+ * Add Sybase SQLAnywhere support via new sqlanywhere and jdbc/sqlanywhere adapters (gditrick, jeremyevans)
32
+
33
+ * Add Dataset#offset for setting the offset separately from the limit (Paul Henry, jeremyevans) (#717)
34
+
1
35
  === 4.3.0 (2013-10-02)
2
36
 
3
37
  * Fix literalization of empty blobs on MySQL (jeremyevans) (#715)
@@ -13,8 +13,8 @@ toolkit for Ruby.
13
13
  configurations, and database sharding.
14
14
  * Sequel currently has adapters for ADO, Amalgalite, CUBRID,
15
15
  DataObjects, DB2, DBI, Firebird, IBM_DB, Informix, JDBC, MySQL,
16
- Mysql2, ODBC, OpenBase, Oracle, PostgreSQL, SQLite3, Swift, and
17
- TinyTDS.
16
+ Mysql2, ODBC, OpenBase, Oracle, PostgreSQL, SQLAnywhere, SQLite3,
17
+ Swift, and TinyTDS.
18
18
 
19
19
  == Resources
20
20
 
@@ -70,7 +70,7 @@ Sequel includes an IRB console for quick access to databases (usually referred t
70
70
 
71
71
  You get an IRB session with the database object stored in DB.
72
72
 
73
- In addition to providing an IRB shell (the default behavior), bin/sequel also has support for migrating databases, dumping schema migrations, and copying databases. See the {bin/sequel guide}[link:files/doc/bin_sequel_rdoc.html] for more details.
73
+ In addition to providing an IRB shell (the default behavior), bin/sequel also has support for migrating databases, dumping schema migrations, and copying databases. See the {bin/sequel guide}[rdoc-ref:doc/bin_sequel.rdoc] for more details.
74
74
 
75
75
  == An Introduction
76
76
 
@@ -250,12 +250,12 @@ After filtering, you can retrieve the matching records by using any of the retri
250
250
 
251
251
  my_posts.each{|row| p row}
252
252
 
253
- See the {Dataset Filtering}[link:files/doc/dataset_filtering_rdoc.html] file for more details.
253
+ See the {Dataset Filtering}[rdoc-ref:doc/dataset_filtering.rdoc] file for more details.
254
254
 
255
255
  === Security
256
256
 
257
257
  Designing apps with security in mind is a best practice.
258
- Please read the {Security Guide}[link:files/doc/security_rdoc.html] for details on security
258
+ Please read the {Security Guide}[rdoc-ref:doc/security.rdoc] for details on security
259
259
  issues that you should be aware of when using Sequel.
260
260
 
261
261
  === Summarizing Records
@@ -313,7 +313,7 @@ You can also specify descending order:
313
313
 
314
314
  === Core Extensions
315
315
 
316
- Note the use of <tt>Sequel.desc(:stamp)</tt> in the above example. Much of Sequel's DSL uses this style, calling methods on the Sequel module that return SQL expression objects. Sequel also ships with a {core_extensions extension}[link:files/doc/core_extensions_rdoc.html]) that integrates Sequel's DSL better into the ruby language, allowing you to write:
316
+ Note the use of <tt>Sequel.desc(:stamp)</tt> in the above example. Much of Sequel's DSL uses this style, calling methods on the Sequel module that return SQL expression objects. Sequel also ships with a {core_extensions extension}[rdoc-ref:doc/core_extensions.rdoc]) that integrates Sequel's DSL better into the ruby language, allowing you to write:
317
317
 
318
318
  :stamp.desc
319
319
 
@@ -574,7 +574,7 @@ That will just change the value for the object, it will not update the row in th
574
574
 
575
575
  === Mass assignment
576
576
 
577
- You can also set the values for multiple columns in a single method call, using one of the mass-assignment methods. See the {mass assignment guide}[link:files/doc/mass_assignment_rdoc.html] for details. For example +set+ updates the model's column values without saving:
577
+ You can also set the values for multiple columns in a single method call, using one of the mass-assignment methods. See the {mass assignment guide}[rdoc-ref:doc/mass_assignment.rdoc] for details. For example +set+ updates the model's column values without saving:
578
578
 
579
579
  post.set(:title=>'hey there', :updated_by=>'foo')
580
580
 
data/Rakefile CHANGED
@@ -99,7 +99,7 @@ if rdoc_task_class
99
99
  rdoc_task_class.new(:website_rdoc_plugins) do |rdoc|
100
100
  rdoc.rdoc_dir = "www/public/rdoc-plugins"
101
101
  rdoc.options += RDOC_DEFAULT_OPTS + %w'--main Sequel --no-ignore-invalid'
102
- rdoc.rdoc_files.add %w"lib/sequel/{extensions,plugins}/**/*.rb"
102
+ rdoc.rdoc_files.add %w"lib/sequel/{extensions,plugins}/**/*.rb doc/core_*"
103
103
  end
104
104
 
105
105
  desc "Update sequel.rubyforge.org"
@@ -170,7 +170,7 @@ begin
170
170
  spec_with_cov.call("spec_plugin", Dir["spec/extensions/*_spec.rb"].sort_by{rand}, "Run extension/plugin specs"){|t| t.rcov_opts.concat(%w'--exclude "lib/sequel/([a-z_]+\.rb|adapters|connection_pool|database|dataset|model)"')}
171
171
  spec_with_cov.call("spec_integration", Dir["spec/integration/*_test.rb"], "Run integration tests")
172
172
 
173
- %w'postgres sqlite mysql informix oracle firebird mssql db2'.each do |adapter|
173
+ %w'postgres sqlite mysql informix oracle firebird mssql db2 sqlanywhere'.each do |adapter|
174
174
  spec_with_cov.call("spec_#{adapter}", ["spec/adapters/#{adapter}_spec.rb"] + Dir["spec/integration/*_test.rb"], "Run #{adapter} specs"){|t| t.rcov_opts.concat(%w'--exclude "lib/sequel/([a-z_]+\.rb|connection_pool|database|dataset|model|extensions|plugins)"')}
175
175
  end
176
176
 
@@ -332,7 +332,7 @@ With either way of eager loading, you must call +all+ to retrieve all records at
332
332
 
333
333
  Like ActiveRecord, Sequel supports cascading of eager loading for both methods of eager loading.
334
334
 
335
- Unlike ActiveRecord, Sequel allows you to eager load custom associations using the <tt>:eager_loader</tt> and <tt>:eager_grapher</tt> association options. See the {Advanced Associations guide}[link:files/doc/advanced_associations_rdoc.html] for more details.
335
+ Unlike ActiveRecord, Sequel allows you to eager load custom associations using the <tt>:eager_loader</tt> and <tt>:eager_grapher</tt> association options. See the {Advanced Associations guide}[rdoc-ref:doc/advanced_associations.rdoc] for more details.
336
336
 
337
337
  Table aliasing when eager loading via +eager_graph+ is different in Sequel than ActiveRecord. Sequel will always attempt to use the association name, not the table name, for any associations. If the association name has already been used, Sequel will append _N to it, where N starts at 0 and increases by 1. For example, for a self referential association:
338
338
 
@@ -581,7 +581,7 @@ Here's a mapping of ActiveRecord +find+ options to <tt>Sequel::Dataset</tt> meth
581
581
  :order :: order
582
582
  :group :: group
583
583
  :limit :: limit
584
- :offset :: limit # second entry in limit array
584
+ :offset :: offset
585
585
  :joins :: join, left_join, etc. # many other join methods
586
586
  :include :: eager, eager_graph # eager does preloading, eager_graph does JOINs
587
587
  :select :: select
@@ -445,7 +445,7 @@ use separate filter calls:
445
445
 
446
446
  Album.where(:tags=>@tag1).where(:tags=>@tag2)
447
447
 
448
- Or the the array form of condition specifiers:
448
+ Or the array form of condition specifiers:
449
449
 
450
450
  Album.where([[:tags, @tag1], [:tags, @tag2]])
451
451
 
@@ -462,8 +462,22 @@ the other forms, this can be inverted:
462
462
 
463
463
  This will return all albums whose artist does not start with 'A'.
464
464
 
465
- Note that filtering by associations only works correctly for simple
466
- associations (ones without conditions).
465
+ Filtering by associations even works for associations that have
466
+ conditions added via the :conditions option or a block:
467
+
468
+ Album.one_to_many :popular_tags, :clone=>:tags do |ds|
469
+ ds.where{times_used > 1000}
470
+ end
471
+ Album.where(:popular_tags=>[@tag1, @tag2])
472
+
473
+ This will return all albums that whose popular tags would include
474
+ at least one of those tags.
475
+
476
+ Note that filtering by associations does not work for associations
477
+ that use blocks with instance-specific code, or associations that
478
+ have a limit or offset. This includes many_to_one/one_to_one
479
+ associations that would return multiple values if they were not
480
+ limited to a single value.
467
481
 
468
482
  == Name Collisions
469
483
 
@@ -677,7 +691,7 @@ The add_<i>association</i> method returns the now associated object:
677
691
 
678
692
  === remove_<i>association</i>(object_to_disassociate) (e.g. remove_album) [+one_to_many+ and +many_to_many+]
679
693
 
680
- The remove_<i>association</i> method disassociates the the passed object from
694
+ The remove_<i>association</i> method disassociates the passed object from
681
695
  the current object. For +one_to_many+ associations, it sets the foreign key of
682
696
  the associated object to NULL, and saves the associated object. For
683
697
  +many_to_many+ associations, this deletes the matching row in the join table.
@@ -735,7 +749,7 @@ added methods:
735
749
  ds.model_object # @artist
736
750
  ds.association_reflection # same as Artist.association_reflection(:albums)
737
751
 
738
- For a more info on Sequel's reflection capabilities see the {Reflection page}[link:files/doc/reflection_rdoc.html].
752
+ For a more info on Sequel's reflection capabilities see the {Reflection page}[rdoc-ref:doc/reflection.rdoc].
739
753
 
740
754
  == Overriding Method Behavior
741
755
 
@@ -1041,7 +1055,7 @@ the artist can perform any one of four tasks for the lyric:
1041
1055
 
1042
1056
  A module or array of modules to extend the dataset with. These are used to
1043
1057
  set up association extensions. For more information , please see the
1044
- {Advanced Associations page}[link:files/doc/advanced_associations_rdoc.html].
1058
+ {Advanced Associations page}[rdoc-ref:doc/advanced_associations.rdoc].
1045
1059
 
1046
1060
  ==== :primary_key
1047
1061
 
@@ -1235,7 +1249,7 @@ to eagerly load:
1235
1249
 
1236
1250
  A custom loader to use when eagerly load associated objects via eager.
1237
1251
  For many details and examples of custom eager loaders, please see the
1238
- {Advanced Associations guide}[link:files/doc/advanced_associations_rdoc.html].
1252
+ {Advanced Associations guide}[rdoc-ref:doc/advanced_associations.rdoc].
1239
1253
 
1240
1254
  ==== :eager_loader_key
1241
1255
 
@@ -24,7 +24,7 @@ In general, you probably want to provide a connection string argument to bin/seq
24
24
  sequel postgres://user:pass@host/database_name
25
25
  sequel mysql2://user:pass@host/database_name
26
26
 
27
- See the {Connecting to a database guide}[link:files/doc/opening_databases_rdoc.html] for more details about and examples of connection strings.
27
+ See the {Connecting to a database guide}[rdoc-ref:doc/opening_databases.rdoc] for more details about and examples of connection strings.
28
28
 
29
29
  === YAML Connection File
30
30
 
@@ -77,7 +77,7 @@ You can use the -M attribute to set the version to migrate to:
77
77
 
78
78
  sequel -m /path/to/migrations/dir -M 3 postgres://host/database
79
79
 
80
- See the {migration guide}[link:files/doc/migration_rdoc.html] for more details about migrations.
80
+ See the {migration guide}[rdoc-ref:doc/migration.rdoc] for more details about migrations.
81
81
 
82
82
  === Dump Schemas
83
83
 
@@ -63,7 +63,7 @@ Without a filename argument, the sqlite adapter will setup a new sqlite database
63
63
  dataset.inject(0){|sum, r| sum + r[:value]}
64
64
  dataset.sum(:value) # better
65
65
 
66
- == Filtering (see also {Dataset Filtering}[link:files/doc/dataset_filtering_rdoc.html])
66
+ == Filtering (see also {Dataset Filtering}[rdoc-ref:doc/dataset_filtering.rdoc])
67
67
 
68
68
  === Equality
69
69
 
@@ -121,6 +121,7 @@ Without a filename argument, the sqlite adapter will setup a new sqlite database
121
121
 
122
122
  dataset.limit(30) # LIMIT 30
123
123
  dataset.limit(30, 10) # LIMIT 30 OFFSET 10
124
+ dataset.limit(30).offset(10) # LIMIT 30 OFFSET 10
124
125
 
125
126
  == Joins
126
127
 
@@ -81,7 +81,7 @@ WHERE:: where, filter, exclude, exclude_where, and, or, grep, invert, unfiltered
81
81
  GROUP:: group, group_by, group_and_count, select_group, ungrouped
82
82
  HAVING:: having, exclude_having, invert, unfiltered
83
83
  ORDER:: order, order_by, order_append, order_prepend, order_more, reverse, reverse_order, unordered
84
- LIMIT:: limit, unlimited
84
+ LIMIT/OFFSET:: limit, offset, unlimited
85
85
  compounds:: union, intersect, except
86
86
  locking:: for_update, lock_style
87
87
  common table expressions:: with, with_recursive
@@ -29,7 +29,7 @@ If you are specifying a filter/selection/order, you can use a virtual row block:
29
29
 
30
30
  items.select{avg(price)}
31
31
 
32
- You can also use the {core_extensions extension}[link:files/doc/core_extensions_rdoc.html] and the +sql_function+ method:
32
+ You can also use the {core_extensions extension}[rdoc-ref:doc/core_extensions.rdoc] and the +sql_function+ method:
33
33
 
34
34
  :avg.sql_function(:price)
35
35
 
@@ -26,7 +26,7 @@ you generally need to run Sequel's migrator with <tt>bin/sequel -m</tt>:
26
26
  Migrations in Sequel use a very simple DSL via the <tt>Sequel.migration</tt>
27
27
  method, and inside the DSL, use the <tt>Sequel::Database</tt> schema
28
28
  modification methods such as +create_table+ and +alter_table+.
29
- See the {schema modification guide}[link:files/doc/schema_modification_rdoc.html]
29
+ See the {schema modification guide}[rdoc-ref:doc/schema_modification.rdoc]
30
30
  for details on the schema modification methods you can use.
31
31
 
32
32
  == A Basic Migration
@@ -144,7 +144,7 @@ Migrations themselves do not contain any schema modification methods, but they m
144
144
  any of the <tt>Sequel::Database</tt> modification methods, of which there are many. The main
145
145
  ones are +create_table+ and +alter_table+, but Sequel also comes with numerous other schema
146
146
  modification methods, most of which are shortcuts for +alter_table+ (all of these methods are
147
- described in more detail in the {schema modification guide}[link:files/doc/schema_modification_rdoc.html]):
147
+ described in more detail in the {schema modification guide}[rdoc-ref:doc/schema_modification.rdoc]):
148
148
 
149
149
  * add_column
150
150
  * add_index
@@ -204,7 +204,7 @@ If Sequel needs to represent an SQL concept that does not map directly to an exi
204
204
  ruby class, it will generally use a Sequel::SQL::Expression subclass to represent that
205
205
  concept.
206
206
 
207
- Some of the examples below show examples that require the {core_extensions extension}[link:files/doc/core_extensions_rdoc.html].
207
+ Some of the examples below show examples that require the {core_extensions extension}[rdoc-ref:doc/core_extensions.rdoc].
208
208
 
209
209
  === Sequel::LiteralString
210
210
 
@@ -530,7 +530,7 @@ block expression support:
530
530
  In the above code, the block is instance-evaled inside a VirtualRow instance.
531
531
 
532
532
  These objects are usually not instantiated manually. See the
533
- {Virtual Row Guide}[link:files/doc/virtual_rows_rdoc.html] for details.
533
+ {Virtual Row Guide}[rdoc-ref:doc/virtual_rows.rdoc] for details.
534
534
 
535
535
  === Sequel::SQL::Window
536
536
 
@@ -76,7 +76,7 @@ These options are shared by all adapters unless otherwise noted.
76
76
  :test :: Whether to test that a valid database connection can be made (false by default)
77
77
  :user :: The user account name to use logging in
78
78
 
79
- The following options can be specified and are passed to the the database's internal connection pool.
79
+ The following options can be specified and are passed to the database's internal connection pool.
80
80
 
81
81
  :after_connect :: A proc called after a new connection is made, with the connection object (default: nil)
82
82
  :max_connections :: The maximum size of the connection pool (default: 4 connections on most databases)
@@ -271,6 +271,7 @@ Example connection strings:
271
271
  jdbc:firebirdsql:localhost/3050:/path/to/database.fdb
272
272
  jdbc:jdbcprogress:T:hostname:port:database
273
273
  jdbc:cubrid:hostname:port:database:::
274
+ jdbc:sqlanywhere://localhost?DBN=Test;UID=user;PWD=password
274
275
 
275
276
  You can also use JNDI connection strings:
276
277
 
@@ -370,6 +371,17 @@ The following additional options are supported:
370
371
  :use_iso_date_format :: This can be set to false to not force the ISO date format. Sequel forces
371
372
  it by default to allow for an optimization.
372
373
 
374
+ === sqlanywhere
375
+
376
+ The sqlanywhere driver works off connection strings, so a connection string
377
+ is built based on the url/options hash provided. The following additional
378
+ options are respected:
379
+
380
+ :commlinks :: specify the CommLinks connection string option
381
+ :conn_string :: specify the connection string to use, ignoring all other options
382
+ :connection_name :: specify the ConnectionName connection string option
383
+ :encoding :: specify the CharSet connection string option
384
+
373
385
  === sqlite
374
386
 
375
387
  Requires: sqlite3
@@ -11,7 +11,7 @@ aims to be a gentle introduction to Sequel's querying support.
11
11
  While you can easily use raw SQL with Sequel, a large part of the
12
12
  advantage you get from using Sequel is Sequel's ability to abstract
13
13
  SQL from you and give you a much nicer interface. Sequel also ships with
14
- a {core_extensions extension}[link:files/doc/core_extensions_rdoc.html],
14
+ a {core_extensions extension}[rdoc-ref:doc/core_extensions.rdoc],
15
15
  which better integrates Sequel's DSL into the ruby language.
16
16
 
17
17
  == Retrieving Objects
@@ -25,7 +25,7 @@ method you can use.
25
25
  === Sequel::Dataset
26
26
 
27
27
  If you are new to Sequel and aren't familiar with Sequel, you should probably
28
- read the {"Dataset Basics" guide}[link:files/doc/dataset_basics_rdoc.html],
28
+ read the {"Dataset Basics" guide}[rdoc-ref:doc/dataset_basics.rdoc],
29
29
  then come back here.
30
30
 
31
31
  === Retrieving a Single Object
@@ -380,7 +380,7 @@ If a block is passed to a filter, it is treated as a virtual row block:
380
380
  Artist.where{id > 5}
381
381
  # SELECT * FROM artists WHERE id > 5
382
382
 
383
- You can learn more about virtual row blocks in the {"Virtual Rows" guide}[link:files/doc/virtual_rows_rdoc.html].
383
+ You can learn more about virtual row blocks in the {"Virtual Rows" guide}[rdoc-ref:doc/virtual_rows.rdoc].
384
384
 
385
385
  You can provide both regular arguments and a block, in which case the results
386
386
  will be ANDed together:
@@ -629,7 +629,12 @@ You can provide a second argument to +limit+ to specify an offset:
629
629
  Artist.limit(5, 10)
630
630
  # SELECT * FROM artists LIMIT 5 OFFSET 10
631
631
 
632
- This would return the 11th through 15th records in the original
632
+ You can also call the +offset+ method separately:
633
+
634
+ Artist.limit(5).offset(10)
635
+ # SELECT * FROM artists LIMIT 5 OFFSET 10
636
+
637
+ Either of these would return the 11th through 15th records in the original
633
638
  dataset.
634
639
 
635
640
  To remove a limit from a dataset, use +unlimited+:
@@ -0,0 +1,92 @@
1
+ = New Features
2
+
3
+ * Sequel now supports Sybase SQLAnywhere, via the sqlanywhere and
4
+ jdbc/sqlanywhere adapters.
5
+
6
+ * The filter by associations support now handles cases where the
7
+ association has :conditions or a block (as long as the block
8
+ does not rely on instance-specific behavior). This allows
9
+ you to handle the following:
10
+
11
+ Album.many_to_many :popular_tags, :class=>:Tag do |ds|
12
+ ds.where{tags__popularity > 9000}
13
+ end
14
+ Album.where(:popular_tags=>[Tag[1], Tag[2]])
15
+
16
+ This will return all albums whose popular_tags would include
17
+ at least one of those two tags. Previously, the block would
18
+ be ignored, returning albums containing one those tags even if
19
+ the tags weren't popular.
20
+
21
+ * A table_select plugin has been added that changes the default
22
+ selection for models from * to table.*. This is useful for
23
+ people who want ActiveRecord-like behavior instead of SQL-like
24
+ behavior, where joining tables doesn't automatically include
25
+ columns in the other table.
26
+
27
+ This can fix issues where joining another table that has columns
28
+ with the same name as columns in the model table without
29
+ specifying an explicit selection results in model objects being
30
+ returned where the values in the model object are the values
31
+ from the joined table instead of the model table.
32
+
33
+ * Dataset#offset has been added, for specifying offset separately
34
+ from limit. Previous this was possible via:
35
+
36
+ ds.limit(nil, offset)
37
+
38
+ but this is a friendlier API.
39
+
40
+ * The jdbc adapter now has support for foreign key parsing. This
41
+ is used if there is no specific support for the underlying
42
+ database.
43
+
44
+ * Foreign key parsing is now supported on Oracle.
45
+
46
+ = Other Improvements
47
+
48
+ * Association add_*/remove_*/remove_all_* methods for
49
+ pg_array_to_many associations now work on unsaved model objects.
50
+
51
+ * In the constraint_validations extension, deletes from the
52
+ metadata table are now processed before inserts, so that dropping
53
+ an existing constraint and readding a constraint with the same
54
+ name now works correctly.
55
+
56
+ * Cloning an association now copies the :eager_block option
57
+ correctly from the source association if it was passed as
58
+ the block to the source association method.
59
+
60
+ * Cloning a cloned association now copies the block for the
61
+ association.
62
+
63
+ * The descendants method in the tree plugin no longer modifies an
64
+ array it is iterating over.
65
+
66
+ * The jdbc/postgresql adapter now supports PostgreSQL-specific types,
67
+ with pretty much the same support as the postgres adapter. When
68
+ using the pg_* extensions, the dataset will now handle the
69
+ PostgreSQL types correctly and return instances of the correct
70
+ Ruby classes (e.g. hstore is returned as Sequel::Postgres::HStore).
71
+
72
+ You should no longer need to use the typecast_on_load or
73
+ pg_typecast_on_load plugins when using model objects that use these
74
+ types when using the jdbc/postgresql adapter.
75
+
76
+ * Offset emulation on Oracle now handles cases where selected
77
+ columns can't be ordered.
78
+
79
+ * Offset emulation on DB2 no longer automatically orders on all
80
+ columns if the dataset itself is unordered.
81
+
82
+ * Types containing spaces are now returning correctly when
83
+ parsing the schema in the oracle adapter.
84
+
85
+ * Database#tables no longer returns tables in the recycle bin on
86
+ Oracle.
87
+
88
+ * add_foreign_key now works correctly on HSQLDB, by splitting the
89
+ column addition and constraint addition into two separate
90
+ statements.
91
+
92
+ * add_primary_key now works correctly on H2.