activerecord-postgres-hstore 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/.gitignore +25 -0
  2. data/.travis.yml +1 -1
  3. data/Gemfile +4 -10
  4. data/README.md +33 -6
  5. data/Rakefile +3 -18
  6. data/VERSION +1 -1
  7. data/activerecord-postgres-hstore.gemspec +22 -128
  8. data/lib/activerecord-postgres-hstore/coder.rb +1 -1
  9. data/spec/{activerecord-coders-hstore.rb → activerecord-coders-hstore_spec.rb} +4 -0
  10. metadata +14 -120
  11. data/Gemfile.lock +0 -121
  12. data/app/.gitignore +0 -4
  13. data/app/Gemfile +0 -28
  14. data/app/Gemfile.lock +0 -81
  15. data/app/README +0 -256
  16. data/app/Rakefile +0 -7
  17. data/app/app/controllers/application_controller.rb +0 -3
  18. data/app/app/helpers/application_helper.rb +0 -2
  19. data/app/app/models/bar.rb +0 -3
  20. data/app/app/models/foo.rb +0 -3
  21. data/app/app/views/layouts/application.html.erb +0 -14
  22. data/app/bench.rb +0 -76
  23. data/app/bench_results.txt +0 -13
  24. data/app/config.ru +0 -4
  25. data/app/config/application.rb +0 -43
  26. data/app/config/boot.rb +0 -13
  27. data/app/config/database.yml +0 -51
  28. data/app/config/environment.rb +0 -5
  29. data/app/config/environments/development.rb +0 -22
  30. data/app/config/environments/production.rb +0 -49
  31. data/app/config/environments/test.rb +0 -35
  32. data/app/config/initializers/activerecord_postgres_hstore.rb +0 -0
  33. data/app/config/initializers/backtrace_silencers.rb +0 -7
  34. data/app/config/initializers/inflections.rb +0 -10
  35. data/app/config/initializers/mime_types.rb +0 -5
  36. data/app/config/initializers/secret_token.rb +0 -7
  37. data/app/config/initializers/session_store.rb +0 -8
  38. data/app/config/locales/en.yml +0 -5
  39. data/app/config/routes.rb +0 -58
  40. data/app/db/development_structure.sql +0 -580
  41. data/app/db/migrate/20100906191151_add_hstore.rb +0 -276
  42. data/app/db/migrate/20100906191457_create_foos.rb +0 -13
  43. data/app/db/migrate/20100906191506_create_bars.rb +0 -12
  44. data/app/db/schema.rb +0 -27
  45. data/app/db/seeds.rb +0 -7
  46. data/app/doc/README_FOR_APP +0 -2
  47. data/app/generate_copy_files.rb +0 -47
  48. data/app/lib/tasks/.gitkeep +0 -0
  49. data/app/public/404.html +0 -26
  50. data/app/public/422.html +0 -26
  51. data/app/public/500.html +0 -26
  52. data/app/public/favicon.ico +0 -0
  53. data/app/public/images/rails.png +0 -0
  54. data/app/public/index.html +0 -262
  55. data/app/public/javascripts/.gitkeep +0 -0
  56. data/app/public/javascripts/application.js +0 -0
  57. data/app/public/robots.txt +0 -5
  58. data/app/public/stylesheets/.gitkeep +0 -0
  59. data/app/script/rails +0 -6
  60. data/app/test/performance/browsing_test.rb +0 -9
  61. data/app/test/test_helper.rb +0 -6
  62. data/app/test/unit/bar_test.rb +0 -133
  63. data/app/test/unit/foo_test.rb +0 -8
  64. data/app/vendor/plugins/.gitkeep +0 -0
@@ -1,276 +0,0 @@
1
- class AddHstore < ActiveRecord::Migration
2
- def self.up
3
- sql = <<-HSTORE_SQL
4
- /* $PostgreSQL: pgsql/contrib/hstore/hstore.sql.in,v 1.11 2009/06/11 18:30:03 tgl Exp $ */
5
-
6
- -- Adjust this setting to control where the objects get created.
7
- SET search_path = public;
8
-
9
- CREATE TYPE hstore;
10
-
11
- CREATE OR REPLACE FUNCTION hstore_in(cstring)
12
- RETURNS hstore
13
- AS '$libdir/hstore'
14
- LANGUAGE C STRICT;
15
-
16
- CREATE OR REPLACE FUNCTION hstore_out(hstore)
17
- RETURNS cstring
18
- AS '$libdir/hstore'
19
- LANGUAGE C STRICT;
20
-
21
- CREATE TYPE hstore (
22
- INTERNALLENGTH = -1,
23
- INPUT = hstore_in,
24
- OUTPUT = hstore_out,
25
- STORAGE = extended
26
- );
27
-
28
- CREATE OR REPLACE FUNCTION fetchval(hstore,text)
29
- RETURNS text
30
- AS '$libdir/hstore'
31
- LANGUAGE C STRICT IMMUTABLE;
32
-
33
- CREATE OPERATOR -> (
34
- LEFTARG = hstore,
35
- RIGHTARG = text,
36
- PROCEDURE = fetchval
37
- );
38
-
39
- CREATE OR REPLACE FUNCTION isexists(hstore,text)
40
- RETURNS bool
41
- AS '$libdir/hstore','exists'
42
- LANGUAGE C STRICT IMMUTABLE;
43
-
44
- CREATE OR REPLACE FUNCTION exist(hstore,text)
45
- RETURNS bool
46
- AS '$libdir/hstore','exists'
47
- LANGUAGE C STRICT IMMUTABLE;
48
-
49
- CREATE OPERATOR ? (
50
- LEFTARG = hstore,
51
- RIGHTARG = text,
52
- PROCEDURE = exist,
53
- RESTRICT = contsel,
54
- JOIN = contjoinsel
55
- );
56
-
57
- CREATE OR REPLACE FUNCTION isdefined(hstore,text)
58
- RETURNS bool
59
- AS '$libdir/hstore','defined'
60
- LANGUAGE C STRICT IMMUTABLE;
61
-
62
- CREATE OR REPLACE FUNCTION defined(hstore,text)
63
- RETURNS bool
64
- AS '$libdir/hstore','defined'
65
- LANGUAGE C STRICT IMMUTABLE;
66
-
67
- CREATE OR REPLACE FUNCTION delete(hstore,text)
68
- RETURNS hstore
69
- AS '$libdir/hstore','delete'
70
- LANGUAGE C STRICT IMMUTABLE;
71
-
72
- CREATE OR REPLACE FUNCTION hs_concat(hstore,hstore)
73
- RETURNS hstore
74
- AS '$libdir/hstore'
75
- LANGUAGE C STRICT IMMUTABLE;
76
-
77
- CREATE OPERATOR || (
78
- LEFTARG = hstore,
79
- RIGHTARG = hstore,
80
- PROCEDURE = hs_concat
81
- );
82
-
83
- CREATE OR REPLACE FUNCTION hs_contains(hstore,hstore)
84
- RETURNS bool
85
- AS '$libdir/hstore'
86
- LANGUAGE C STRICT IMMUTABLE;
87
-
88
- CREATE OR REPLACE FUNCTION hs_contained(hstore,hstore)
89
- RETURNS bool
90
- AS '$libdir/hstore'
91
- LANGUAGE C STRICT IMMUTABLE;
92
-
93
- CREATE OPERATOR @> (
94
- LEFTARG = hstore,
95
- RIGHTARG = hstore,
96
- PROCEDURE = hs_contains,
97
- COMMUTATOR = '<@',
98
- RESTRICT = contsel,
99
- JOIN = contjoinsel
100
- );
101
-
102
- CREATE OPERATOR <@ (
103
- LEFTARG = hstore,
104
- RIGHTARG = hstore,
105
- PROCEDURE = hs_contained,
106
- COMMUTATOR = '@>',
107
- RESTRICT = contsel,
108
- JOIN = contjoinsel
109
- );
110
-
111
- -- obsolete:
112
- CREATE OPERATOR @ (
113
- LEFTARG = hstore,
114
- RIGHTARG = hstore,
115
- PROCEDURE = hs_contains,
116
- COMMUTATOR = '~',
117
- RESTRICT = contsel,
118
- JOIN = contjoinsel
119
- );
120
-
121
- CREATE OPERATOR ~ (
122
- LEFTARG = hstore,
123
- RIGHTARG = hstore,
124
- PROCEDURE = hs_contained,
125
- COMMUTATOR = '@',
126
- RESTRICT = contsel,
127
- JOIN = contjoinsel
128
- );
129
-
130
- CREATE OR REPLACE FUNCTION tconvert(text,text)
131
- RETURNS hstore
132
- AS '$libdir/hstore'
133
- LANGUAGE C IMMUTABLE; -- not STRICT
134
-
135
- CREATE OPERATOR => (
136
- LEFTARG = text,
137
- RIGHTARG = text,
138
- PROCEDURE = tconvert
139
- );
140
-
141
- CREATE OR REPLACE FUNCTION akeys(hstore)
142
- RETURNS _text
143
- AS '$libdir/hstore'
144
- LANGUAGE C STRICT IMMUTABLE;
145
-
146
- CREATE OR REPLACE FUNCTION avals(hstore)
147
- RETURNS _text
148
- AS '$libdir/hstore'
149
- LANGUAGE C STRICT IMMUTABLE;
150
-
151
- CREATE OR REPLACE FUNCTION skeys(hstore)
152
- RETURNS setof text
153
- AS '$libdir/hstore'
154
- LANGUAGE C STRICT IMMUTABLE;
155
-
156
- CREATE OR REPLACE FUNCTION svals(hstore)
157
- RETURNS setof text
158
- AS '$libdir/hstore'
159
- LANGUAGE C STRICT IMMUTABLE;
160
-
161
- CREATE OR REPLACE FUNCTION each(IN hs hstore,
162
- OUT key text,
163
- OUT value text)
164
- RETURNS SETOF record
165
- AS '$libdir/hstore'
166
- LANGUAGE C STRICT IMMUTABLE;
167
-
168
-
169
-
170
- -- define the GiST support methods
171
-
172
- CREATE TYPE ghstore;
173
-
174
- CREATE OR REPLACE FUNCTION ghstore_in(cstring)
175
- RETURNS ghstore
176
- AS '$libdir/hstore'
177
- LANGUAGE C STRICT;
178
-
179
- CREATE OR REPLACE FUNCTION ghstore_out(ghstore)
180
- RETURNS cstring
181
- AS '$libdir/hstore'
182
- LANGUAGE C STRICT;
183
-
184
- CREATE TYPE ghstore (
185
- INTERNALLENGTH = -1,
186
- INPUT = ghstore_in,
187
- OUTPUT = ghstore_out
188
- );
189
-
190
- CREATE OR REPLACE FUNCTION ghstore_compress(internal)
191
- RETURNS internal
192
- AS '$libdir/hstore'
193
- LANGUAGE C IMMUTABLE STRICT;
194
-
195
- CREATE OR REPLACE FUNCTION ghstore_decompress(internal)
196
- RETURNS internal
197
- AS '$libdir/hstore'
198
- LANGUAGE C IMMUTABLE STRICT;
199
-
200
- CREATE OR REPLACE FUNCTION ghstore_penalty(internal,internal,internal)
201
- RETURNS internal
202
- AS '$libdir/hstore'
203
- LANGUAGE C IMMUTABLE STRICT;
204
-
205
- CREATE OR REPLACE FUNCTION ghstore_picksplit(internal, internal)
206
- RETURNS internal
207
- AS '$libdir/hstore'
208
- LANGUAGE C IMMUTABLE STRICT;
209
-
210
- CREATE OR REPLACE FUNCTION ghstore_union(internal, internal)
211
- RETURNS internal
212
- AS '$libdir/hstore'
213
- LANGUAGE C IMMUTABLE STRICT;
214
-
215
- CREATE OR REPLACE FUNCTION ghstore_same(internal, internal, internal)
216
- RETURNS internal
217
- AS '$libdir/hstore'
218
- LANGUAGE C IMMUTABLE STRICT;
219
-
220
- CREATE OR REPLACE FUNCTION ghstore_consistent(internal,internal,int,oid,internal)
221
- RETURNS bool
222
- AS '$libdir/hstore'
223
- LANGUAGE C IMMUTABLE STRICT;
224
-
225
- -- register the opclass for indexing (not as default)
226
- CREATE OPERATOR CLASS gist_hstore_ops
227
- DEFAULT FOR TYPE hstore USING gist
228
- AS
229
- OPERATOR 7 @> ,
230
- OPERATOR 9 ?(hstore,text) ,
231
- --OPERATOR 8 <@ ,
232
- OPERATOR 13 @ ,
233
- --OPERATOR 14 ~ ,
234
- FUNCTION 1 ghstore_consistent (internal, internal, int, oid, internal),
235
- FUNCTION 2 ghstore_union (internal, internal),
236
- FUNCTION 3 ghstore_compress (internal),
237
- FUNCTION 4 ghstore_decompress (internal),
238
- FUNCTION 5 ghstore_penalty (internal, internal, internal),
239
- FUNCTION 6 ghstore_picksplit (internal, internal),
240
- FUNCTION 7 ghstore_same (internal, internal, internal),
241
- STORAGE ghstore;
242
-
243
- -- define the GIN support methods
244
-
245
- CREATE OR REPLACE FUNCTION gin_extract_hstore(internal, internal)
246
- RETURNS internal
247
- AS '$libdir/hstore'
248
- LANGUAGE C IMMUTABLE STRICT;
249
-
250
- CREATE OR REPLACE FUNCTION gin_extract_hstore_query(internal, internal, int2, internal, internal)
251
- RETURNS internal
252
- AS '$libdir/hstore'
253
- LANGUAGE C IMMUTABLE STRICT;
254
-
255
- CREATE OR REPLACE FUNCTION gin_consistent_hstore(internal, int2, internal, int4, internal, internal)
256
- RETURNS bool
257
- AS '$libdir/hstore'
258
- LANGUAGE C IMMUTABLE STRICT;
259
-
260
- CREATE OPERATOR CLASS gin_hstore_ops
261
- DEFAULT FOR TYPE hstore USING gin
262
- AS
263
- OPERATOR 7 @> ,
264
- OPERATOR 9 ?(hstore,text),
265
- FUNCTION 1 bttextcmp(text,text),
266
- FUNCTION 2 gin_extract_hstore(internal, internal),
267
- FUNCTION 3 gin_extract_hstore_query(internal, internal, int2, internal, internal),
268
- FUNCTION 4 gin_consistent_hstore(internal, int2, internal, int4, internal, internal),
269
- STORAGE text;
270
- HSTORE_SQL
271
- execute sql
272
- end
273
-
274
- def self.down
275
- end
276
- end
@@ -1,13 +0,0 @@
1
- class CreateFoos < ActiveRecord::Migration
2
- def self.up
3
- create_table :foos do |t|
4
- t.text :data
5
-
6
- t.timestamps
7
- end
8
- end
9
-
10
- def self.down
11
- drop_table :foos
12
- end
13
- end
@@ -1,12 +0,0 @@
1
- class CreateBars < ActiveRecord::Migration
2
- def self.up
3
- create_table :bars do |t|
4
- t.hstore :data
5
- t.timestamps
6
- end
7
- end
8
-
9
- def self.down
10
- drop_table :bars
11
- end
12
- end
data/app/db/schema.rb DELETED
@@ -1,27 +0,0 @@
1
- # This file is auto-generated from the current state of the database. Instead
2
- # of editing this file, please use the migrations feature of Active Record to
3
- # incrementally modify your database, and then regenerate this schema definition.
4
- #
5
- # Note that this schema.rb definition is the authoritative source for your
6
- # database schema. If you need to create the application database on another
7
- # system, you should be using db:schema:load, not running all the migrations
8
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
- # you'll amass, the slower it'll run and the greater likelihood for issues).
10
- #
11
- # It's strongly recommended to check this file into your version control system.
12
-
13
- ActiveRecord::Schema.define(:version => 20100906191506) do
14
-
15
- create_table "bars", :force => true do |t|
16
- t.hstore "data"
17
- t.datetime "created_at"
18
- t.datetime "updated_at"
19
- end
20
-
21
- create_table "foos", :force => true do |t|
22
- t.text "data"
23
- t.datetime "created_at"
24
- t.datetime "updated_at"
25
- end
26
-
27
- end
data/app/db/seeds.rb DELETED
@@ -1,7 +0,0 @@
1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
- #
4
- # Examples:
5
- #
6
- # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7
- # Mayor.create(:name => 'Daley', :city => cities.first)
@@ -1,2 +0,0 @@
1
- Use this README file to introduce your application and point to useful places in the API for learning more.
2
- Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
@@ -1,47 +0,0 @@
1
- Foo;Bar
2
- foos = File.open('foos.copy','w')
3
- bars = File.open('bars.copy','w')
4
- copy_info = <<-COPY_INFO
5
- COPY tablename [ ( column [, ...] ) ]
6
- FROM { 'filename' | STDIN }
7
- [ [ WITH ]
8
- [ BINARY ]
9
- [ OIDS ]
10
- [ DELIMITER [ AS ] 'delimiter' ]
11
- [ NULL [ AS ] 'null string' ]
12
- [ CSV [ QUOTE [ AS ] 'quote' ]
13
- [ ESCAPE [ AS ] 'escape' ]
14
- [ FORCE NOT NULL column [, ...] ]
15
-
16
- COPY tablename [ ( column [, ...] ) ]
17
- TO { 'filename' | STDOUT }
18
- [ [ WITH ]
19
- [ BINARY ]
20
- [ OIDS ]
21
- [ DELIMITER [ AS ] 'delimiter' ]
22
- [ NULL [ AS ] 'null string' ]
23
- [ CSV [ QUOTE [ AS ] 'quote' ]
24
- [ ESCAPE [ AS ] 'escape' ]
25
- [ FORCE QUOTE column [, ...] ]
26
- COPY_INFO
27
-
28
- 1000000.times do |i|
29
- h = {
30
- 'copy' => copy_info,
31
- 'first key' => i,
32
- 'another key' => i*10,
33
- 'last key' => i*1000,
34
- 'foo' => 'bar'
35
- }
36
- if i % 10000 == 0
37
- perc = i/10000
38
- puts "#{perc}%"
39
- end
40
- foos.write(h.to_yaml.gsub("\n",'\n')+"\n")
41
- bars.write(h.map{|k,v| %("#{k}"=>"#{v}")}.join(" ,").gsub("\n",'\n')+"\n")
42
- end
43
- foos.close
44
- bars.close
45
- `chmod 0777 bars.copy`
46
- `chmod 0777 foos.copy`
47
-
File without changes
data/app/public/404.html DELETED
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/404.html -->
21
- <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
24
- </div>
25
- </body>
26
- </html>
data/app/public/422.html DELETED
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/422.html -->
21
- <div class="dialog">
22
- <h1>The change you wanted was rejected.</h1>
23
- <p>Maybe you tried to change something you didn't have access to.</p>
24
- </div>
25
- </body>
26
- </html>