postgres 0.7.1 → 0.7.9.2007.12.12

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.
data/sample/losample.rb DELETED
@@ -1,47 +0,0 @@
1
- require "postgres"
2
-
3
- def main
4
- conn = PGconn.connect("localhost",5432,"","")
5
- puts("dbname: " + conn.db + "\thost: " + conn.host + "\tuser: " + conn.user)
6
-
7
- # Transaction
8
- conn.exec("BEGIN")
9
- lobj = conn.loimport("losample.rb")
10
- lobjnum = lobj.oid
11
- puts("loimport ok! oid=" + lobj.oid.to_s)
12
- lobj.open
13
- lobj.seek(0,PGlarge::SEEK_SET) # SEEK_SET or SEEK_CUR or SEEK_END
14
- buff = lobj.read(18)
15
- puts buff
16
- if 'require "postgres"' == buff
17
- puts "read ok!"
18
- end
19
- lobj.seek(0,PGlarge::SEEK_END)
20
- buff = lobj.write("write test ok?\n")
21
- puts lobj.tell
22
- puts 'export test .file:lowrite.losample add "write test of?"...'
23
- lobj.export("lowrite.txt")
24
- lobj.close
25
- conn.exec("COMMIT")
26
- begin
27
- lobj.read(1)
28
- puts "boo!"
29
- return
30
- rescue
31
- puts "ok! Large Object is closed"
32
- end
33
- conn.exec("BEGIN")
34
- puts lobjnum.to_s
35
- lobj = conn.loopen(lobjnum)
36
- puts "large object reopen ok!"
37
- lobj.seek(0,PGlarge::SEEK_SET) # SEEK_SET or SEEK_CUR or SEEK_END
38
- buff = lobj.read(18)
39
- puts buff
40
- puts "reread ok!"
41
- conn.exec("COMMIT")
42
- lobj.unlink
43
- puts "large object unlink"
44
- end
45
-
46
- main
47
-