sequel 3.21.0 → 3.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. data/CHANGELOG +1061 -3
  2. data/MIT-LICENSE +1 -1
  3. data/README.rdoc +103 -63
  4. data/Rakefile +59 -27
  5. data/bin/sequel +50 -26
  6. data/doc/active_record.rdoc +67 -51
  7. data/doc/advanced_associations.rdoc +189 -75
  8. data/doc/association_basics.rdoc +327 -79
  9. data/doc/cheat_sheet.rdoc +21 -21
  10. data/doc/core_extensions.rdoc +374 -0
  11. data/doc/dataset_basics.rdoc +10 -10
  12. data/doc/dataset_filtering.rdoc +54 -42
  13. data/doc/mass_assignment.rdoc +56 -0
  14. data/doc/migration.rdoc +89 -557
  15. data/doc/model_hooks.rdoc +80 -29
  16. data/doc/object_model.rdoc +547 -0
  17. data/doc/opening_databases.rdoc +114 -53
  18. data/doc/prepared_statements.rdoc +41 -15
  19. data/doc/querying.rdoc +137 -56
  20. data/doc/reflection.rdoc +36 -10
  21. data/doc/release_notes/3.22.0.txt +39 -0
  22. data/doc/release_notes/3.23.0.txt +172 -0
  23. data/doc/release_notes/3.24.0.txt +420 -0
  24. data/doc/release_notes/3.25.0.txt +88 -0
  25. data/doc/release_notes/3.26.0.txt +88 -0
  26. data/doc/release_notes/3.27.0.txt +82 -0
  27. data/doc/release_notes/3.28.0.txt +304 -0
  28. data/doc/release_notes/3.29.0.txt +459 -0
  29. data/doc/release_notes/3.30.0.txt +135 -0
  30. data/doc/release_notes/3.31.0.txt +146 -0
  31. data/doc/release_notes/3.32.0.txt +202 -0
  32. data/doc/release_notes/3.33.0.txt +157 -0
  33. data/doc/release_notes/3.34.0.txt +671 -0
  34. data/doc/release_notes/3.35.0.txt +144 -0
  35. data/doc/release_notes/3.36.0.txt +245 -0
  36. data/doc/release_notes/3.37.0.txt +338 -0
  37. data/doc/release_notes/3.38.0.txt +234 -0
  38. data/doc/release_notes/3.39.0.txt +237 -0
  39. data/doc/schema_modification.rdoc +585 -0
  40. data/doc/sharding.rdoc +99 -8
  41. data/doc/sql.rdoc +154 -112
  42. data/doc/testing.rdoc +169 -0
  43. data/doc/thread_safety.rdoc +17 -0
  44. data/doc/transactions.rdoc +137 -0
  45. data/doc/validations.rdoc +1 -1
  46. data/doc/virtual_rows.rdoc +78 -43
  47. data/lib/sequel/adapters/ado/mssql.rb +18 -6
  48. data/lib/sequel/adapters/ado.rb +40 -18
  49. data/lib/sequel/adapters/amalgalite.rb +17 -9
  50. data/lib/sequel/adapters/db2.rb +175 -86
  51. data/lib/sequel/adapters/dbi.rb +15 -15
  52. data/lib/sequel/adapters/do/mysql.rb +17 -11
  53. data/lib/sequel/adapters/do/postgres.rb +2 -61
  54. data/lib/sequel/adapters/do/sqlite.rb +0 -10
  55. data/lib/sequel/adapters/do.rb +18 -36
  56. data/lib/sequel/adapters/firebird.rb +27 -208
  57. data/lib/sequel/adapters/ibmdb.rb +453 -0
  58. data/lib/sequel/adapters/informix.rb +6 -23
  59. data/lib/sequel/adapters/jdbc/as400.rb +16 -34
  60. data/lib/sequel/adapters/jdbc/db2.rb +56 -0
  61. data/lib/sequel/adapters/jdbc/derby.rb +325 -0
  62. data/lib/sequel/adapters/jdbc/firebird.rb +24 -0
  63. data/lib/sequel/adapters/jdbc/h2.rb +73 -31
  64. data/lib/sequel/adapters/jdbc/hsqldb.rb +184 -0
  65. data/lib/sequel/adapters/jdbc/informix.rb +21 -0
  66. data/lib/sequel/adapters/jdbc/jtds.rb +40 -0
  67. data/lib/sequel/adapters/jdbc/mssql.rb +3 -33
  68. data/lib/sequel/adapters/jdbc/mysql.rb +7 -24
  69. data/lib/sequel/adapters/jdbc/oracle.rb +88 -25
  70. data/lib/sequel/adapters/jdbc/postgresql.rb +77 -52
  71. data/lib/sequel/adapters/jdbc/progress.rb +21 -0
  72. data/lib/sequel/adapters/jdbc/sqlite.rb +20 -10
  73. data/lib/sequel/adapters/jdbc/sqlserver.rb +66 -0
  74. data/lib/sequel/adapters/jdbc/transactions.rb +83 -0
  75. data/lib/sequel/adapters/jdbc.rb +279 -97
  76. data/lib/sequel/adapters/mock.rb +372 -0
  77. data/lib/sequel/adapters/mysql.rb +125 -222
  78. data/lib/sequel/adapters/mysql2.rb +65 -56
  79. data/lib/sequel/adapters/odbc/mssql.rb +17 -9
  80. data/lib/sequel/adapters/odbc.rb +28 -9
  81. data/lib/sequel/adapters/openbase.rb +3 -5
  82. data/lib/sequel/adapters/oracle.rb +349 -53
  83. data/lib/sequel/adapters/postgres.rb +368 -138
  84. data/lib/sequel/adapters/shared/access.rb +32 -9
  85. data/lib/sequel/adapters/shared/db2.rb +343 -0
  86. data/lib/sequel/adapters/shared/firebird.rb +221 -0
  87. data/lib/sequel/adapters/shared/informix.rb +53 -0
  88. data/lib/sequel/adapters/shared/mssql.rb +401 -116
  89. data/lib/sequel/adapters/shared/mysql.rb +424 -89
  90. data/lib/sequel/adapters/shared/mysql_prepared_statements.rb +155 -0
  91. data/lib/sequel/adapters/shared/oracle.rb +257 -45
  92. data/lib/sequel/adapters/shared/postgres.rb +675 -279
  93. data/lib/sequel/adapters/shared/progress.rb +5 -8
  94. data/lib/sequel/adapters/shared/sqlite.rb +285 -96
  95. data/lib/sequel/adapters/sqlite.rb +101 -39
  96. data/lib/sequel/adapters/swift/mysql.rb +10 -12
  97. data/lib/sequel/adapters/swift/postgres.rb +13 -79
  98. data/lib/sequel/adapters/swift/sqlite.rb +9 -6
  99. data/lib/sequel/adapters/swift.rb +28 -19
  100. data/lib/sequel/adapters/tinytds.rb +174 -22
  101. data/lib/sequel/adapters/utils/emulate_offset_with_row_number.rb +77 -0
  102. data/lib/sequel/adapters/utils/pg_types.rb +81 -0
  103. data/lib/sequel/adapters/utils/stored_procedures.rb +1 -11
  104. data/lib/sequel/ast_transformer.rb +194 -0
  105. data/lib/sequel/connection_pool/sharded_single.rb +11 -1
  106. data/lib/sequel/connection_pool/sharded_threaded.rb +33 -2
  107. data/lib/sequel/connection_pool/single.rb +5 -0
  108. data/lib/sequel/connection_pool/threaded.rb +43 -14
  109. data/lib/sequel/connection_pool.rb +10 -2
  110. data/lib/sequel/core.rb +143 -11
  111. data/lib/sequel/database/connecting.rb +38 -28
  112. data/lib/sequel/database/dataset.rb +4 -4
  113. data/lib/sequel/database/dataset_defaults.rb +63 -2
  114. data/lib/sequel/database/logging.rb +7 -2
  115. data/lib/sequel/database/misc.rb +190 -46
  116. data/lib/sequel/database/query.rb +272 -110
  117. data/lib/sequel/database/schema_generator.rb +103 -36
  118. data/lib/sequel/database/schema_methods.rb +300 -67
  119. data/lib/sequel/dataset/actions.rb +344 -90
  120. data/lib/sequel/dataset/features.rb +101 -8
  121. data/lib/sequel/dataset/graph.rb +42 -15
  122. data/lib/sequel/dataset/misc.rb +52 -25
  123. data/lib/sequel/dataset/mutation.rb +12 -7
  124. data/lib/sequel/dataset/prepared_statements.rb +68 -30
  125. data/lib/sequel/dataset/query.rb +305 -54
  126. data/lib/sequel/dataset/sql.rb +720 -292
  127. data/lib/sequel/dataset.rb +8 -0
  128. data/lib/sequel/exceptions.rb +4 -0
  129. data/lib/sequel/extensions/_pretty_table.rb +83 -0
  130. data/lib/sequel/extensions/arbitrary_servers.rb +109 -0
  131. data/lib/sequel/extensions/blank.rb +4 -0
  132. data/lib/sequel/extensions/columns_introspection.rb +72 -0
  133. data/lib/sequel/extensions/constraint_validations.rb +451 -0
  134. data/lib/sequel/{core_sql.rb → extensions/core_extensions.rb} +30 -46
  135. data/lib/sequel/extensions/eval_inspect.rb +173 -0
  136. data/lib/sequel/extensions/inflector.rb +4 -0
  137. data/lib/sequel/extensions/looser_typecasting.rb +5 -4
  138. data/lib/sequel/extensions/migration.rb +100 -11
  139. data/lib/sequel/extensions/named_timezones.rb +9 -0
  140. data/lib/sequel/extensions/null_dataset.rb +94 -0
  141. data/lib/sequel/extensions/pagination.rb +4 -0
  142. data/lib/sequel/extensions/pg_array.rb +537 -0
  143. data/lib/sequel/extensions/pg_array_ops.rb +263 -0
  144. data/lib/sequel/extensions/pg_auto_parameterize.rb +175 -0
  145. data/lib/sequel/extensions/pg_hstore.rb +313 -0
  146. data/lib/sequel/extensions/pg_hstore_ops.rb +293 -0
  147. data/lib/sequel/extensions/pg_inet.rb +113 -0
  148. data/lib/sequel/extensions/pg_interval.rb +191 -0
  149. data/lib/sequel/extensions/pg_json.rb +208 -0
  150. data/lib/sequel/extensions/pg_range.rb +512 -0
  151. data/lib/sequel/extensions/pg_range_ops.rb +150 -0
  152. data/lib/sequel/extensions/pg_row.rb +572 -0
  153. data/lib/sequel/extensions/pg_row_ops.rb +182 -0
  154. data/lib/sequel/extensions/pg_statement_cache.rb +317 -0
  155. data/lib/sequel/extensions/pretty_table.rb +17 -72
  156. data/lib/sequel/extensions/query.rb +8 -4
  157. data/lib/sequel/extensions/query_literals.rb +79 -0
  158. data/lib/sequel/extensions/schema_caching.rb +76 -0
  159. data/lib/sequel/extensions/schema_dumper.rb +282 -76
  160. data/lib/sequel/extensions/select_remove.rb +39 -0
  161. data/lib/sequel/extensions/server_block.rb +140 -0
  162. data/lib/sequel/extensions/split_array_nil.rb +65 -0
  163. data/lib/sequel/extensions/sql_expr.rb +8 -110
  164. data/lib/sequel/extensions/string_date_time.rb +4 -0
  165. data/lib/sequel/extensions/thread_local_timezones.rb +10 -4
  166. data/lib/sequel/extensions/to_dot.rb +99 -83
  167. data/lib/sequel/model/associations.rb +1263 -409
  168. data/lib/sequel/model/base.rb +624 -171
  169. data/lib/sequel/model/errors.rb +1 -1
  170. data/lib/sequel/model/exceptions.rb +24 -2
  171. data/lib/sequel/model/inflections.rb +1 -1
  172. data/lib/sequel/model.rb +30 -11
  173. data/lib/sequel/no_core_ext.rb +2 -0
  174. data/lib/sequel/plugins/active_model.rb +13 -1
  175. data/lib/sequel/plugins/association_pks.rb +22 -4
  176. data/lib/sequel/plugins/caching.rb +25 -18
  177. data/lib/sequel/plugins/class_table_inheritance.rb +4 -4
  178. data/lib/sequel/plugins/composition.rb +44 -12
  179. data/lib/sequel/plugins/constraint_validations.rb +198 -0
  180. data/lib/sequel/plugins/dataset_associations.rb +100 -0
  181. data/lib/sequel/plugins/defaults_setter.rb +72 -0
  182. data/lib/sequel/plugins/dirty.rb +214 -0
  183. data/lib/sequel/plugins/eager_each.rb +59 -0
  184. data/lib/sequel/plugins/force_encoding.rb +6 -6
  185. data/lib/sequel/plugins/hook_class_methods.rb +1 -1
  186. data/lib/sequel/plugins/identity_map.rb +134 -15
  187. data/lib/sequel/plugins/instance_filters.rb +10 -0
  188. data/lib/sequel/plugins/instance_hooks.rb +1 -1
  189. data/lib/sequel/plugins/json_serializer.rb +58 -6
  190. data/lib/sequel/plugins/list.rb +13 -2
  191. data/lib/sequel/plugins/many_through_many.rb +103 -51
  192. data/lib/sequel/plugins/many_to_one_pk_lookup.rb +71 -0
  193. data/lib/sequel/plugins/nested_attributes.rb +150 -66
  194. data/lib/sequel/plugins/optimistic_locking.rb +8 -0
  195. data/lib/sequel/plugins/pg_row.rb +121 -0
  196. data/lib/sequel/plugins/pg_typecast_on_load.rb +65 -0
  197. data/lib/sequel/plugins/prepared_statements.rb +167 -0
  198. data/lib/sequel/plugins/prepared_statements_associations.rb +87 -0
  199. data/lib/sequel/plugins/prepared_statements_safe.rb +82 -0
  200. data/lib/sequel/plugins/prepared_statements_with_pk.rb +59 -0
  201. data/lib/sequel/plugins/rcte_tree.rb +31 -17
  202. data/lib/sequel/plugins/schema.rb +8 -3
  203. data/lib/sequel/plugins/serialization.rb +98 -49
  204. data/lib/sequel/plugins/serialization_modification_detection.rb +63 -0
  205. data/lib/sequel/plugins/sharding.rb +21 -54
  206. data/lib/sequel/plugins/single_table_inheritance.rb +5 -3
  207. data/lib/sequel/plugins/static_cache.rb +99 -0
  208. data/lib/sequel/plugins/subclasses.rb +29 -3
  209. data/lib/sequel/plugins/tactical_eager_loading.rb +7 -7
  210. data/lib/sequel/plugins/timestamps.rb +1 -1
  211. data/lib/sequel/plugins/tree.rb +3 -3
  212. data/lib/sequel/plugins/typecast_on_load.rb +9 -12
  213. data/lib/sequel/plugins/update_primary_key.rb +2 -2
  214. data/lib/sequel/plugins/validation_class_methods.rb +1 -1
  215. data/lib/sequel/plugins/validation_helpers.rb +55 -4
  216. data/lib/sequel/plugins/xml_serializer.rb +15 -4
  217. data/lib/sequel/sql.rb +649 -122
  218. data/lib/sequel/timezones.rb +67 -40
  219. data/lib/sequel/version.rb +1 -1
  220. data/spec/adapters/db2_spec.rb +146 -0
  221. data/spec/adapters/firebird_spec.rb +1 -1
  222. data/spec/adapters/mssql_spec.rb +194 -66
  223. data/spec/adapters/mysql_spec.rb +475 -306
  224. data/spec/adapters/oracle_spec.rb +92 -117
  225. data/spec/adapters/postgres_spec.rb +1982 -325
  226. data/spec/adapters/spec_helper.rb +9 -6
  227. data/spec/adapters/sqlite_spec.rb +203 -75
  228. data/spec/core/connection_pool_spec.rb +218 -93
  229. data/spec/core/database_spec.rb +956 -522
  230. data/spec/core/dataset_spec.rb +1631 -1242
  231. data/spec/core/expression_filters_spec.rb +690 -334
  232. data/spec/core/mock_adapter_spec.rb +453 -0
  233. data/spec/core/object_graph_spec.rb +88 -129
  234. data/spec/core/schema_generator_spec.rb +4 -4
  235. data/spec/core/schema_spec.rb +556 -53
  236. data/spec/core/spec_helper.rb +7 -48
  237. data/spec/core_extensions_spec.rb +626 -0
  238. data/spec/extensions/active_model_spec.rb +13 -0
  239. data/spec/extensions/arbitrary_servers_spec.rb +110 -0
  240. data/spec/extensions/association_autoreloading_spec.rb +18 -10
  241. data/spec/extensions/association_dependencies_spec.rb +15 -25
  242. data/spec/extensions/association_pks_spec.rb +66 -32
  243. data/spec/extensions/association_proxies_spec.rb +4 -4
  244. data/spec/extensions/boolean_readers_spec.rb +25 -25
  245. data/spec/extensions/caching_spec.rb +47 -51
  246. data/spec/extensions/class_table_inheritance_spec.rb +31 -83
  247. data/spec/extensions/columns_introspection_spec.rb +91 -0
  248. data/spec/extensions/composition_spec.rb +18 -13
  249. data/spec/extensions/constraint_validations_plugin_spec.rb +196 -0
  250. data/spec/extensions/constraint_validations_spec.rb +316 -0
  251. data/spec/extensions/dataset_associations_spec.rb +199 -0
  252. data/spec/extensions/defaults_setter_spec.rb +88 -0
  253. data/spec/extensions/dirty_spec.rb +155 -0
  254. data/spec/extensions/eager_each_spec.rb +34 -0
  255. data/spec/extensions/eval_inspect_spec.rb +67 -0
  256. data/spec/extensions/force_encoding_spec.rb +4 -2
  257. data/spec/extensions/hook_class_methods_spec.rb +97 -128
  258. data/spec/extensions/identity_map_spec.rb +142 -24
  259. data/spec/extensions/inflector_spec.rb +0 -4
  260. data/spec/extensions/instance_filters_spec.rb +11 -21
  261. data/spec/extensions/instance_hooks_spec.rb +72 -0
  262. data/spec/extensions/json_serializer_spec.rb +49 -12
  263. data/spec/extensions/lazy_attributes_spec.rb +16 -20
  264. data/spec/extensions/list_spec.rb +49 -40
  265. data/spec/extensions/looser_typecasting_spec.rb +7 -7
  266. data/spec/extensions/many_through_many_spec.rb +368 -254
  267. data/spec/extensions/many_to_one_pk_lookup_spec.rb +140 -0
  268. data/spec/extensions/migration_spec.rb +140 -35
  269. data/spec/extensions/named_timezones_spec.rb +29 -11
  270. data/spec/extensions/nested_attributes_spec.rb +268 -89
  271. data/spec/extensions/null_dataset_spec.rb +85 -0
  272. data/spec/extensions/optimistic_locking_spec.rb +24 -21
  273. data/spec/extensions/pg_array_ops_spec.rb +112 -0
  274. data/spec/extensions/pg_array_spec.rb +320 -0
  275. data/spec/extensions/pg_auto_parameterize_spec.rb +65 -0
  276. data/spec/extensions/pg_hstore_ops_spec.rb +140 -0
  277. data/spec/extensions/pg_hstore_spec.rb +194 -0
  278. data/spec/extensions/pg_inet_spec.rb +47 -0
  279. data/spec/extensions/pg_interval_spec.rb +72 -0
  280. data/spec/extensions/pg_json_spec.rb +99 -0
  281. data/spec/extensions/pg_range_ops_spec.rb +56 -0
  282. data/spec/extensions/pg_range_spec.rb +395 -0
  283. data/spec/extensions/pg_row_ops_spec.rb +58 -0
  284. data/spec/extensions/pg_row_plugin_spec.rb +49 -0
  285. data/spec/extensions/pg_row_spec.rb +323 -0
  286. data/spec/extensions/pg_statement_cache_spec.rb +208 -0
  287. data/spec/extensions/pg_typecast_on_load_spec.rb +58 -0
  288. data/spec/extensions/prepared_statements_associations_spec.rb +111 -0
  289. data/spec/extensions/prepared_statements_safe_spec.rb +61 -0
  290. data/spec/extensions/prepared_statements_spec.rb +87 -0
  291. data/spec/extensions/prepared_statements_with_pk_spec.rb +31 -0
  292. data/spec/extensions/pretty_table_spec.rb +7 -6
  293. data/spec/extensions/query_literals_spec.rb +167 -0
  294. data/spec/extensions/query_spec.rb +9 -3
  295. data/spec/extensions/rcte_tree_spec.rb +50 -43
  296. data/spec/extensions/schema_caching_spec.rb +41 -0
  297. data/spec/extensions/schema_dumper_spec.rb +434 -49
  298. data/spec/extensions/schema_spec.rb +30 -49
  299. data/spec/extensions/select_remove_spec.rb +38 -0
  300. data/spec/extensions/serialization_modification_detection_spec.rb +72 -0
  301. data/spec/extensions/serialization_spec.rb +86 -48
  302. data/spec/extensions/server_block_spec.rb +90 -0
  303. data/spec/extensions/sharding_spec.rb +69 -143
  304. data/spec/extensions/single_table_inheritance_spec.rb +23 -29
  305. data/spec/extensions/skip_create_refresh_spec.rb +1 -1
  306. data/spec/extensions/spec_helper.rb +34 -67
  307. data/spec/extensions/split_array_nil_spec.rb +24 -0
  308. data/spec/extensions/sql_expr_spec.rb +29 -60
  309. data/spec/extensions/static_cache_spec.rb +145 -0
  310. data/spec/extensions/subclasses_spec.rb +14 -0
  311. data/spec/extensions/tactical_eager_loading_spec.rb +17 -19
  312. data/spec/extensions/thread_local_timezones_spec.rb +22 -2
  313. data/spec/extensions/timestamps_spec.rb +6 -6
  314. data/spec/extensions/to_dot_spec.rb +8 -11
  315. data/spec/extensions/touch_spec.rb +13 -14
  316. data/spec/extensions/tree_spec.rb +11 -26
  317. data/spec/extensions/typecast_on_load_spec.rb +9 -6
  318. data/spec/extensions/update_primary_key_spec.rb +30 -24
  319. data/spec/extensions/validation_class_methods_spec.rb +58 -67
  320. data/spec/extensions/validation_helpers_spec.rb +31 -37
  321. data/spec/extensions/xml_serializer_spec.rb +29 -4
  322. data/spec/files/transaction_specified_migrations/001_create_alt_basic.rb +4 -0
  323. data/spec/files/transaction_specified_migrations/002_create_basic.rb +4 -0
  324. data/spec/files/transaction_unspecified_migrations/001_create_alt_basic.rb +3 -0
  325. data/spec/files/transaction_unspecified_migrations/002_create_basic.rb +3 -0
  326. data/spec/integration/associations_test.rb +659 -21
  327. data/spec/integration/database_test.rb +11 -5
  328. data/spec/integration/dataset_test.rb +717 -129
  329. data/spec/integration/eager_loader_test.rb +38 -54
  330. data/spec/integration/migrator_test.rb +2 -3
  331. data/spec/integration/model_test.rb +81 -2
  332. data/spec/integration/plugin_test.rb +604 -147
  333. data/spec/integration/prepared_statement_test.rb +272 -128
  334. data/spec/integration/schema_test.rb +367 -57
  335. data/spec/integration/spec_helper.rb +42 -32
  336. data/spec/integration/timezone_test.rb +38 -12
  337. data/spec/integration/transaction_test.rb +183 -8
  338. data/spec/integration/type_test.rb +31 -8
  339. data/spec/model/association_reflection_spec.rb +207 -8
  340. data/spec/model/associations_spec.rb +1206 -693
  341. data/spec/model/base_spec.rb +334 -100
  342. data/spec/model/dataset_methods_spec.rb +45 -27
  343. data/spec/model/eager_loading_spec.rb +828 -692
  344. data/spec/model/hooks_spec.rb +355 -67
  345. data/spec/model/model_spec.rb +251 -179
  346. data/spec/model/plugins_spec.rb +24 -13
  347. data/spec/model/record_spec.rb +506 -232
  348. data/spec/model/spec_helper.rb +16 -77
  349. data/spec/model/validations_spec.rb +38 -2
  350. data/spec/rcov.opts +2 -0
  351. metadata +209 -80
  352. data/spec/core/core_sql_spec.rb +0 -451
data/doc/cheat_sheet.rdoc CHANGED
@@ -53,8 +53,8 @@ Without a filename argument, the sqlite adapter will setup a new sqlite database
53
53
 
54
54
  == Update/Delete rows
55
55
 
56
- dataset.filter(~:active).delete
57
- dataset.filter('price < ?', 100).update(:active => true)
56
+ dataset.exclude(:active).delete
57
+ dataset.where('price < ?', 100).update(:active => true)
58
58
 
59
59
  == Datasets are Enumerable
60
60
 
@@ -64,21 +64,21 @@ Without a filename argument, the sqlite adapter will setup a new sqlite database
64
64
  dataset.inject(0){|sum, r| sum + r[:value]}
65
65
  dataset.sum(:value) # same as above
66
66
 
67
- == Filtering (see also doc/dataset_filtering.rdoc)
67
+ == Filtering (see also {Dataset Filtering}[link:files/doc/dataset_filtering_rdoc.html])
68
68
 
69
69
  === Equality
70
70
 
71
- dataset.filter(:name => 'abc')
72
- dataset.filter('name = ?', 'abc')
71
+ dataset.where(:name => 'abc')
72
+ dataset.where('name = ?', 'abc')
73
73
 
74
74
  === Inequality
75
75
 
76
- dataset.filter{value > 100}
76
+ dataset.where{value > 100}
77
77
  dataset.exclude{value <= 100}
78
78
 
79
79
  === Inclusion
80
80
 
81
- dataset.filter(:value => 50..100)
81
+ dataset.where(:value => 50..100)
82
82
  dataset.where{(value >= 50) & (value <= 100)}
83
83
 
84
84
  dataset.where('value IN ?', [50,75,100])
@@ -89,34 +89,34 @@ Without a filename argument, the sqlite adapter will setup a new sqlite database
89
89
  === Subselects as scalar values
90
90
 
91
91
  dataset.where('price > (SELECT avg(price) + 100 FROM table)')
92
- dataset.filter{price > dataset.select(avg(price) + 100)}
92
+ dataset.where{price > dataset.select(avg(price) + 100)}
93
93
 
94
94
  === LIKE/Regexp
95
95
 
96
- DB[:items].filter(:name.like('AL%'))
97
- DB[:items].filter(:name => /^AL/)
96
+ DB[:items].where(Sequel.like(:name, 'AL%'))
97
+ DB[:items].where(:name => /^AL/)
98
98
 
99
99
  === AND/OR/NOT
100
100
 
101
- DB[:items].filter{(x > 5) & (y > 10)}.sql
101
+ DB[:items].where{(x > 5) & (y > 10)}.sql
102
102
  # SELECT * FROM items WHERE ((x > 5) AND (y > 10))
103
103
 
104
- DB[:items].filter({:x => 1, :y => 2}.sql_or & ~{:z => 3}).sql
104
+ DB[:items].where({:x => 1, :y => 2}.sql_or & Sequel.~(:z => 3)).sql
105
105
  # SELECT * FROM items WHERE (((x = 1) OR (y = 2)) AND (z != 3))
106
106
 
107
107
  === Mathematical operators
108
108
 
109
- DB[:items].filter((:x + :y) > :z).sql
109
+ DB[:items].where{x + y > z}.sql
110
110
  # SELECT * FROM items WHERE ((x + y) > z)
111
111
 
112
- DB[:items].filter{price - 100 < avg(price)}.sql
112
+ DB[:items].where{price - 100 < avg(price)}.sql
113
113
  # SELECT * FROM items WHERE ((price - 100) < avg(price))
114
114
 
115
115
  == Ordering
116
116
 
117
117
  dataset.order(:kind)
118
118
  dataset.reverse_order(:kind)
119
- dataset.order(:kind.desc, :name)
119
+ dataset.order(Sequel.desc(:kind), :name)
120
120
 
121
121
  == Limit/Offset
122
122
 
@@ -140,15 +140,15 @@ Without a filename argument, the sqlite adapter will setup a new sqlite database
140
140
  dataset.sum(:stock)
141
141
 
142
142
  dataset.group_and_count(:category)
143
- dataset.group(:category).select(:category, :AVG.sql_function(:price))
143
+ dataset.group(:category).select(:category, Sequel.function(:AVG, :price))
144
144
 
145
145
  == SQL Functions / Literals
146
146
 
147
- dataset.update(:updated_at => :NOW.sql_function)
148
- dataset.update(:updated_at => 'NOW()'.lit)
147
+ dataset.update(:updated_at => Sequel.function(:NOW))
148
+ dataset.update(:updated_at => Sequel.lit('NOW()'))
149
149
 
150
- dataset.update(:updated_at => "DateValue('1/1/2001')".lit)
151
- dataset.update(:updated_at => :DateValue.sql_function('1/1/2001'))
150
+ dataset.update(:updated_at => Sequel.lit("DateValue('1/1/2001')")
151
+ dataset.update(:updated_at => Sequel.function(:DateValue, '1/1/2001'))
152
152
 
153
153
  == Schema Manipulation
154
154
 
@@ -171,7 +171,7 @@ Without a filename argument, the sqlite adapter will setup a new sqlite database
171
171
 
172
172
  == Aliasing
173
173
 
174
- DB[:items].select(:name.as(:item_name))
174
+ DB[:items].select(Sequel.as(:name, :item_name))
175
175
  DB[:items].select(:name___item_name)
176
176
  DB[:items___items_table].select(:items_table__name___item_name)
177
177
  # SELECT items_table.name AS item_name FROM items AS items_table
@@ -0,0 +1,374 @@
1
+ = Sequel's Core Extensions
2
+
3
+ == Background
4
+
5
+ Historically, Sequel added methods to many of the core classes, and usage of those methods was the primary and recommended way to use Sequel. For example:
6
+
7
+ DB[:table].select(:column.cast(Integer)). # Symbol#cast
8
+ where(:column.like('A%')). # Symbol#like
9
+ order({1=>2}.case(0, :a)) # Hash#case
10
+
11
+ While Sequel never override any methods defined by ruby, it is possible that other libraries could define the same methods that Sequel defines, which could cause problems. Also, some rubyists do not like using libraries that add methods to the core classes.
12
+
13
+ Alternatives for the core extension methods where added to Sequel, so the query above could be written as:
14
+
15
+ DB[:table].select(Sequel.cast(:column, Integer)).
16
+ where(Sequel.like(:column, 'A%')).
17
+ order(Sequel.case({1=>2}, 0, :a))
18
+
19
+ Almost all of the core extension methods have a replacement on the Sequel module. So it is now up to the user which style to use. Using the methods on the Sequel module results in slightly more verbose code, but allows the code to work without modifications to the core classes.
20
+
21
+ == Issues
22
+
23
+ There is no recommendation on whether the core_extensions should be used or not. It is very rare that any of the methods added by core_extensions actually causes a problem, but some of them can make it more difficult to find other problems. For example, if you type:
24
+
25
+ do_somehting if value | other_value
26
+
27
+ while meaning to type:
28
+
29
+ do_something if value || other_value
30
+
31
+ and value is a Symbol, instead of a NoMethodError being raised because Symbol#| is not implemented by default, <tt>value | other_value</tt> will return a Sequel expression object, which if will evaluate as true, and do_something will be called.
32
+
33
+ == Usage
34
+
35
+ All of Sequel's extensions to the core classes are stored in Sequel's core_extensions extension, which you can load via:
36
+
37
+ Sequel.extension :core_extensions
38
+
39
+ For backwards compatibility, the core_extensions are loaded by default in Sequel 3. Starting in Sequel 4, the core extensions will no longer be loaded by default, so you will have to load the core_extensions extension manually using the above code. If you plan to use the core extensions, it's recommended that you manually load the extension, even in Sequel 3. If you do not plan to use the core extensions, you can change from:
40
+
41
+ require 'sequel'
42
+
43
+ to:
44
+
45
+ require 'sequel/no_core_ext'
46
+
47
+ which will load Sequel without the core extensions.
48
+
49
+ == No Internal Dependency
50
+
51
+ Sequel has no internal dependency on the core extensions. This includes Sequel's core, Sequel::Model, and all plugins and extensions that ship with Sequel. However, it is possible that external plugins and extensions will depend on the core extensions. Such plugins and extensions should be updated so that they no longer depend on the core extensions.
52
+
53
+ == Core Extension Methods
54
+
55
+ This section will briefly describe all of the methods added to the core classes, and what the alternative method is that doesn't require the core extensions.
56
+
57
+ === Symbol & String
58
+
59
+ ==== as
60
+
61
+ Symbol#as and String#as return Sequel aliased expressions using the provided alias:
62
+
63
+ :a.as(:b) # SQL: a AS b
64
+ 'a'.as(:b) # SQL: 'a' AS b
65
+
66
+ Alternative: Sequel.as:
67
+
68
+ Sequel.as(:a, :b)
69
+
70
+ ==== cast
71
+
72
+ Symbol#cast and String#cast return Sequel cast expressions for typecasting in the database:
73
+
74
+ :a.cast(Integer) # SQL: CAST(a AS integer)
75
+ 'a'.cast(Integer) # SQL: CAST('a' AS integer)
76
+
77
+ Alternative: Sequel.cast:
78
+
79
+ Sequel.cast(:a, Integer)
80
+
81
+ ==== cast_numeric
82
+
83
+ Symbol#cast_numeric and String#cast_numeric return Sequel cast expressions for typecasting in the database, defaulting to integers, where the returned expression is treated as an numeric value:
84
+
85
+ :a.cast_numeric # SQL: CAST(a AS integer)
86
+ 'a'.cast_numeric(Float) # SQL: CAST('a' AS double precision)
87
+
88
+ Alternative: Sequel.cast_numeric:
89
+
90
+ Sequel.cast_numeric(:a)
91
+
92
+ ==== cast_string
93
+
94
+ Symbol#cast_string and String#cast_string return Sequel cast expressions for typecasting in the database, defaulting to strings, where the returned expression is treated as a string value:
95
+
96
+ :a.cast_string # SQL: CAST(a AS varchar(255))
97
+ 'a'.cast_string(:text) # SQL: CAST('a' AS text)
98
+
99
+ Alternative: Sequel.cast_string:
100
+
101
+ Sequel.cast_string(:a)
102
+
103
+ === Symbol
104
+
105
+ ==== identifier
106
+
107
+ Symbol#identifier wraps the symbol in a single identifier that will not be split. By default, Sequel will split symbols with double or triple underscores to do qualifying and aliasing.
108
+
109
+ :table__column.identifier # SQL: table__column
110
+
111
+ Alternative: Sequel.identifier:
112
+
113
+ Sequel.identifier(:table__column)
114
+
115
+ ==== asc
116
+
117
+ Symbol#asc is used to define an ascending order on a column. It exists mostly for consistency with #desc, since ascending is the default order:
118
+
119
+ :a.asc # SQL: a ASC
120
+
121
+ Alternative: Sequel.asc:
122
+
123
+ Sequel.asc(:a)
124
+
125
+ ==== desc
126
+
127
+ Symbol#desc is used to defined a descending order on a column. The returned value is usually passed to one of the dataset order methods.
128
+
129
+ :a.desc # SQL: a DESC
130
+
131
+ Alternative: Sequel.desc:
132
+
133
+ Sequel.desc(:a)
134
+
135
+ ==== +, -, *, /
136
+
137
+ The standard mathematical operators are defined on Symbol, and return a Sequel numeric expression object representing the operation:
138
+
139
+ :a + :b # SQL: a + b
140
+ :a - :b # SQL: a - b
141
+ :a * :b # SQL: a * b
142
+ :a / :b # SQL: a / b
143
+
144
+ Alternatives:
145
+
146
+ Sequel.+(:a, :b)
147
+ Sequel.-(:a, :b)
148
+ Sequel.*(:a, :b)
149
+ Sequel./(:a, :b)
150
+
151
+ ==== *
152
+
153
+ The * operator is overloaded on Symbol such that if it is called with no arguments, it represents a selection of all columns in the table:
154
+
155
+ :a.* # SQL: a.*
156
+
157
+ Alternative: Sequel.expr.*:
158
+
159
+ Sequel.expr(:a).*
160
+
161
+ ==== qualify
162
+
163
+ Symbol#qualify qualifies the identifier (e.g. a column) with a another identifier (e.g. a table):
164
+
165
+ :column.qualify(:table) # SQL: table.column
166
+
167
+ Alternative: Sequel.qualify:
168
+
169
+ Sequel.qualify(:table, :column)
170
+
171
+ Note the reversed order of the arguments. For the Symbol#qualify method, the argument is the qualifier, while for Sequel.qualify, the qualifier is the first argument.
172
+
173
+ ==== like
174
+
175
+ Symbol#like returns a case sensitive LIKE expression between the identifier and the given argument:
176
+
177
+ :a.like('b%') # SQL: a LIKE 'b%'
178
+
179
+ Alternative: Sequel.like:
180
+
181
+ Sequel.like(:a, 'b%')
182
+
183
+ ==== like
184
+
185
+ Symbol#ilike returns a case insensitive LIKE expression between the identifier and the given argument:
186
+
187
+ :a.ilike('b%') # SQL: a ILIKE 'b%'
188
+
189
+ Alternative: Sequel.ilike:
190
+
191
+ Sequel.ilike(:a, 'b%')
192
+
193
+ ==== sql_subscript
194
+
195
+ Symbol#sql_subscript returns a Sequel expression representing an SQL array access:
196
+
197
+ :a.sql_subscript(1) # SQL: a[1]
198
+
199
+ Alternative: Sequel.subscript:
200
+
201
+ Sequel.subscript(:a, 1)
202
+
203
+ ==== extract
204
+
205
+ Symbol#extract does a datetime part extraction from the receiver:
206
+
207
+ :a.extract(:year) # SQL: extract(year FROM a)
208
+
209
+ Alternative: Sequel.extract:
210
+
211
+ Sequel.extract(:year, :a)
212
+
213
+ Note the reversed order of the arguments. In Symbol#extract, the datetime part is the argument, while in Sequel.extract, the datetime part is the first argument.
214
+
215
+ ==== sql_boolean, sql_number, sql_string
216
+
217
+ These Symbol methods are used to force the treating of the object as a specific SQL type, instead of as a general SQL type. For example:
218
+
219
+ :a.sql_boolean + 1 # NoMethodError
220
+ :a.sql_number << 1 # SQL: a << 1
221
+ :a.sql_string + 'a' # SQL: a || 'a'
222
+
223
+ Alternative: Sequel.expr:
224
+
225
+ Sequel.expr(:a).sql_boolean
226
+ Sequel.expr(:a).sql_number
227
+ Sequel.expr(:a).sql_string
228
+
229
+ ==== sql_function
230
+
231
+ Symbol#sql_function returns an SQL function call expression object:
232
+
233
+ :now.sql_function # SQL: now()
234
+ :sum.sql_function(:a) # SQL: sum(a)
235
+ :concat.sql_function(:a, :b) # SQL: concat(a, b)
236
+
237
+ Alternative: Sequel.function:
238
+
239
+ Sequel.function(:now, :a)
240
+
241
+ === String
242
+
243
+ ==== lit
244
+
245
+ String#lit creates a literal string, using placeholders if any arguments are given. Literal strings are not escaped, they are treated as SQL code, not as an SQL string:
246
+
247
+ 'a'.lit # SQL: a
248
+ '"a" = ?'.lit(1) # SQL: "a" = 1
249
+
250
+ Alternative: Sequel.lit:
251
+
252
+ Sequel.lit('a')
253
+
254
+ ==== to_sequel_blob
255
+
256
+ String#to_sequel_blob returns the string wrapper in Sequel blob object. Often blobs need to be handled differently than regular strings by the database adapters.
257
+
258
+ "a\0".to_sequel_blob # SQL: X'6100'
259
+
260
+ Alternative: Sequel.blob:
261
+
262
+ Sequel.blob("a\0")
263
+
264
+ === Hash, Array, & Symbol
265
+
266
+ ==== ~
267
+
268
+ Array#~, Hash#~, and Symbol#~ treat the receiver as a conditions specifier, not matching all of the conditions:
269
+
270
+ ~{:a=>1, :b=>[2, 3]} # SQL: a != 1 OR b NOT IN (2, 3)
271
+ ~[[:a, 1], [:b, [1, 2]]] # SQL: a != 1 OR b NOT IN (1, 2)
272
+
273
+ Alternative: Sequel.~:
274
+
275
+ Sequel.~(:a=>1, :b=>[2, 3])
276
+
277
+ === Hash & Array
278
+
279
+ ==== case
280
+
281
+ Array#case and Hash#case return an SQL CASE expression, where the keys are conditions and the values are results:
282
+
283
+ {{:a=>[2,3]}=>1}.case(0) # SQL: CASE WHEN a IN (2, 3) THEN 1 ELSE 0 END
284
+ [[{:a=>[2,3]}, 1]].case(0) # SQL: CASE WHEN a IN (2, 3) THEN 1 ELSE 0 END
285
+
286
+ Alternative: Sequel.case:
287
+
288
+ Sequel.case({:a=>[2,3]}=>1}, 0)
289
+
290
+ ==== sql_expr
291
+
292
+ Array#sql_expr and Hash#sql_expr treat the receiver as a conditions specifier, matching all of the conditions in the array.
293
+
294
+ {:a=>1, :b=>[2, 3]}.sql_expr # SQL: a = 1 AND b IN (2, 3)
295
+ [[:a, 1], [:b, [2, 3]]].sql_expr # SQL: a = 1 AND b IN (2, 3)
296
+
297
+ Alternative: Sequel.expr:
298
+
299
+ Sequel.expr(:a=>1, :b=>[2, 3])
300
+
301
+ ==== sql_negate
302
+
303
+ Array#sql_negate and Hash#sql_negate treat the receiver as a conditions specifier, matching none of the conditions in the array:
304
+
305
+ {:a=>1, :b=>[2, 3]}.sql_negate # SQL: a != 1 AND b NOT IN (2, 3)
306
+ [[:a, 1], [:b, [2, 3]]].sql_negate # SQL: a != 1 AND b NOT IN (2, 3)
307
+
308
+ Alternative: Sequel.negate:
309
+
310
+ Sequel.negate(:a=>1, :b=>[2, 3])
311
+
312
+ ==== sql_or
313
+
314
+ Array#sql_or nd Hash#sql_or treat the receiver as a conditions specifier, matching any of the conditions in the array:
315
+
316
+ {:a=>1, :b=>[2, 3]}.sql_or # SQL: a = 1 OR b IN (2, 3)
317
+ [[:a, 1], [:b, [2, 3]]].sql_or # SQL: a = 1 OR b IN (2, 3)
318
+
319
+ Alternative: Sequel.or:
320
+
321
+ Sequel.or(:a=>1, :b=>[2, 3])
322
+
323
+ === Array
324
+
325
+ ==== sql_value_list
326
+
327
+ Array#sql_value_list wraps the array in an array subclass, which Sequel will always treat as a value list and not a conditions specifier. By default, Sequel treats arrays of two element arrays as a conditions specifier.
328
+
329
+ DB[:a].filter('(a, b) IN ?', [[1, 2], [3, 4]]) # SQL: (a, b) IN ((1 = 2) AND (3 = 4))
330
+ DB[:a].filter('(a, b) IN ?', [[1, 2], [3, 4]].sql_value_list) # SQL: (a, b) IN ((1, 2), (3, 4))
331
+
332
+ Alternative: Sequel.value_list:
333
+
334
+ Sequel.value_list([[1, 2], [3, 4]])
335
+
336
+ ==== sql_string_join
337
+
338
+ Array#sql_string_join joins all of the elements in the array in an SQL string concatentation expression:
339
+
340
+ [:a].sql_string_join # SQL: a
341
+ [:a, :b].sql_string_join # SQL: a || b
342
+ [:a, 'b'].sql_string_join # SQL: a || 'b'
343
+ ['a', :b].sql_string_join(' ') # SQL: 'a' || ' ' || b
344
+
345
+ Alternative: Sequel.join:
346
+
347
+ Sequel.join(['a', :b], ' ')
348
+
349
+ === Hash & Symbol
350
+
351
+ ==== &
352
+
353
+ Hash#& and Symbol#& return a Sequel boolean expression, matching the condition specified by the receiver and the condition specified by the given argument:
354
+
355
+ :a & :b # SQL: a AND b
356
+ {:a=>1} & :b # SQL: a = 1 AND b
357
+ {:a=>true} & :b # SQL: a IS TRUE AND b
358
+
359
+ Alternative: Sequel.&:
360
+
361
+ Sequel.&({:a=>1}, :b)
362
+
363
+ ==== |
364
+
365
+ Hash#| returns a Sequel boolean expression, matching the condition specified by the receiver or the condition specified by the given argument:
366
+
367
+ :a | :b # SQL: a OR b
368
+ {:a=>1} | :b # SQL: a = 1 OR b
369
+ {:a=>true} | :b # SQL: a IS TRUE OR b
370
+
371
+ Alternative: Sequel.|:
372
+
373
+ Sequel.|({:a=>1}, :b)
374
+
@@ -2,7 +2,7 @@
2
2
 
3
3
  == Introduction
4
4
 
5
- Datasets are probably the thing that separate Sequel from other database libraries. While most database libraries have specific support for updating all records or only a single record, Sequel's ability to represent SQL queries themselves as objects is what gives Sequel most of its power. However, if you haven't been exposed to the dataset concept before, it can be a little disorienting. This document aims to give a basic introduction to datasets and how to use them.
5
+ Datasets are the primary way Sequel uses to access the database. While most database libraries have specific support for updating all records or only a single record, Sequel's ability to represent SQL queries themselves as objects is what gives Sequel most of its power. However, if you haven't been exposed to the dataset concept before, it can be a little disorienting. This document aims to give a basic introduction to datasets and how to use them.
6
6
 
7
7
  == What a Dataset Represents
8
8
 
@@ -24,23 +24,23 @@ Here, DB represents your Sequel::Database object, and ds is your dataset, with t
24
24
 
25
25
  One of the core dataset ideas that should be understood is that datasets use a functional style of modification, in which methods called on the dataset return modified copies of the dataset, they don't modify the dataset themselves:
26
26
 
27
- ds2 = ds.filter(:id=>1)
27
+ ds2 = ds.where(:id=>1)
28
28
  ds2
29
29
  # SELECT * FROM posts WHERE id = 1
30
30
  ds
31
31
  # SELECT * FROM posts
32
32
 
33
- Note how ds itself is not modified. This is because ds.filter returns a modified copy of ds, instead of modifying ds itself. This makes using datasets both thread safe and easy to chain:
33
+ Note how ds itself is not modified. This is because ds.where returns a modified copy of ds, instead of modifying ds itself. This makes using datasets both thread safe and easy to chain:
34
34
 
35
35
  # Thread safe:
36
36
  100.times do |i|
37
37
  Thread.new do
38
- ds.filter(:id=>i).first
38
+ ds.where(:id=>i).first
39
39
  end
40
40
  end
41
41
 
42
42
  # Easy to chain:
43
- ds3 = ds.select(:id, :name).order(:name).filter{id < 100}
43
+ ds3 = ds.select(:id, :name).order(:name).where{id < 100}
44
44
  # SELECT id, name FROM posts WHERE id < 100 ORDER BY name
45
45
 
46
46
  Thread safety you don't really need to worry about, but chainability is core to how Sequel is generally used. Almost all dataset methods that affect the SQL produced return modified copies of the receiving dataset.
@@ -74,12 +74,12 @@ Most Dataset methods that users will use can be broken down into two types:
74
74
 
75
75
  Most dataset methods fall into this category, which can be further broken down by the clause they affect:
76
76
 
77
- SELECT:: select, select_all, select_append, select_more
77
+ SELECT:: select, select_all, select_append, select_group, select_more
78
78
  FROM:: from, from_self
79
79
  JOIN:: join, left_join, right_join, full_join, natural_join, natural_left_join, natural_right_join, natural_full_join, cross_join, inner_join, left_outer_join, right_outer_join, full_outer_join, join_table
80
- WHERE:: where, filter, exclude, and, or, grep, invert, unfiltered
81
- GROUP:: group, group_by, group_and_count, ungrouped
82
- HAVING:: having, filter, exclude, and, or, grep, invert, unfiltered
80
+ WHERE:: where, filter, exclude, exclude_where, and, or, grep, invert, unfiltered
81
+ GROUP:: group, group_by, group_and_count, select_group, ungrouped
82
+ HAVING:: having, filter, exclude, exclude_having, and, or, grep, invert, unfiltered
83
83
  ORDER:: order, order_by, order_append, order_prepend, order_more, reverse, reverse_order, unordered
84
84
  LIMIT:: limit, unlimited
85
85
  compounds:: union, intersect, except
@@ -93,7 +93,7 @@ other:: clone, distinct, naked, server, with_sql
93
93
 
94
94
  Most other dataset methods commonly used will execute the dataset's SQL on the database:
95
95
 
96
- SELECT (All Records):: all, each, map, to_hash, select_map, select_order_map, select_hash, to_csv
96
+ SELECT (All Records):: all, each, map, to_hash, to_hash_groups, select_map, select_order_map, select_hash, select_hash_groups, to_csv
97
97
  SELECT (First Record):: first, last, get, []
98
98
  SELECT (Aggregates):: count, avg, max, min, sum, range, interval
99
99
  INSERT:: insert, <<, import, multi_insert, insert_multiple