momomoto 0.1.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 (65) hide show
  1. data/LICENSE +340 -0
  2. data/Rakefile +38 -0
  3. data/lib/momomoto.rb +5 -0
  4. data/lib/momomoto/base.rb +162 -0
  5. data/lib/momomoto/database.rb +179 -0
  6. data/lib/momomoto/datatype.rb +20 -0
  7. data/lib/momomoto/datatype/base.rb +78 -0
  8. data/lib/momomoto/datatype/bigint.rb +9 -0
  9. data/lib/momomoto/datatype/boolean.rb +23 -0
  10. data/lib/momomoto/datatype/bytea.rb +13 -0
  11. data/lib/momomoto/datatype/character.rb +7 -0
  12. data/lib/momomoto/datatype/character_varying.rb +7 -0
  13. data/lib/momomoto/datatype/date.rb +22 -0
  14. data/lib/momomoto/datatype/inet.rb +14 -0
  15. data/lib/momomoto/datatype/integer.rb +16 -0
  16. data/lib/momomoto/datatype/interval.rb +30 -0
  17. data/lib/momomoto/datatype/numeric.rb +17 -0
  18. data/lib/momomoto/datatype/real.rb +7 -0
  19. data/lib/momomoto/datatype/smallint.rb +7 -0
  20. data/lib/momomoto/datatype/text.rb +24 -0
  21. data/lib/momomoto/datatype/time_with_time_zone.rb +10 -0
  22. data/lib/momomoto/datatype/time_without_time_zone.rb +30 -0
  23. data/lib/momomoto/datatype/timestamp_with_time_zone.rb +7 -0
  24. data/lib/momomoto/datatype/timestamp_without_time_zone.rb +29 -0
  25. data/lib/momomoto/information_schema/columns.rb +45 -0
  26. data/lib/momomoto/information_schema/fetch_procedure_columns.rb +14 -0
  27. data/lib/momomoto/information_schema/fetch_procedure_parameters.rb +14 -0
  28. data/lib/momomoto/information_schema/key_column_usage.rb +19 -0
  29. data/lib/momomoto/information_schema/routines.rb +12 -0
  30. data/lib/momomoto/information_schema/table_constraints.rb +19 -0
  31. data/lib/momomoto/join.rb +66 -0
  32. data/lib/momomoto/momomoto.rb +10 -0
  33. data/lib/momomoto/order.rb +56 -0
  34. data/lib/momomoto/procedure.rb +129 -0
  35. data/lib/momomoto/row.rb +63 -0
  36. data/lib/momomoto/table.rb +251 -0
  37. data/sql/install.sql +10 -0
  38. data/sql/procedures.sql +54 -0
  39. data/sql/types.sql +11 -0
  40. data/test/test_base.rb +17 -0
  41. data/test/test_bigint.rb +26 -0
  42. data/test/test_boolean.rb +30 -0
  43. data/test/test_bytea.rb +35 -0
  44. data/test/test_character.rb +27 -0
  45. data/test/test_character_varying.rb +17 -0
  46. data/test/test_database.rb +63 -0
  47. data/test/test_datatype.rb +62 -0
  48. data/test/test_date.rb +50 -0
  49. data/test/test_inet.rb +27 -0
  50. data/test/test_information_schema.rb +27 -0
  51. data/test/test_integer.rb +37 -0
  52. data/test/test_interval.rb +38 -0
  53. data/test/test_join.rb +19 -0
  54. data/test/test_numeric.rb +30 -0
  55. data/test/test_procedure.rb +75 -0
  56. data/test/test_real.rb +17 -0
  57. data/test/test_row.rb +47 -0
  58. data/test/test_smallint.rb +26 -0
  59. data/test/test_table.rb +233 -0
  60. data/test/test_text.rb +25 -0
  61. data/test/test_time_with_time_zone.rb +17 -0
  62. data/test/test_time_without_time_zone.rb +40 -0
  63. data/test/test_timestamp_with_time_zone.rb +17 -0
  64. data/test/test_timestamp_without_time_zone.rb +28 -0
  65. metadata +116 -0
@@ -0,0 +1,40 @@
1
+
2
+ class TestTimeWithoutTimeZone < Test::Unit::TestCase
3
+
4
+ def test_invalid
5
+ c = Class.new( Momomoto::Table )
6
+ c.table_name = 'test_time_without_time_zone'
7
+ [ :x, 2.3 ].each do | value |
8
+ r = c.new
9
+ assert_raise( Momomoto::ConversionError ) do
10
+ r.data = value
11
+ end
12
+ end
13
+ end
14
+
15
+ def test_string_conversion
16
+ c = Class.new( Momomoto::Table )
17
+ c.table_name = 'test_time_without_time_zone'
18
+ [ "20:00:00", "23:42"].each do | value |
19
+ r = c.new( :data => value )
20
+ assert_equal( Time.parse( value ), r.data )
21
+ r.write
22
+ r2 = c.select(:id=>r.id).first
23
+ assert_equal( Time.parse( value ), r2.data )
24
+ end
25
+ end
26
+
27
+ def test_samples
28
+ c = Class.new( Momomoto::Table )
29
+ c.table_name = 'test_time_without_time_zone'
30
+ [Time.parse("00:00:00"),Time.parse("01:00:00"),Time.parse("23:00")].each do | value |
31
+ r = c.new( :data => value )
32
+ assert_equal( value, r.data )
33
+ r.write
34
+ r2 = c.select(:id=>r.id).first
35
+ assert_equal( value, r2.data )
36
+ end
37
+ end
38
+
39
+ end
40
+
@@ -0,0 +1,17 @@
1
+
2
+ class TestTimestampWithTimeZone < Test::Unit::TestCase
3
+
4
+ def test_samples
5
+ c = Class.new( Momomoto::Table )
6
+ c.table_name = 'test_timestamp_with_time_zone'
7
+ [Time.parse("2005-05-23 00:00:00 +0200")].each do | value |
8
+ r = c.new( :data => value )
9
+ assert_equal( value, r.data )
10
+ r.write
11
+ r2 = c.select(:id=>r.id).first
12
+ assert_equal( value, r2.data )
13
+ end
14
+ end
15
+
16
+ end
17
+
@@ -0,0 +1,28 @@
1
+
2
+ class TestTimestampWithoutTimeZone < Test::Unit::TestCase
3
+
4
+ def test_invalid
5
+ c = Class.new( Momomoto::Table )
6
+ c.table_name = 'test_timestamp_without_time_zone'
7
+ [ :x, 2.3 ].each do | value |
8
+ r = c.new
9
+ assert_raise( Momomoto::ConversionError ) do
10
+ r.data = value
11
+ end
12
+ end
13
+ end
14
+
15
+ def test_samples
16
+ c = Class.new( Momomoto::Table )
17
+ c.table_name = 'test_timestamp_without_time_zone'
18
+ [Time.parse("2005-05-23 00:00:00")].each do | value |
19
+ r = c.new( :data => value )
20
+ assert_equal( value, r.data )
21
+ r.write
22
+ r2 = c.select(:id=>r.id).first
23
+ assert_equal( value, r2.data )
24
+ end
25
+ end
26
+
27
+ end
28
+
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.11
3
+ specification_version: 1
4
+ name: momomoto
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.1.0
7
+ date: 2007-08-13 00:00:00 +02:00
8
+ summary: Momomoto is an object relational mapper for PostgreSQL.
9
+ require_paths:
10
+ - lib
11
+ email: sven@c3d2.de
12
+ homepage: http://pentabarf.org/Momomoto
13
+ rubyforge_project:
14
+ description: Momomoto is an object relational mapper for PostgreSQL.
15
+ autorequire: momomoto
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.8.2
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ authors:
29
+ - Sven Klemm
30
+ files:
31
+ - lib/momomoto.rb
32
+ - lib/momomoto/join.rb
33
+ - lib/momomoto/database.rb
34
+ - lib/momomoto/momomoto.rb
35
+ - lib/momomoto/row.rb
36
+ - lib/momomoto/table.rb
37
+ - lib/momomoto/procedure.rb
38
+ - lib/momomoto/base.rb
39
+ - lib/momomoto/datatype.rb
40
+ - lib/momomoto/order.rb
41
+ - lib/momomoto/information_schema/table_constraints.rb
42
+ - lib/momomoto/information_schema/columns.rb
43
+ - lib/momomoto/information_schema/fetch_procedure_columns.rb
44
+ - lib/momomoto/information_schema/fetch_procedure_parameters.rb
45
+ - lib/momomoto/information_schema/routines.rb
46
+ - lib/momomoto/information_schema/key_column_usage.rb
47
+ - lib/momomoto/datatype/date.rb
48
+ - lib/momomoto/datatype/boolean.rb
49
+ - lib/momomoto/datatype/smallint.rb
50
+ - lib/momomoto/datatype/real.rb
51
+ - lib/momomoto/datatype/text.rb
52
+ - lib/momomoto/datatype/interval.rb
53
+ - lib/momomoto/datatype/time_without_time_zone.rb
54
+ - lib/momomoto/datatype/character_varying.rb
55
+ - lib/momomoto/datatype/character.rb
56
+ - lib/momomoto/datatype/integer.rb
57
+ - lib/momomoto/datatype/inet.rb
58
+ - lib/momomoto/datatype/timestamp_without_time_zone.rb
59
+ - lib/momomoto/datatype/time_with_time_zone.rb
60
+ - lib/momomoto/datatype/numeric.rb
61
+ - lib/momomoto/datatype/bytea.rb
62
+ - lib/momomoto/datatype/timestamp_with_time_zone.rb
63
+ - lib/momomoto/datatype/base.rb
64
+ - lib/momomoto/datatype/bigint.rb
65
+ - sql/types.sql
66
+ - sql/install.sql
67
+ - sql/procedures.sql
68
+ - test/test_boolean.rb
69
+ - test/test_real.rb
70
+ - test/test_smallint.rb
71
+ - test/test_interval.rb
72
+ - test/test_text.rb
73
+ - test/test_table.rb
74
+ - test/test_procedure.rb
75
+ - test/test_time_without_time_zone.rb
76
+ - test/test_character_varying.rb
77
+ - test/test_character.rb
78
+ - test/test_integer.rb
79
+ - test/test_inet.rb
80
+ - test/test_join.rb
81
+ - test/test_timestamp_without_time_zone.rb
82
+ - test/test_numeric.rb
83
+ - test/test_time_with_time_zone.rb
84
+ - test/test_database.rb
85
+ - test/test_bytea.rb
86
+ - test/test_information_schema.rb
87
+ - test/test_row.rb
88
+ - test/test_timestamp_with_time_zone.rb
89
+ - test/test_base.rb
90
+ - test/test_datatype.rb
91
+ - test/test_bigint.rb
92
+ - test/test_date.rb
93
+ - LICENSE
94
+ - Rakefile
95
+ test_files: []
96
+
97
+ rdoc_options: []
98
+
99
+ extra_rdoc_files: []
100
+
101
+ executables: []
102
+
103
+ extensions: []
104
+
105
+ requirements:
106
+ - PostgreSQL 8.1.4 or greater
107
+ dependencies:
108
+ - !ruby/object:Gem::Dependency
109
+ name: ruby-postgres
110
+ version_requirement:
111
+ version_requirements: !ruby/object:Gem::Version::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 0.7.1.2006.04.06
116
+ version: