lore 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/History.txt +10 -0
  2. data/Manifest.txt +7 -0
  3. data/Rakefile +12 -0
  4. data/{custom_functions.sql → bin/custom_functions.sql} +0 -0
  5. data/bin/setup_db.rb +9 -0
  6. data/{README → lib/lore/README.txt} +28 -18
  7. data/{aspect.rb → lib/lore/aspect.rb} +0 -0
  8. data/{behaviours → lib/lore/behaviours}/lockable.rb +0 -0
  9. data/{behaviours → lib/lore/behaviours}/movable.rb +0 -0
  10. data/{behaviours → lib/lore/behaviours}/versioned.rb +0 -0
  11. data/{bits.rb → lib/lore/bits.rb} +0 -0
  12. data/{cache → lib/lore/cache}/abstract_entity_cache.rb +0 -0
  13. data/{cache → lib/lore/cache}/bits.rb +0 -0
  14. data/{cache → lib/lore/cache}/cacheable.rb +0 -0
  15. data/{cache → lib/lore/cache}/cached_entities.rb +0 -0
  16. data/{cache → lib/lore/cache}/file_index.rb +0 -0
  17. data/{cache → lib/lore/cache}/mmap_entity_cache.rb +5 -1
  18. data/{clause.rb → lib/lore/clause.rb} +0 -0
  19. data/{connection.rb → lib/lore/connection.rb} +1 -1
  20. data/{exception → lib/lore/exception}/ambiguous_attribute.rb +0 -0
  21. data/{exception → lib/lore/exception}/cache_exception.rb +0 -0
  22. data/{exception → lib/lore/exception}/invalid_klass_parameters.rb +0 -0
  23. data/{exception → lib/lore/exception}/invalid_parameter.rb +0 -0
  24. data/{exception → lib/lore/exception}/unknown_typecode.rb +0 -0
  25. data/{gui → lib/lore/gui}/erb_template.rb +0 -0
  26. data/{gui → lib/lore/gui}/erb_template_helpers.rhtml +0 -0
  27. data/{gui → lib/lore/gui}/form.rb +0 -0
  28. data/{gui → lib/lore/gui}/form_element.rb +0 -0
  29. data/{gui → lib/lore/gui}/form_generator.rb +0 -0
  30. data/{gui → lib/lore/gui}/templates/button.rhtml +0 -0
  31. data/{gui → lib/lore/gui}/templates/checkbox.rhtml +0 -0
  32. data/{gui → lib/lore/gui}/templates/checkbox_row.rhtml +0 -0
  33. data/{gui → lib/lore/gui}/templates/file.rhtml +0 -0
  34. data/{gui → lib/lore/gui}/templates/file_readonly.rhtml +0 -0
  35. data/{gui → lib/lore/gui}/templates/form_element.rhtml +0 -0
  36. data/{gui → lib/lore/gui}/templates/form_element_horizontal.rhtml +0 -0
  37. data/{gui → lib/lore/gui}/templates/form_element_listed.rhtml +0 -0
  38. data/{gui → lib/lore/gui}/templates/form_table.rhtml +0 -0
  39. data/{gui → lib/lore/gui}/templates/form_table_blank.rhtml +0 -0
  40. data/{gui → lib/lore/gui}/templates/form_table_horizontal.rhtml +0 -0
  41. data/{gui → lib/lore/gui}/templates/password.rhtml +0 -0
  42. data/{gui → lib/lore/gui}/templates/password_readonly.rhtml +0 -0
  43. data/{gui → lib/lore/gui}/templates/radio.rhtml +0 -0
  44. data/{gui → lib/lore/gui}/templates/radio_row.rhtml +0 -0
  45. data/{gui → lib/lore/gui}/templates/select.rhtml +0 -0
  46. data/{gui → lib/lore/gui}/templates/text.rhtml +0 -0
  47. data/{gui → lib/lore/gui}/templates/text_readonly.rhtml +0 -0
  48. data/{gui → lib/lore/gui}/templates/textarea.rhtml +0 -0
  49. data/{gui → lib/lore/gui}/templates/textarea_readonly.rhtml +0 -0
  50. data/{migration.rb → lib/lore/migration.rb} +0 -0
  51. data/{model.rb → lib/lore/model.rb} +0 -0
  52. data/{model_factory.rb → lib/lore/model_factory.rb} +0 -0
  53. data/{model_shortcuts.rb → lib/lore/model_shortcuts.rb} +0 -0
  54. data/{query_shortcuts.rb → lib/lore/query_shortcuts.rb} +0 -0
  55. data/{result.rb → lib/lore/result.rb} +0 -0
  56. data/{symbol.rb → lib/lore/symbol.rb} +0 -0
  57. data/{table_accessor.rb → lib/lore/table_accessor.rb} +0 -0
  58. data/{table_deleter.rb → lib/lore/table_deleter.rb} +0 -0
  59. data/{table_inserter.rb → lib/lore/table_inserter.rb} +0 -0
  60. data/{table_instance.rb → lib/lore/table_instance.rb} +0 -0
  61. data/{table_selector.rb → lib/lore/table_selector.rb} +0 -0
  62. data/{table_updater.rb → lib/lore/table_updater.rb} +0 -0
  63. data/{types.rb → lib/lore/types.rb} +0 -0
  64. data/{validation → lib/lore/validation}/message.rb +0 -0
  65. data/{validation → lib/lore/validation}/parameter_validator.rb +0 -0
  66. data/{validation → lib/lore/validation}/reason.rb +1 -3
  67. data/{validation → lib/lore/validation}/type_validator.rb +0 -0
  68. data/{validation.rb → lib/lore/validation.rb} +0 -0
  69. data/{lore.rb → lib/lore.rb} +2 -0
  70. data/lore-0.4.3.gem +0 -0
  71. data/lore.gemspec +12 -10
  72. data/test/custom_models.rb +18 -0
  73. data/test/lore_test.log +617 -8218
  74. data/test/{ts_lore.rb → test_lore.rb} +0 -0
  75. metadata +84 -88
  76. data/benchmark.rb +0 -193
  77. data/file_index.sql +0 -56
  78. data/reserved_methods.txt +0 -3
  79. data/test/test.log +0 -181
data/History.txt ADDED
@@ -0,0 +1,10 @@
1
+ === 0.4.2 / 2008-11-10
2
+
3
+ * Major performance increase due to
4
+ * Optimized queries
5
+ * Mmap caching
6
+ * Minor refactoring - major effects
7
+ * Overhead of Lore is quite the same as Rails::ActiveRecord's
8
+ * Further unit tests
9
+ * Extended prepared statements
10
+
data/Manifest.txt ADDED
@@ -0,0 +1,7 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ bin/lore
6
+ lib/lore.rb
7
+ test/test_lore.rb
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ require './lib/lore.rb'
6
+
7
+ Hoe.new('lore', Lore::VERSION) do |p|
8
+ p.rubyforge_name = 'lore' # if different than lowercase project name
9
+ p.developer('Tobias Fuchs', 'fuchs@wortundform.de')
10
+ end
11
+
12
+ # vim: syntax=Ruby
File without changes
data/bin/setup_db.rb ADDED
@@ -0,0 +1,9 @@
1
+
2
+ require 'lore'
3
+
4
+ module Lore
5
+
6
+ Context.enter(ARGV[1])
7
+ Connection.perform(setup_query)
8
+
9
+ end
@@ -3,31 +3,41 @@ Q: Are there adapters for other DBMS than PostgreSQL?
3
3
  A: PostgreSQL is - to me and everyone using Lore i know of -
4
4
  the best (free) choice for sophisticated database-driven
5
5
  apps, so frankly said: Implementing adapters is not on my
6
- top priority list. Adapters also come with some cost in
7
- performance, by introducing an additional level of
8
- abstraction.
6
+ top priority list.
9
7
  So far, Lore supports PostgreSQL (7.4 to 8.3 tested).
10
8
  Adapters are planned for oracle mysql and sqlite though.
11
9
  Lore is SQL 92 compatible and not using any exotic
12
10
  Postgres features, so it *might* work fine on e.g. mysql
13
- and sqlite with just minor modifications. It is caring
14
- about cascading dependencies etc, so you don't even need
15
- foreign keys or table inheritance.
11
+ and sqlite with just minor modifications. Lore is caring
12
+ about cascading dependencies etc itself, so you don't even
13
+ need foreign keys or table inheritance.
16
14
  You will have to change the code establishing DB
17
15
  connections (see connection.rb), but as those are
18
16
  abstracted, just a couple of lines of code in connection.rb
19
17
  had to be changed.
20
18
 
21
19
  Q: How do i establish a DB connection at all?
22
- A: In /lore.rb, edit the Hash instance @logins. Lore is caring
23
- about connections itself.
24
- You have to enter a so-called context (database, that is),
25
- though:
20
+ A: First provide login data for a database (aka Context):
26
21
 
27
- Lore::Context.enter :my_dbname
22
+ Lore.add_login_data('dbname' => ['user', 'pass'])
23
+ Lore.add_login_data('other_dbname' => ['user', 'pass'])
24
+
25
+ Now, activate a context. You can stack them, too:
26
+
27
+ Lore::Context.enter :dbname
28
+ # Operate in database dbname
29
+ Lore::Context.enter :other_dbname
30
+ # Operate in database other_dbname
31
+ Lore::Context.leave
32
+ # Operate in database dbname
33
+ Lore::Context.enter :other_dbname
28
34
 
29
35
  Q: What about connection pooling?
30
- A: Use PGPool for that, it's way better than any
36
+ A: Lore re-uses connections per-process, that is: There is
37
+ one connection for every context you entered in every
38
+ process Lore is running in.
39
+ In case you need connections shared over multiple
40
+ processes, use PGPool for that, it's way better than any
31
41
  implementation of connection pooling in ruby.
32
42
  Install PGPool and tell lore to connect to PGPool's port
33
43
  instead of PostgreSQL's one.
@@ -38,15 +48,16 @@ A: Use PGPool for that, it's way better than any
38
48
  That's it!
39
49
 
40
50
  Q: Which solution do you recommend for query result caching?
41
- A: There are many possibilities: Tempfiles, MMap and Memcached
51
+ A: There are many possibilities: Tempfiles, Mmap and Memcached
42
52
  are the most widespread solutions known to me.
43
53
  Many will agree that MMap is the best solution in matters
44
54
  of performance on a single server, and memcached as soon as
45
55
  more than one server is involved in your application.
56
+ To enable caching for all models:
46
57
 
47
- Q: There are failing unit tests!!
48
- A: I know. Those document missing features i'm implementing
49
- at the very moment :) Be sure to update once in a while!
58
+ Lore::Model.use_entity_cache Lore::Cache::Mmap_Entity_Cache
59
+ or
60
+ Lore::Model.use_entity_cache Lore::Cache::Memcached_Entity_Cache
50
61
 
51
62
  Q: After creating a model via Model_Factory: How do i change
52
63
  it?
@@ -54,8 +65,7 @@ A: At the moment, this is not implemented, but tracked as
54
65
  'missing feature'. This will be possible in version 1.0 at
55
66
  the latest.
56
67
 
57
- Q: There's so much documentation missing, the API isn't really
58
- helpful. Where can i get more info and examples?
68
+ Q: Where to look for documentation and examples?
59
69
  A: Have a look at the wiki. I'm updating it quite often, and
60
70
  new features are explained in the wiki first:
61
71
  http://infranode.com/wiki/
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,7 +1,11 @@
1
1
 
2
2
  require 'lore'
3
3
  require 'lore/cache/abstract_entity_cache'
4
- require 'mmap'
4
+ begin
5
+ require 'mmap'
6
+ rescue LoadError
7
+ Lore.log { 'Mmap for Ruby could not be found. You won\'t be able to use Mmap_Entity_Cache. ' }
8
+ end
5
9
 
6
10
  module Lore
7
11
  module Cache
File without changes
@@ -3,7 +3,7 @@ $:.push('/opt/local/lib/ruby/1.8/postgres')
3
3
 
4
4
  require('postgres')
5
5
  require('logger')
6
- require('lore/lore')
6
+ require('lore')
7
7
  require('lore/result')
8
8
 
9
9
  module Lore
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,6 +1,5 @@
1
1
 
2
2
  require('lore/validation/message')
3
- require('htmlentities')
4
3
 
5
4
  module Lore
6
5
  module Validation
@@ -12,8 +11,7 @@ module Validation
12
11
  attr_reader :options
13
12
 
14
13
  def message()
15
- # polish message for html output:
16
- return @message.map { |m| HTMLEntities.new.decode(m) }
14
+ @message
17
15
  end
18
16
 
19
17
  def initialize(message, options) # {{{
File without changes
@@ -2,6 +2,8 @@
2
2
  require('logger')
3
3
 
4
4
  module Lore
5
+
6
+ VERSION='0.4.3'
5
7
 
6
8
  @logfile = '/var/log/lore/query.log'
7
9
  def self.logfile
data/lore-0.4.3.gem ADDED
File without changes
data/lore.gemspec CHANGED
@@ -14,25 +14,27 @@ spec = Gem::Specification.new { |s|
14
14
  and result caching using memory mapping (MMap).
15
15
  Lore is currently using PostgreSQL as database backend.
16
16
  EOF
17
- s.version = '0.4.2'
17
+ s.version = '0.4.3'
18
18
  s.author = 'Tobias Fuchs'
19
19
  s.email = 'fuchs@atomnode.net'
20
20
  s.date = Time.now
21
21
  s.files = '*.rb'
22
- s.add_dependency('mmap', '>= 0.1')
23
22
  s.add_dependency('postgres', '>= 0.1')
24
23
  s.files = FileList['*',
25
- 'behaviours/*',
26
- 'test/*',
27
- 'cache/*',
28
- 'validation/*',
29
- 'gui/*',
30
- 'gui/templates/*',
31
- 'exception/*'].to_a
24
+ 'lib/*',
25
+ 'lib/lore/*',
26
+ 'lib/lore/behaviours/*',
27
+ 'lib/lore/cache/*',
28
+ 'lib/lore/validation/*',
29
+ 'lib/lore/gui/*',
30
+ 'lib/lore/gui/templates/*',
31
+ 'lib/lore/exception/*',
32
+ 'bin/*',
33
+ 'test/*'].to_a
32
34
 
33
35
  s.has_rdoc = true
34
36
  s.rdoc_options << '--title' << 'Lore ORM' <<
35
- '--main' << 'README' <<
37
+ '--main' << 'README.txt' <<
36
38
  '--line-numbers'
37
39
 
38
40
  s.homepage = 'http://lore.rubyforge.org'
@@ -0,0 +1,18 @@
1
+
2
+ require('lore/model')
3
+
4
+ module Some
5
+ module App
6
+
7
+ class New_Model < Lore::Model
8
+ table :new_model, :public
9
+ primary_key :model_id, :model_id_seq
10
+ has_attribute :name, Lore::Type.integer
11
+ has_attribute :created, Lore::Type.timestamp
12
+ has_attribute :model_id, Lore::Type.integer
13
+
14
+
15
+ end
16
+ end
17
+ end
18
+