5bv3gYl3VN1eFM0sXb69ps changeset

Changeset303731393838 (b)
ParentNone (a)
ab
0+require 'rubygems'
0+require 'right_aws'
0+
0+sdb = RightAws::SdbInterface.new(aws_access_key, aws_secret_access_key)
0+
0+# list all SimpleDB Domains for this account
0+sdb.list_domains
0+
0+# all pictures
0+sdb.query("picture")[:items]
0+
0+# particular picture
0+uuid = sdb.query("picture")[:items].first
0+sdb.get_attributes("picture", uuid)
0+
0+# query pictures
0+# everything is a string!
0+sdb.query("picture", "['submitdate' <= '2900']")
0+
0+# no joins
0+sdb.query("picture", "['submitdate' <= '2900'] intersection ['status' = 'approved']")
0+
0+# sorting
0+sdb.query("picture", "['submitdate' <= '2900'] intersection ['status' = 'approved'] sort 'submitdate'")
0+sdb.query("picture", "['submitdate' <= '2900'] intersection ['status' = 'approved'] sort 'submitdate' desc")
0+
0+# paging!
0+sdb.query("picture", "['submitdate' <= '2900'] intersection ['status' = 'approved'] sort 'submitdate' desc", 11)
0+#proof
0+sdb.query("picture", "['submitdate' <= '2900'] intersection ['status' = 'approved'] sort 'submitdate' desc", 11)[:items].length
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--- Revision None
+++ Revision 303731393838
@@ -0,0 +1,30 @@
+require 'rubygems'
+require 'right_aws'
+
+sdb = RightAws::SdbInterface.new(aws_access_key, aws_secret_access_key)
+
+# list all SimpleDB Domains for this account
+sdb.list_domains
+
+# all pictures
+sdb.query("picture")[:items]
+
+# particular picture
+uuid = sdb.query("picture")[:items].first
+sdb.get_attributes("picture", uuid)
+
+# query pictures
+# everything is a string!
+sdb.query("picture", "['submitdate' <= '2900']")
+
+# no joins
+sdb.query("picture", "['submitdate' <= '2900'] intersection ['status' = 'approved']")
+
+# sorting
+sdb.query("picture", "['submitdate' <= '2900'] intersection ['status' = 'approved'] sort 'submitdate'")
+sdb.query("picture", "['submitdate' <= '2900'] intersection ['status' = 'approved'] sort 'submitdate' desc")
+
+# paging!
+sdb.query("picture", "['submitdate' <= '2900'] intersection ['status' = 'approved'] sort 'submitdate' desc", 11)
+#proof
+sdb.query("picture", "['submitdate' <= '2900'] intersection ['status' = 'approved'] sort 'submitdate' desc", 11)[:items].length