ruby-postgres 0.7.1.2005.11.24-mswin32
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/ChangeLog +261 -0
- data/Contributors +26 -0
- data/MANIFEST +14 -0
- data/Makefile +139 -0
- data/README +171 -0
- data/README.ja +183 -0
- data/doc/postgres.html +278 -0
- data/doc/postgres.jp.html +256 -0
- data/extconf.rb +33 -0
- data/libpq-compat.c +253 -0
- data/mkmf.log +154 -0
- data/postgres.c +2454 -0
- data/postgres.o +0 -0
- data/postgres.so +0 -0
- data/ruby-postgres.gemspec +35 -0
- data/sample/losample.rb +47 -0
- data/sample/psql.rb +1181 -0
- data/sample/psqlHelp.rb +158 -0
- data/sample/test1.rb +63 -0
- data/sample/test2.rb +44 -0
- data/sample/test4.rb +71 -0
- data/type-oids.h +65 -0
- metadata +61 -0
data/postgres.o
ADDED
Binary file
|
data/postgres.so
ADDED
Binary file
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
SPEC = Gem::Specification.new do |s|
|
5
|
+
s.name = 'ruby-postgres'
|
6
|
+
s.rubyforge_project = 'ruby-postgres'
|
7
|
+
s.version = "0.7.1.#{Date.today}".tr('-', '.')
|
8
|
+
s.summary = 'Ruby extension for PostgreSQL database coordination'
|
9
|
+
s.author = 'Yukihiro Matsumoto, Eiji Matsumoto, Noboru Saitou, Dave Lee'
|
10
|
+
s.email = 'davelee.com@gmail.com'
|
11
|
+
s.homepage = 'http://ruby.scripting.ca/postgres/'
|
12
|
+
s.requirements = 'PostgreSQL libpq library and headers'
|
13
|
+
s.has_rdoc = true
|
14
|
+
s.require_path = '.'
|
15
|
+
s.autorequire = 'postgres'
|
16
|
+
|
17
|
+
if File.exists? 'postgres.so' and PLATFORM =~ /mingw|mswin/
|
18
|
+
s.platform = Gem::Platform::WIN32
|
19
|
+
else
|
20
|
+
s.platform = Gem::Platform::RUBY
|
21
|
+
s.extensions = 'extconf.rb'
|
22
|
+
end
|
23
|
+
|
24
|
+
if File.exists? '_darcs'
|
25
|
+
s.files = Dir.chdir('_darcs/current') { Dir['**/*'] }
|
26
|
+
else
|
27
|
+
s.files = Dir['**/*']
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
if $0 == __FILE__
|
33
|
+
Gem::manage_gems
|
34
|
+
Gem::Builder.new(SPEC).build
|
35
|
+
end
|
data/sample/losample.rb
ADDED
@@ -0,0 +1,47 @@
|
|
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
|
+
|