Permalink
Browse files

Importing from old repository.

  • Loading branch information...
1 parent 648ca80 commit e8b4f3bf25a82bc4740e0c04cb20498a59cb3ede @sam sam committed Mar 2, 2008
Showing with 17,725 additions and 0 deletions.
  1. +145 −0 CHANGELOG
  2. +124 −0 FAQ
  3. +22 −0 MIT-LICENSE
  4. +742 −0 PERFORMANCE
  5. +12 −0 QUICKLINKS
  6. +151 −0 README
  7. +4 −0 all
  8. +2 −0 bin/.irbrc
  9. +7 −0 bin/dm
  10. +54 −0 environment.rb
  11. +156 −0 example.rb
  12. +92 −0 lib/data_mapper.rb
  13. +43 −0 lib/data_mapper/adapters/abstract_adapter.rb
  14. +479 −0 lib/data_mapper/adapters/data_object_adapter.rb
  15. +71 −0 lib/data_mapper/adapters/mysql_adapter.rb
  16. +257 −0 lib/data_mapper/adapters/postgresql_adapter.rb
  17. +134 −0 lib/data_mapper/adapters/sql/coersion.rb
  18. +545 −0 lib/data_mapper/adapters/sql/commands/load_command.rb
  19. +34 −0 lib/data_mapper/adapters/sql/mappings/associations_set.rb
  20. +279 −0 lib/data_mapper/adapters/sql/mappings/column.rb
  21. +172 −0 lib/data_mapper/adapters/sql/mappings/conditions.rb
  22. +60 −0 lib/data_mapper/adapters/sql/mappings/schema.rb
  23. +459 −0 lib/data_mapper/adapters/sql/mappings/table.rb
  24. +24 −0 lib/data_mapper/adapters/sql/quoting.rb
  25. +158 −0 lib/data_mapper/adapters/sqlite3_adapter.rb
  26. +106 −0 lib/data_mapper/associations.rb
  27. +160 −0 lib/data_mapper/associations/belongs_to_association.rb
  28. +437 −0 lib/data_mapper/associations/has_and_belongs_to_many_association.rb
  29. +283 −0 lib/data_mapper/associations/has_many_association.rb
  30. +143 −0 lib/data_mapper/associations/has_n_association.rb
  31. +47 −0 lib/data_mapper/associations/reference.rb
  32. +73 −0 lib/data_mapper/attributes.rb
  33. +36 −0 lib/data_mapper/auto_migrations.rb
  34. +107 −0 lib/data_mapper/callbacks.rb
  35. +192 −0 lib/data_mapper/cli.rb
  36. +167 −0 lib/data_mapper/container.rb
  37. +112 −0 lib/data_mapper/context.rb
  38. +28 −0 lib/data_mapper/dependency_queue.rb
  39. +145 −0 lib/data_mapper/embedded_value.rb
  40. +47 −0 lib/data_mapper/identity_map.rb
  41. +121 −0 lib/data_mapper/is/tree.rb
  42. +206 −0 lib/data_mapper/logger.rb
  43. +155 −0 lib/data_mapper/migration.rb
  44. +13 −0 lib/data_mapper/model.rb
  45. +873 −0 lib/data_mapper/persistable.rb
  46. +324 −0 lib/data_mapper/property.rb
  47. +164 −0 lib/data_mapper/query.rb
  48. +235 −0 lib/data_mapper/repository.rb
  49. +53 −0 lib/data_mapper/resource.rb
  50. +35 −0 lib/data_mapper/support/blank.rb
  51. +117 −0 lib/data_mapper/support/connection_pool.rb
  52. +35 −0 lib/data_mapper/support/enumerable.rb
  53. +16 −0 lib/data_mapper/support/errors.rb
  54. +265 −0 lib/data_mapper/support/inflector.rb
  55. +54 −0 lib/data_mapper/support/object.rb
  56. +96 −0 lib/data_mapper/support/serialization.rb
  57. +10 −0 lib/data_mapper/support/silence.rb
  58. +72 −0 lib/data_mapper/support/string.rb
  59. +7 −0 lib/data_mapper/support/struct.rb
  60. +82 −0 lib/data_mapper/support/symbol.rb
  61. +68 −0 lib/data_mapper/support/typed_set.rb
  62. +44 −0 lib/data_mapper/types/base.rb
  63. +34 −0 lib/data_mapper/types/string.rb
  64. +12 −0 lib/data_mapper/validatable_extensions/errors.rb
  65. +7 −0 lib/data_mapper/validatable_extensions/macros.rb
  66. +62 −0 lib/data_mapper/validatable_extensions/validatable_instance_methods.rb
  67. +18 −0 lib/data_mapper/validatable_extensions/validation_base.rb
  68. +43 −0 lib/data_mapper/validatable_extensions/validations/formats/email.rb
  69. +7 −0 lib/data_mapper/validatable_extensions/validations/validates_acceptance_of.rb
  70. +7 −0 lib/data_mapper/validatable_extensions/validations/validates_confirmation_of.rb
  71. +7 −0 lib/data_mapper/validatable_extensions/validations/validates_each.rb
  72. +28 −0 lib/data_mapper/validatable_extensions/validations/validates_format_of.rb
  73. +15 −0 lib/data_mapper/validatable_extensions/validations/validates_length_of.rb
  74. +7 −0 lib/data_mapper/validatable_extensions/validations/validates_numericality_of.rb
  75. +7 −0 lib/data_mapper/validatable_extensions/validations/validates_presence_of.rb
  76. +7 −0 lib/data_mapper/validatable_extensions/validations/validates_true_for.rb
  77. +40 −0 lib/data_mapper/validatable_extensions/validations/validates_uniqueness_of.rb
  78. +20 −0 lib/data_mapper/validations.rb
  79. +40 −0 lib/data_mapper/validations/number_validator.rb
  80. +20 −0 lib/data_mapper/validations/string_validator.rb
  81. +13 −0 lib/data_mapper/validations/validator.rb
  82. +2 −0 log/spec.log
  83. +307 −0 performance.rb
  84. +1 −0 plugins/.gitignore
  85. +23 −0 plugins/can_has_sphinx/LICENSE
  86. +4 −0 plugins/can_has_sphinx/README
  87. +1 −0 plugins/can_has_sphinx/REVISION
  88. +22 −0 plugins/can_has_sphinx/Rakefile
  89. +1 −0 plugins/can_has_sphinx/init.rb
  90. +1 −0 plugins/can_has_sphinx/install.rb
  91. +123 −0 plugins/can_has_sphinx/lib/acts_as_sphinx.rb
  92. +460 −0 plugins/can_has_sphinx/lib/sphinx.rb
  93. +47 −0 plugins/can_has_sphinx/scripts/sphinx.sh
  94. +41 −0 plugins/can_has_sphinx/tasks/acts_as_sphinx_tasks.rake
  95. +40 −0 profile_data_mapper.rb
  96. +161 −0 rakefile.rb
  97. +67 −0 spec/acts_as_tree_spec.rb
  98. +31 −0 spec/adapters/data_object_adapter_spec.rb
  99. +98 −0 spec/associations/belongs_to_association_spec.rb
  100. +377 −0 spec/associations/has_and_belongs_to_many_association_spec.rb
  101. +337 −0 spec/associations/has_many_association_spec.rb
  102. +52 −0 spec/attributes_spec.rb
  103. +100 −0 spec/auto_migrations_spec.rb
  104. +186 −0 spec/callbacks_spec.rb
  105. +113 −0 spec/cli_spec.rb
  106. +41 −0 spec/coersion_spec.rb
  107. +114 −0 spec/column_spec.rb
  108. +83 −0 spec/container_spec.rb
  109. +45 −0 spec/count_command_spec.rb
  110. +18 −0 spec/database_spec.rb
  111. +27 −0 spec/dataobjects_spec.rb
  112. +11 −0 spec/delete_command_spec.rb
  113. +29 −0 spec/dependency_spec.rb
  114. +161 −0 spec/embedded_value_spec.rb
  115. +33 −0 spec/fixtures/animals.yaml
  116. +2 −0 spec/fixtures/animals_exhibits.yaml
  117. +5 −0 spec/fixtures/careers.yaml
  118. +1 −0 spec/fixtures/comments.yaml
  119. +90 −0 spec/fixtures/exhibits.yaml
  120. +6 −0 spec/fixtures/fruit.yaml
  121. +37 −0 spec/fixtures/people.yaml
  122. +3 −0 spec/fixtures/posts.yaml
  123. +13 −0 spec/fixtures/projects.yaml
  124. +5 −0 spec/fixtures/sections.yaml
  125. +6 −0 spec/fixtures/serializers.yaml
  126. +6 −0 spec/fixtures/tasks.yaml
  127. +2 −0 spec/fixtures/tasks_tasks.yaml
  128. +1 −0 spec/fixtures/tomatoes.yaml
  129. +1 −0 spec/fixtures/users.yaml
  130. +24 −0 spec/fixtures/zoos.yaml
  131. +149 −0 spec/is_a_tree_spec.rb
  132. +16 −0 spec/legacy_spec.rb
  133. +322 −0 spec/load_command_spec.rb
  134. +26 −0 spec/magic_columns_spec.rb
  135. +267 −0 spec/migration_spec.rb
  136. +20 −0 spec/mock_adapter.rb
  137. +12 −0 spec/models/animal.rb
  138. +8 −0 spec/models/candidate.rb
  139. +7 −0 spec/models/career.rb
  140. +8 −0 spec/models/chain.rb
  141. +6 −0 spec/models/comment.rb
  142. +14 −0 spec/models/exhibit.rb
  143. +7 −0 spec/models/fence.rb
  144. +8 −0 spec/models/fruit.rb
  145. +8 −0 spec/models/job.rb
  146. +30 −0 spec/models/person.rb
  147. +14 −0 spec/models/post.rb
  148. +41 −0 spec/models/project.rb
  149. +5 −0 spec/models/sales_person.rb
  150. +8 −0 spec/models/section.rb
  151. +5 −0 spec/models/serializer.rb
  152. +9 −0 spec/models/task.rb
  153. +27 −0 spec/models/tomato.rb
  154. +13 −0 spec/models/user.rb
  155. +13 −0 spec/models/zoo.rb
  156. +36 −0 spec/natural_key_spec.rb
  157. +38 −0 spec/paranoia_spec.rb
  158. +479 −0 spec/persistable_spec.rb
  159. +96 −0 spec/postgres_spec.rb
  160. +151 −0 spec/property_spec.rb
  161. +77 −0 spec/query_spec.rb
  162. +31 −0 spec/resource_spec.rb
  163. +94 −0 spec/save_command_spec.rb
  164. +5 −0 spec/schema_spec.rb
  165. +19 −0 spec/serialize_spec.rb
  166. +43 −0 spec/single_table_inheritance_spec.rb
  167. +45 −0 spec/spec_helper.rb
  168. +8 −0 spec/support/blank_spec.rb
  169. +41 −0 spec/support/inflector_spec.rb
  170. +9 −0 spec/support/object_spec.rb
  171. +61 −0 spec/support/serialization_spec.rb
  172. +15 −0 spec/support/silence_spec.rb
  173. +7 −0 spec/support/string_spec.rb
  174. +12 −0 spec/support/struct_spec.rb
  175. +66 −0 spec/support/typed_set_spec.rb
  176. +27 −0 spec/symbolic_operators_spec.rb
  177. +79 −0 spec/table_spec.rb
  178. +81 −0 spec/types/string.rb
  179. +55 −0 spec/validates_confirmation_of_spec.rb
  180. +77 −0 spec/validates_format_of_spec.rb
  181. +117 −0 spec/validates_length_of_spec.rb
  182. +92 −0 spec/validates_uniqueness_of_spec.rb
  183. +59 −0 spec/validations/number_validator.rb
  184. +14 −0 spec/validations/string_validator.rb
  185. +141 −0 spec/validations_spec.rb
  186. +53 −0 tasks/fixtures.rb
  187. +9 −0 www/Rakefile
  188. +11 −0 www/content/compare.txt
  189. +51 −0 www/content/contribute.txt
  190. +27 −0 www/content/css/coderay.css
  191. +7 −0 www/content/css/ie_hacks.css
  192. +201 −0 www/content/css/site.css
  193. +65 −0 www/content/docs/associations.txt
  194. +80 −0 www/content/docs/callbacks.txt
  195. +83 −0 www/content/docs/create_and_destroy.txt
  196. +116 −0 www/content/docs/find.txt
  197. +31 −0 www/content/docs/index.txt
  198. +47 −0 www/content/docs/install.txt
  199. +100 −0 www/content/docs/properties.txt
  200. BIN www/content/files/merb_datamapper.tmbundle.zip
  201. +29 −0 www/content/get.txt
  202. +131 −0 www/content/getting_started.txt
  203. BIN www/content/images/content_bkg.gif
  204. BIN www/content/images/download_button.gif
  205. BIN www/content/images/footer_bkg.gif
  206. BIN www/content/images/get_button.gif
  207. BIN www/content/images/header_bkg.gif
  208. BIN www/content/images/home_bkg.gif
  209. BIN www/content/images/logo.gif
  210. BIN www/content/images/new_release_bkg.gif
  211. BIN www/content/images/page_bkg.gif
  212. +38 −0 www/content/index.txt
  213. +145 −0 www/content/using-git.rhtml
  214. +130 −0 www/content/why.txt
  215. +41 −0 www/layouts/default.rhtml
  216. +12 −0 www/tasks/create.rake
  217. +22 −0 www/tasks/deploy.rake
  218. +26 −0 www/tasks/heel.rake
  219. +27 −0 www/tasks/setup.rb
  220. +18 −0 www/templates/page.erb
View
@@ -0,0 +1,145 @@
+-- 0.1.0
+* Initial Public Release
+
+-- 0.1.1
+* Removed /lib/data_mapper/extensions
+* Moved ActiveRecordImpersonation into DataMapper::Support module
+* Moved CallbackHelper methods into DataMapper::Base class
+* Moved ValidationHelper into DataMapper::Validations module
+* Removed LoadedSet since it's not necessary for it to reference the Database, so it's nothing more than an array now; Replaced with Array
+* Modified data_mapper.rb to load DataMapper::Support::Enumerable
+* Modified example.rb and performance.rb to require 'lib/data_mapper' instead of modifying $LOADPATH
+* Created SqlAdapter base-class
+* Refactored MysqlAdapter to use SqlAdapter superclass
+* Refactored Sqlite3Adapter to use SqlAdapter superclass
+* Moved /lib/data_mapper/queries to /lib/data_mapper/adapters/sql/queries
+* Moved Connection, Result and Reader classes along with Coersion and Quoting modules to DataMapper::Adapters::Sql module
+* Moved DataMapper::Adapters::Sql::Queries to ::Commands
+* Moved Mappings to SqlAdapter
+* Added monolithic DeleteCommand
+* Added monolithic SaveCommand
+* Added TableExistsCommand
+* Moved save/delete logic out of Session
+* Added create-table functionality to SaveCommand
+* Cleaned up Session; #find no longer supported, use #all or #first
+* Moved object materialization into LoadCommand
+* Migrated Sqlite3Adapter::Commands
+* Added Session#query support back in
+* Removed Connection/Reader/Result classes
+* Set DataMapper::Base#key on load to avoid double-hit against Schema
+* Added DataMapper::Support::Struct for increased Session#query performance
+* Added AdvancedHasManyAssociation (preview status)
+* Added benchmarks comparing ActiveRecord::Base::find_by_sql with Session#query
+
+-- 0.2.0
+* AdvancedHasManyAssociation now functional for fetches
+* AdvancedHasManyAssociation renamed to HasNAssociation
+* HasManyAssociation refactored to use HasNAssociation superclass
+* Slight spec tweaks to accomodate the updates
+* HasOneAssociation refactored to use HasNAssociation superclass
+* Added HasAndBelongsToManyAssociation, using HasNAssociation as a basis; Need to add corresponding SQL generation code in AdvancedLoadCommand
+* Added spec for habtm query generation
+* HasNAssociation#foreign_key returns a DataMapper::Adapters::Sql::Mappings::Column instance instead of a raw String now
+* Added table, association, association_table and to_sql methods to HasNAssociation
+* Added associations_spec.rb
+* Added a forced table-recreation to spec_helper.rb so the tests could run with a clean version of the database, including any new columns added to the models
+* Added HasAndBelongsToManyAssociation#to_sql (all current specs pass now!)
+* Minor tweaks to Callbacks
+* Added CallbacksHelper to declare class-method ::callbacks on DataMapper::Base
+* Implemented before_validate and after_validate hooks in ValidationHelper
+* Minor documentation additions in callbacks.rb
+* Added callbacks_spec
+* Moved class-method declarations for built-in callbacks to the callbacks helper instead of DataMapper::Base
+* Renamed :before/after_validate callback to :before/after_validation to match ActiveRecord
+* Callbacks#add now accepts a Symbol which maps a callback to a method call on the targetted instance, also added a spec to verify this behavior
+* Documented callbacks.rb
+* Added DataMapper::Associations::Reference class
+* Documented DataMapper::Associations::Reference class
+* Upgraded BelongsToAssociation to new style
+* Added AssociationsSet to handle simple "last-in" for association bindings
+* Fixed extra spec loading
+* Added *Association#columns
+* Some refactoring in AdvancedLoadCommand regarding :include options
+* Added support for class-less Mappings::Table instances, with just a string name
+* HasAndBelongsToManyAssociation#join_table #left_foreign_key and #right_foreign_key reference actual Table or Column objects now
+* Added :shallow_include option for HABTM joins in AdvancedLoadCommand and corresponding spec
+* Added Commands::AdvancedConditions
+* Added ORDER, LIMIT, OFFSET and WHERE support to AdvancedLoadCommand
+* Renamed spec/has_many.rb to spec/has_many_spec.rb
+* Tweaked the loading of has_many relationships; big performance boost; got rid of an extra query
+* Added EmbeddedValue support, and accompanying spec
+* Fleshed out AdvancedConditions a bit; added conditions_spec.rb
+* Added more AdvancedConditions specs
+* Added Loader to handle multi-instanced rows
+* AdvancedLoadCommand replaced LoadCommand; down to 3 failing specs
+* All specs pass
+* Added :intercept_load finder option and accompanying spec
+* Modified :intercept_load block signature to |instance,columns,row|
+* HasAndBelongsToMany works, all specs pass
+* Fixed a couple bugs with keys; Added DataMapper::Base#key= method
+* Made DataMapper::Base#lazy_load! a little more flexible
+* Removed LoadCommand overwrites from MysqlAdapter
+* Default Database#single_threaded mode is true now
+* Removed MysqlAdapter#initialize, which only served to setup the connections, moved to SqlAdapter
+* Added SqlAdapter#create_connection and SqlAdapter#close_connection abstract methods
+* Added MysqlAdapter#create_connection and MysqlAdapter#close_connection concrete methods
+* Made SqlAdapter#connection a concrete method (instead of abstract), with support for single_threaded operation
+* Database#setup now takes a Hash of options instead of a block-initializer
+* Validation chaining should work for all association types
+* Save chaining should work for has_many associations
+* Added benchmarks for in-session performance to performance.rb
+* Removed block conditions; They're slower and don't offer any real advantages
+* Removed DeleteCommand
+* Removed SaveCommand
+* Removed TableExistsCommand
+* Session renamed to Context
+* Most command implementations moved to methods in SqlAdapter
+* Removed UnitOfWork module, instead moving a slightly refactored implementation into Base
+
+-- 0.2.1
+* Added :float column support
+* Added association proxies: ie: Zoo.first.exhibits.animals
+* Columns stored in SortedSet
+* Swig files are no longer RDOCed
+* Added :date column support
+* BUG: Fixed UTC issues with datetimes
+* Added #to_yaml method
+* Added #to_xml method
+* Added #to_json method
+* BUG: Fixed HasManyAssociation::Set#inspect
+* BUG: Fixed #reload!
+* BUG: Column copy for STI moved into Table#initialize to better handle STI with multiple mapped databases
+* BUG: before_create callbacks moved in the execution flow since they weren't guaranteed to fire before
+* Threading enhancements: Removed single_threaded_mode, #database block form adjusted for thread-safety
+* BUG: Fixed String#blank? when a multi-line string contained a blank line (thanks zapnap!)
+* Performance enhancements: (thanks wycats!)
+
+-- 0.2.2
+* Removed C extension bundles and log files from package
+
+-- 0.2.3
+* Added String#t for translation and overrides for default validation messages
+* Give credit where it's due: zapnap, not pimpmaster, submitted the String#blank? patch. My bad. :-(
+* MAJOR: Resolve issue with non-unique-hash values and #dirty?; now frozen original values are stored instead
+* Added Base#update_attributes
+* MAJOR: Queries are now passed to the database drivers in a parameterized fashion
+* Updated PostgreSQL driver and adapter to current
+
+-- 0.2.4
+* Bug fixes
+* Added paranoia
+
+-- 0.2.5
+* has_one bugfixes
+* Added syntax for setting CHECK-constraints directly in your properties (Postgres)
+* You can now set indexes with :index => true and :index => :unique
+* Support for composite indexes (thanks to Jeffrey Gelens)
+* Add composite scope to validates_uniqueness
+* Added private/protected properties
+* Remove HasOneAssociation, Make HasManyAssociation impersonate has_one relationships
+* Added #get method
+* Persistence module added, inheriting from DataMapper::Base no longer necessary
+
+-- 0.3.0
+* HasManyAssociation::Set now has a nil? method, so we can do stuff like cage.animal.nil?
+
View
124 FAQ
@@ -0,0 +1,124 @@
+:include:QUICKLINKS
+
+= FAQ
+
+=== I don't want to use :id as a primary key, but I don't see
+=== <tt>set_primary_key</tt> anywhere. What do I do?
+
+If you're working with a table that doesn't have a <tt>:id</tt> column, you
+can declare your properties as you usually do, and declare one of them as a
+natural key.
+
+ property :name, :string, :key => true
+
+You should now be able to do <tt>Class['name_string']</tt> as well. Remember:
+this column should be unique, so treat it that way. This is the equivalent to
+using <tt>set_primary_key</tt> in ActiveRecord.
+
+
+=== How do I make a model paranoid?
+
+ property :deleted_at, :datetime
+
+If you've got deleted_at, your model is paranoid auto-magically. All of your
+calls to <tt>##all()</tt>, <tt>##first()</tt>, and <tt>##count()</tt> will be
+scoped with <tt>where deleted_at is null</tt>. Plus, you won't see deleted
+objects in your associations.
+
+=== Does DataMapper support Has Many Through?
+
+Write me!
+
+=== What about Self-Referential Has And Belongs to Many?
+
+Sure does. Here's an example implementation:
+
+ class Task < DataMapper::Base
+ has_and_belongs_to_many :tasks,
+ :join_table => "task_relationships", :left_foreign_key => "parent_id",
+ :right_foreign_key => "child_id"
+ end
+
+You'll notice that instead of <tt>foreign_key</tt> and
+<tt>association_foreign_key</tt>, DataMapper uses the "database-y" terms
+<tt>left_foreign_key</tt>, and <tt>right_foreign_key</tt>.
+
+=== Does DataMapper do Single Table Inheritance?
+
+Oh yes, and particularly well too.
+
+ class Person < Datamapper::Base
+ property :type, :class ## other shared properties here
+ end
+
+ class Salesperson < Person; end
+
+You can claim a column to have the type <tt>:class</tt> and DataMapper will
+automatically drop the class name of the inherited classes into that column of
+the database.
+
+=== What about Class Table Inheritance?
+
+Class Table Inheritance is on the drawing board and everyone's drooling over
+it. So no, not yet, but soon.
+
+=== How do I run my own commands?
+
+You're probably asking for <tt>find_by_sql</tt>, and DataMapper has that in
+it's ActiveRecordImpersonation, but if you want to go straight-up DataMapper,
+you'll want to use <tt>repository.query</tt>
+
+ repository.query("select * from users where clue > 0")
+
+This does not return any Users (har har), but rather Struct's that will quack
+like Users. They'll be read-only as well.
+
+<tt>repository.query</tt> shouldn't be used if you aren't expecting a result set
+back. If you want to just execute something against the database, use
+<tt>repository.execute</tt> instead.
+
+=== Can I batch-process a ton of records at once?
+
+ User.each(:performance_rating => "low") do |u|
+ u.employment_status = "fired"
+ u.save
+ end
+
+With ActiveRecord, doing a <tt>User.find(:all).each{}</tt> would execute the
+find, instantiate an object for EVERY result, THEN apply your transformations
+to each object in turn. Doesn't sound too horrible unless you have a TON of
+records; you WILL grind your system to a screeching and bloody halt.
+
+Datamapper's <tt>#each</tt> works in sets of 500 so the amount of objects
+instantiated at a time won't make your computer think it's a victim in a Saw
+movie. Once it's done executing your block on the first set of 500, it moves
+on to the next.
+
+What's more is <tt>#each</tt> is secretly a finder too. You can pass it an
+options hash and it'll only iterate on 500-item sets matching your query.
+Don't send it <tt>:offset</tt> though, because that's how it pages. You can
+overload the page size by sending it <tt>:limit</tt>
+
+=== Can I get an SQL log of what queries DataMapper is issuing?
+
+Yup, when you issue <tt>Repository.setup</tt>, tack on the <tt>log_stream</tt>
+and <tt>log_level</tt>:
+
+ DataMapper::Repository.setup({
+ :adapter => 'mysql', :host => 'localhost', :username => 'root',
+ :password => 'R00tPaswooooord', :database =>
+ 'myspiffyblog_development', :log_stream => 'log/sql.log', :log_level => 0
+ })
+
+By supplying the <tt>log_stream</tt> you're telling DataMapper what file you
+want to see your sql logs in. <tt>log_level</tt> is the
+Logger[http://www.ruby-doc.org/stdlib/libdoc/logger/rdoc/] level of output you
+want to see there. 0, in this case, says that you want to see all DEBUG level
+messages (and higher) sent to the logger. For more information on how to work
+with Logger[http://www.ruby-doc.org/stdlib/libdoc/logger/rdoc/], hit up
+http://www.ruby-doc.org/stdlib/libdoc/logger/rdoc/.
+
+Incidentally, if you'd like to send a message into the Datamapper logger, do:
+
+ repository.adapter.logger.info "your message here"
+
View
@@ -0,0 +1,22 @@
+Copyright (c) 2007 Sam Smoot
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
Oops, something went wrong.

0 comments on commit e8b4f3b

Please sign in to comment.