Converted to Hoe
--HG-- rename : README.OS_X => README.OS_X.md rename : README.ja => README.ja.md rename : README => README.md rename : README.windows => README.windows.md
This commit is contained in:
parent
22a0fe7ccc
commit
17eb6a7d06
65
Contributors
65
Contributors
|
@ -1,32 +1,37 @@
|
|||
Dennis Vshivkov <walrus@amur.ru>
|
||||
Gabriel Emerson <gemerson@evalsoft.com>
|
||||
Noboru Saitou <noborus@netlab.jp>
|
||||
Akinori MUSHA <knu@iDaemons.org>
|
||||
Andy Yu <is@gnuchina.org>
|
||||
Ceri Storey <cez@compsoc.man.ac.uk>
|
||||
Gavin Kistner <gavin@refinery.com>
|
||||
Henry T. So Jr. <henryso@panix.com>
|
||||
Jeremy Henty <jeremy@chaos.org.uk>
|
||||
<kasa@air.linkclub.or.jp>
|
||||
Leon Brooks <leon-ruby-postgres@cyberknights.com.au>
|
||||
Martin Hedenfalk <mahe@kth.se>
|
||||
<matz@zetabits.com>
|
||||
MoonWolf <moonwolf@moonwolf.com>
|
||||
<m_seki@mva.biglobe.ne.jp>
|
||||
Nate Haggard <nate@wordplace.com>
|
||||
Neil Conway <nconway@klamath.dyndns.org>
|
||||
Noboru Matui <silicon@mx1.freemail.ne.jp>
|
||||
Okada Jun <yun@be-in.org>
|
||||
Shirai,Kaoru <shirai@p1jp.com>
|
||||
Riley <wormwood@speakeasy.org>
|
||||
shibata <kshibata@vesta.ocn.ne.jp>
|
||||
<greentea@fa2.so-net.ne.jp>
|
||||
ts <decoux@moulon.inra.fr>
|
||||
Yuta TSUBOI <yuuta-t@is.aist-nara.ac.jp>
|
||||
Lugovoi Nikolai <meadow.nnick@gmail.com>
|
||||
Jeff Davis <ruby@j-davis.com>
|
||||
Bertram Scharpf <software@bertram-scharpf.de>
|
||||
Michael Granger <ged@FaerieMUD.org>
|
||||
Mahlon E. Smith <mahlon@martini.nu>
|
||||
|
||||
Thanks to all the great people that have contributed code, suggestions, and patches through the years. If you contribute a patch, please include a patch for this file that adds your name to the list.
|
||||
|
||||
* Dennis Vshivkov <walrus@amur.ru>
|
||||
* Gabriel Emerson <gemerson@evalsoft.com>
|
||||
* Noboru Saitou <noborus@netlab.jp>
|
||||
* Akinori MUSHA <knu@iDaemons.org>
|
||||
* Andy Yu <is@gnuchina.org>
|
||||
* Ceri Storey <cez@compsoc.man.ac.uk>
|
||||
* Gavin Kistner <gavin@refinery.com>
|
||||
* Henry T. So Jr. <henryso@panix.com>
|
||||
* Jeremy Henty <jeremy@chaos.org.uk>
|
||||
* <kasa@air.linkclub.or.jp>
|
||||
* Leon Brooks <leon-ruby-postgres@cyberknights.com.au>
|
||||
* Martin Hedenfalk <mahe@kth.se>
|
||||
* Yukihiro Matsumoto <matz@zetabits.com>
|
||||
* Eiji Matsumoto <usagi@ruby.club.or.jp>
|
||||
* MoonWolf <moonwolf@moonwolf.com>
|
||||
* <m_seki@mva.biglobe.ne.jp>
|
||||
* Nate Haggard <nate@wordplace.com>
|
||||
* Neil Conway <nconway@klamath.dyndns.org>
|
||||
* Noboru Matui <silicon@mx1.freemail.ne.jp>
|
||||
* Okada Jun <yun@be-in.org>
|
||||
* Shirai,Kaoru <shirai@p1jp.com>
|
||||
* Riley <wormwood@speakeasy.org>
|
||||
* shibata <kshibata@vesta.ocn.ne.jp>
|
||||
* <greentea@fa2.so-net.ne.jp>
|
||||
* ts <decoux@moulon.inra.fr>
|
||||
* Yuta TSUBOI <yuuta-t@is.aist-nara.ac.jp>
|
||||
* Lugovoi Nikolai <meadow.nnick@gmail.com>
|
||||
* Jeff Davis <ruby@j-davis.com>
|
||||
* Bertram Scharpf <software@bertram-scharpf.de>
|
||||
* Michael Granger <ged@FaerieMUD.org>
|
||||
* Mahlon E. Smith <mahlon@martini.nu>
|
||||
|
||||
Jason Yanowitz <me-bitbucket@jasonyanowitz.com>
|
||||
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
## 0.11.0 [2011-02-09] Michael Granger <ged@FaerieMUD.org>
|
||||
|
||||
Enhancements:
|
||||
|
||||
* Added a PGresult#values method to fetch all result rows as an Array of
|
||||
Arrays. Thanks to Jason Yanowitz (JYanowitz at enovafinancial dot com) for
|
||||
the patch.
|
||||
|
||||
|
||||
## 0.10.1 [2011-01-19] Michael Granger <ged@FaerieMUD.org>
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Add an include guard for pg.h
|
||||
* Simplify the common case require of the ext
|
||||
* Include the extconf header
|
||||
* Fix compatibility with versions of PostgreSQL without PQgetCancel. (fixes #36)
|
||||
* Fix require for natively-compiled extension under Windows. (fixes #55)
|
||||
* Change rb_yield_splat() to rb_yield_values() for compatibility with Rubinius. (fixes #54)
|
||||
|
||||
|
||||
## 0.10.0 [2010-12-01] Michael Granger <ged@FaerieMUD.org>
|
||||
|
||||
Enhancements:
|
||||
|
||||
* Added support for the payload of NOTIFY events (w/Mahlon E. Smith)
|
||||
* Updated the build system with Rubygems suggestions from RubyConf 2010
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Fixed issue with PGconn#wait_for_notify that caused it to miss notifications that happened after
|
||||
the LISTEN but before the wait_for_notify.
|
||||
|
||||
## 0.9.0 [2010-02-28] Michael Granger <ged@FaerieMUD.org>
|
||||
|
||||
Bugfixes.
|
||||
|
||||
## 0.8.0 [2009-03-28] Jeff Davis <davis.jeffrey@gmail.com>
|
||||
|
||||
Bugfixes, better Windows support.
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
.gemtest
|
||||
BSD
|
||||
ChangeLog
|
||||
Contributors
|
||||
GPL
|
||||
History.md
|
||||
LICENSE
|
||||
Manifest.txt
|
||||
README.OS_X.md
|
||||
README.ja.md
|
||||
README.md
|
||||
README.windows.md
|
||||
Rakefile
|
||||
ext/compat.c
|
||||
ext/compat.h
|
||||
ext/extconf.rb
|
||||
ext/pg.c
|
||||
ext/pg.h
|
||||
ext/vc/pg.sln
|
||||
ext/vc/pg_18/pg.vcproj
|
||||
ext/vc/pg_19/pg_19.vcproj
|
||||
lib/pg.rb
|
||||
sample/async_api.rb
|
||||
sample/copyfrom.rb
|
||||
sample/losample.rb
|
||||
sample/notify_wait.rb
|
||||
sample/psql.rb
|
||||
sample/psqlHelp.rb
|
||||
sample/test1.rb
|
||||
sample/test2.rb
|
||||
sample/test4.rb
|
||||
sample/test_binary_values.rb
|
||||
spec/data/expected_trace.out
|
||||
spec/data/random_binary_data
|
||||
spec/lib/helpers.rb
|
||||
spec/m17n_spec.rb
|
||||
spec/pgconn_spec.rb
|
||||
spec/pgresult_spec.rb
|
19
README.OS_X
19
README.OS_X
|
@ -1,19 +0,0 @@
|
|||
= Compiling on MacOS X
|
||||
|
||||
If you are building/installing ruby-pg on MacOS X, and the installation doesn't work at first, here are a few things you can try.
|
||||
|
||||
== Compiling With the Correct Architecture
|
||||
|
||||
OS X supports both architecture-specific binaries (e.g. i386), as well as universal binaries (i.e. i386 & ppc). If ruby is built as a universal binary and postgresql is not, you need to specify the path to the appropriate pg_config binary or set the environment variable ARCHFLAGS appropriately.
|
||||
|
||||
For example, if you're using the stock Ruby binary, and PostgreSQL 8.4.x installed from MacPorts (without specifying the {{{+universal}}} variant), do:
|
||||
|
||||
gem install -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
|
||||
|
||||
Alternatively, if the build system can't figure out which architectures it should include, you may need to set the 'ARCHFLAGS' environment variable explicitly:
|
||||
|
||||
sudo env ARCHFLAGS='-arch i386' gem install pg
|
||||
|
||||
or, if you're building from source:
|
||||
|
||||
rake compile ARCHFLAGS="-arch i386"
|
|
@ -0,0 +1,18 @@
|
|||
# Compiling on MacOS X
|
||||
|
||||
If you are building/installing ruby-pg on MacOS X, and the installation doesn't work at first, here are a few things you can try.
|
||||
|
||||
OS X supports both architecture-specific binaries (e.g. i386), as well as universal binaries (i.e. i386 & ppc). If Ruby is built as a universal binary and PostgreSQL is not, you need to specify the path to the appropriate pg_config binary or set the environment variable ARCHFLAGS appropriately.
|
||||
|
||||
For example, if you're using the Ruby binary that comes with OSX, and PostgreSQL 9.0.2 installed from MacPorts (without specifying the `+universal' variant), do:
|
||||
|
||||
gem install -- --with-pg-config=/opt/local/lib/postgresql90/bin/pg_config
|
||||
|
||||
Alternatively, if the build system can't figure out which architectures it should include, you may need to set the 'ARCHFLAGS' environment variable explicitly:
|
||||
|
||||
sudo env ARCHFLAGS='-arch i386' gem install pg
|
||||
|
||||
or, if you're building from source:
|
||||
|
||||
rake compile ARCHFLAGS="-arch i386"
|
||||
|
183
README.ja
183
README.ja
|
@ -1,183 +0,0 @@
|
|||
PostgreSQL$BMQ3HD%%i%$%V%i%j(B version 0.7.1
|
||||
|
||||
$B$^$D$b$H(B $B$f$-$R$m(B
|
||||
$B$^$D$b$H(B $B$($$$8(B
|
||||
|
||||
$B@$OC?M(B: $B@FF#(B $BEP(B
|
||||
|
||||
- What's this ?
|
||||
|
||||
$BK\%i%$%V%i%j$O!"(BRuby$B$+$i(BPostgreSQL$B$X%"%/%;%9$9$k$?$a$N3HD%%i%$%V%i%j$G$9!#(B
|
||||
$B%5%]!<%H$7$F$$$k(BPostgreSQL$B$N%P!<%8%g%s$O!"(B6.5/7.0/7.1/7.2 $B$G$9!#(B6.3$B0JA0$N(B
|
||||
$B%P!<%8%g%s$G$b(B($B$A$g$C$H$7$?JQ99$G(B)$BF0:n$9$k$H;W$$$^$9$,!"%F%9%H$7$F$$$^$;$s!#(B
|
||||
|
||||
- How to install ?
|
||||
*** requirement ***
|
||||
PostgreSQL module$B$r;H$&$s$G$9$+$i!$EvA3(BPostgreSQL$B$OI,MW$G$9$M!%:#$N$H$3$m(B
|
||||
$B%m!<%+%k$K(BPostgreSQL$B$,%$%s%9%H!<%k$5$l$F$$$k$3$H$rA0Ds$K$7$F$$$^$9$,!$(B
|
||||
$BI,MW$J%X%C%@$H(Blibpq$B$5$($"$l$P!$%5!<%P$OI,$:$7$b%m!<%+%k$GF0:n$7$F$$$kI,MW(B
|
||||
$B$O$"$j$^$;$s!%(B
|
||||
|
||||
$B%G%U%)%k%H$G$O!$(BPostgreSQL$B$,(B/usr/local/pgsql$BG[2<$K%$%s%9%H!<%k$5$l$F$$$k(B
|
||||
$B$H$7$F$$$^$9!%JL$N>l=j$K%$%s%9%H!<%k$7$F$$$k>l9g$K$O!$4D6-JQ?t(BPGLIB$B$K(Blibpq
|
||||
$B%i%$%V%i%j$,CV$$$F$"$k(Bdirectory$B$K@_Dj$7$F2<$5$$!#(B
|
||||
|
||||
$BG$0U$N>l=j$G!$$3$N%"!<%+%$%V$rE83+$7$F$/$@$5$$!%8e$O(B
|
||||
|
||||
ruby extconf.rb
|
||||
make
|
||||
su ($B$b$7I,MW$J$i(B)
|
||||
make install
|
||||
|
||||
$B$H$9$k$@$1$G$9!%(BPostgreSQL$B$N%$%s%/%k!<%I%U%!%$%k!"%i%$%V%i%j%U%!%$%k$N(B
|
||||
$B%$%s%9%H!<%k>l=j$,I8=`$N0LCV$G$O$J$/%3%s%Q%$%i$,8+IU$1$k$3$H$,$G$-$J$$(B
|
||||
$B>l9g$K$O(B
|
||||
|
||||
--with-pgsql-include-dir=<$B%$%s%/%k!<%I%U%!%$%k%G%#%l%/%H%j(B>
|
||||
--with-pgsql-lib-dir=<$B%i%$%V%i%j%G%#%l%/%H%j(B>
|
||||
$B$^$?$O(B
|
||||
--with-pgsql-dir=<$B%G%#%l%/%H%j(B>
|
||||
$B$3$l$O0J2<$N$h$&$K;XDj$7$?$H$-$H$*$J$8$G$9!#(B
|
||||
--with-pgsql-include-dir=<$B%G%#%l%/%H%j(B>/include
|
||||
--with-pgsql-lib-dir=<$B%G%#%l%/%H%j(B>/lib
|
||||
|
||||
|
||||
$BNc$($P(B
|
||||
|
||||
ruby extconf.rb --with-pgsql-include-dir=/usr/local/pgsql/include \
|
||||
--with-pgsql-lib-dir=/usr/local/pgsql/lib
|
||||
$B$^$?$O(B
|
||||
ruby extconf.rb --with-pgsql-dir=/usr/local/pgsql
|
||||
|
||||
$B$N$h$&$K;XDj$7$F$/$@$5$$!#(B
|
||||
|
||||
- How to use ?
|
||||
|
||||
require "postgres"
|
||||
|
||||
$B$H$7$F$+$i8f;HMQ2<$5$$!#(B
|
||||
|
||||
- What function can I use ?
|
||||
|
||||
$B4pK\E*$K!"(BC$B$N(Blibpq$B%$%s%?%U%'!<%9$GDj5A$5$l$F$$$k4X?t$O%5%]!<%H$7$F$$$^$9!#(B
|
||||
ver 0.6.0 $B$+$i?7$7$/(B Large Object $B%$%s%?!<%U%'%$%9$,DI2C$5$l$^$7$?!#(B
|
||||
|
||||
$B%5%]!<%H$7$F$$$k%a%=%C%I$N0lMw$O0J2<$NDL$j$G$9!#(B
|
||||
|
||||
PGconn$B%/%i%9(B:
|
||||
|
||||
$B%/%i%9%a%=%C%I(B
|
||||
new
|
||||
connect
|
||||
setdb
|
||||
setdblogin
|
||||
escape
|
||||
quote
|
||||
escape_bytea
|
||||
|
||||
$B%a%=%C%I(B
|
||||
db
|
||||
host
|
||||
options
|
||||
port
|
||||
tty
|
||||
status
|
||||
error
|
||||
finish
|
||||
close
|
||||
reset
|
||||
user
|
||||
trace
|
||||
untrace
|
||||
|
||||
exec
|
||||
query
|
||||
async_exec
|
||||
async_query
|
||||
get_notify
|
||||
insert_table
|
||||
putline
|
||||
getline
|
||||
endcopy
|
||||
notifies
|
||||
|
||||
lo_import
|
||||
lo_export
|
||||
lo_create
|
||||
lo_open
|
||||
lo_unlink
|
||||
|
||||
client_encoding
|
||||
set_client_encoding
|
||||
|
||||
PGresult$B%/%i%9(B:
|
||||
|
||||
$B%a%=%C%I(B
|
||||
each
|
||||
[]
|
||||
status
|
||||
result
|
||||
fields
|
||||
num_tuples
|
||||
num_fields
|
||||
fieldname
|
||||
fieldnum
|
||||
type
|
||||
size
|
||||
getvalue
|
||||
getlength
|
||||
cmdstatus
|
||||
print
|
||||
clear
|
||||
|
||||
PGlarge$B%/%i%9(B:
|
||||
|
||||
$B%a%=%C%I(B
|
||||
open
|
||||
close
|
||||
read
|
||||
write
|
||||
lseek
|
||||
tell
|
||||
unlink
|
||||
oid
|
||||
size
|
||||
export
|
||||
|
||||
- Acknowledgement
|
||||
|
||||
$BK\3HD%%i%$%V%i%j$r:n@.$9$k$K$"$?$C$F!"(Bruby-list, ruby-dev,
|
||||
ruby-talk,$B5Z$S(B pgsql-jp$B%a!<%j%s%0%j%9%H$N%a%s%P!<$K!"B?$/$NM-1W$J(B
|
||||
$B%"%I%P%$%9$rD:$-$^$7$?!#$3$3$K46<U$N0U$rI=$7$^$9!#(B
|
||||
|
||||
- Copying
|
||||
|
||||
$BK\3HD%%i%$%V%i%j$NCx:n8"$O!"$^$D$b$H(B $B$f$-$R$m$H$^$D$b$H(B $B$($$$8$,(B
|
||||
$BJ];}$7$^$9!#(B
|
||||
|
||||
$BK\3HD%%i%$%V%i%j$O!"(BRuby$BK\BN$HF1$8G[I[>r7o$K=>$C$F:FG[I[$9$k$3$H(B
|
||||
$B$,$G$-$^$9!#(BRuby$BK\BN$NG[I[>r7o$K$D$$$F$O!"(BRuby$BG[I[J*Cf$N(BREADME.jp
|
||||
$B$K=q$+$l$F$$$^$9!#(B
|
||||
|
||||
$B8=:_$O@FF#(B $BEP$,(B maintainer $B$r>5$C$F$$$k$N$G!"Ld$$9g$o$;$O$3$A$i$NJ}$K(B
|
||||
$B$*4j$$$7$^$9!#(B
|
||||
|
||||
- Author
|
||||
|
||||
$B$^$D$b$H(B $B$f$-$R$m(B <matz@ruby-lang.org>
|
||||
Author of Ruby
|
||||
|
||||
$B$^$D$b$H(B $B$($$$8(B <usagi@ruby.club.or.jp>
|
||||
One of users who loves Ruby
|
||||
|
||||
$B$3$N$U$?$j$O7;Do$G$O$"$j$^$;$s!#(B :-)
|
||||
|
||||
- Special Thanks
|
||||
|
||||
Guy Decoux ts <decoux@moulon.inra.fr>
|
||||
|
||||
- maintainer
|
||||
|
||||
$B@FF#(B $BEP(B <noborus@netlab.jp>
|
||||
$B$^$D$b$H$G$J$/$F$9$$$^$;$s(B :-)
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# pg
|
||||
|
||||
* https://bitbucket.org/ged/ruby-pg
|
||||
|
||||
This file needs translation. Anyone who is willing to volunteer, please mail <ged@FaerieMUD.org>.
|
||||
|
|
@ -1,54 +1,75 @@
|
|||
= ruby-pg: Ruby interface to PostgreSQL RDBMS
|
||||
# pg
|
||||
|
||||
This is the extension library to access a PostgreSQL database from Ruby. This
|
||||
library works with PostgreSQL 7.4 and later.
|
||||
* https://bitbucket.org/ged/ruby-pg
|
||||
|
||||
== Requirements
|
||||
## Description
|
||||
|
||||
Pg is the Ruby interface to the [PostgreSQL RDBMS][postgresql].
|
||||
|
||||
It works with PostgreSQL 8.2 and later.
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
* Ruby 1.8.7-p174 or later.
|
||||
* PostgreSQL 7.4 or later installed.
|
||||
* PostgreSQL 8.2.x or later installed.
|
||||
|
||||
It may work with earlier versions as well, but those are not regularly tested.
|
||||
|
||||
== How To Install
|
||||
|
||||
## How To Install
|
||||
|
||||
Install via RubyGems:
|
||||
|
||||
gem install pg
|
||||
|
||||
Or install from source:
|
||||
|
||||
rake install
|
||||
gem install pg
|
||||
|
||||
You may need to specify the path to the 'pg_config' program installed with
|
||||
Postgres:
|
||||
|
||||
rake -- --with-pg-config=<path to pg_config>
|
||||
gem install pg -- --with-pg-config=<path to pg_config>
|
||||
|
||||
For example, on a Mac with PostgreSQL installed via MacPorts
|
||||
(<tt>port install postgresql84</tt>):
|
||||
For example, on a Mac with PostgreSQL installed via MacPorts (`port install
|
||||
postgresql90`):
|
||||
|
||||
rake install -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
|
||||
gem install pg -- \
|
||||
--with-pg-config=/opt/local/lib/postgresql90/bin/pg_config
|
||||
|
||||
See README.OS_X for more information about installing under MacOS X, and
|
||||
README.windows for Windows build/installation instructions.
|
||||
See README.OS_X.md for more information about installing under MacOS X, and
|
||||
README.windows.md for Windows build/installation instructions.
|
||||
|
||||
== Copying
|
||||
|
||||
## Contributing
|
||||
|
||||
To report bugs, suggest features, or check out the source with Mercurial,
|
||||
[check out the project page][bitbucket]. If you prefer Git, there's also a
|
||||
[Github mirror][github].
|
||||
|
||||
After checking out the source, run:
|
||||
|
||||
$ rake newb
|
||||
|
||||
This task will install any missing dependencies, run the tests/specs, and
|
||||
generate the API documentation.
|
||||
|
||||
|
||||
## Copying
|
||||
|
||||
This library is copyrighted by the authors.
|
||||
|
||||
Authors:
|
||||
|
||||
* Yukihiro Matsumoto <matz@ruby-lang.org> - Author of Ruby.
|
||||
* Eiji Matsumoto <usagi@ruby.club.or.jp> - One of users who loves Ruby.
|
||||
* Jeff Davis <ruby-pg@j-davis.com>
|
||||
|
||||
Thanks to:
|
||||
|
||||
* Noboru Saitou <noborus@netlab.jp> - Past maintainer.
|
||||
* Dave Lee - Past maintainer.
|
||||
* Guy Decoux (ts) <decoux@moulon.inra.fr>
|
||||
|
||||
Maintainers:
|
||||
* Jeff Davis <ruby-pg@j-davis.com>
|
||||
|
||||
* Michael Granger <ged@FaerieMUD.org>
|
||||
|
||||
You may redistribute this software under the terms of the Ruby license,
|
||||
|
@ -60,9 +81,14 @@ under the terms of the BSD license, included in the file "BSD".
|
|||
|
||||
Portions copyright LAIKA, Inc.
|
||||
|
||||
== Acknowledgments
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
We are thankful to the people at the ruby-list and ruby-dev mailing lists.
|
||||
And to the people who developed PostgreSQL.
|
||||
|
||||
|
||||
[postgresql]:http://www.postgresql.org/
|
||||
[bitbucket]:http://bitbucket.org/ged/ruby-pg
|
||||
[github]:https://github.com/ged/ruby-pg
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
= Compiling on MS Windows
|
||||
# Compiling 'pg' on MS Windows
|
||||
|
||||
In order to build this extension on MS Windows you will need a couple things.
|
||||
|
||||
|
@ -24,13 +23,13 @@ In order to build ruby-pg, just run 'rake'. If the pg_config.exe executable
|
|||
is not in your PATH, you'll need to explicitly point ruby-pg to where your
|
||||
PostgreSQL headers and libraries are with something like this:
|
||||
|
||||
rake --with-pg-dir=c:/progra~1/postgr~1/8.3
|
||||
rake --with-pg-dir=c:/progra~1/postgr~1/8.3
|
||||
|
||||
Adjust your path accordingly. BE SURE TO USE THE SHORT PATH NAMES! If you
|
||||
try to use a path with spaces in it, the nmake.exe program will choke.
|
||||
|
||||
|
||||
== Cross compiling for mswin32
|
||||
## Cross compiling for mswin32
|
||||
|
||||
Using rake-compiler a cross compiled pg-gem can be build on a linux host for
|
||||
the win32 platform. The generated gem is statically linked against libpq and
|
||||
|
@ -39,37 +38,38 @@ There are no runtime dependencies to any but the standard Windows DLLs.
|
|||
|
||||
Install mingw32. On a debian based system this should work:
|
||||
|
||||
apt-get install mingw32
|
||||
apt-get install mingw32
|
||||
|
||||
On MacOS X, if you have MacPorts installed:
|
||||
|
||||
port install i386-mingw32-gcc
|
||||
port install i386-mingw32-gcc
|
||||
|
||||
Install the rake-compiler:
|
||||
|
||||
gem install rake-compiler
|
||||
gem install rake-compiler
|
||||
|
||||
Download and cross compile ruby 1.8 and 1.9 for win32:
|
||||
|
||||
rake-compiler cross-ruby VERSION=1.8.7-p334
|
||||
rake-compiler cross-ruby VERSION=1.9.2-p180
|
||||
rake-compiler cross-ruby VERSION=1.8.7-p334
|
||||
rake-compiler cross-ruby VERSION=1.9.2-p180
|
||||
|
||||
Download and cross compile pg for win32:
|
||||
|
||||
rake cross native gem
|
||||
rake cross native gem
|
||||
|
||||
or with custom versions:
|
||||
rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.2 OPENSSL_VERSION=1.0.0d POSTGRESQL_VERSION=9.0.3
|
||||
|
||||
rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.2 OPENSSL_VERSION=1.0.0d POSTGRESQL_VERSION=9.0.3
|
||||
|
||||
If everything works, there should be pg-VERSION-x86-mswin32.gem in the pkg
|
||||
directory.
|
||||
|
||||
|
||||
If you have any problems you can submit them via the project's issue-tracker:
|
||||
## Reporting Problems
|
||||
|
||||
http://bitbucket.org/ged/ruby-pg/issues/new/
|
||||
If you have any problems you can submit them via [the project's issue-tracker][bitbucket], or you can join the mailing list:
|
||||
|
||||
Or you can join the mailing list:
|
||||
|
||||
ruby-pg-general@rubyforge.org
|
||||
ruby-pg-general@rubyforge.org
|
||||
|
||||
And submit questions, problems, or solutions, so that it can be improved.
|
||||
|
442
Rakefile
442
Rakefile
|
@ -1,364 +1,134 @@
|
|||
#!rake -*- ruby -*-
|
||||
#
|
||||
# pg rakefile
|
||||
#
|
||||
# Based on various other Rakefiles, especially one by Ben Bleything
|
||||
#
|
||||
# Copyright (c) 2007-2010 The FaerieMUD Consortium
|
||||
#
|
||||
# Authors:
|
||||
# * Michael Granger <ged@FaerieMUD.org>
|
||||
#
|
||||
|
||||
BEGIN {
|
||||
require 'rbconfig'
|
||||
require 'pathname'
|
||||
basedir = Pathname.new( __FILE__ ).dirname
|
||||
|
||||
libdir = basedir + "lib"
|
||||
extdir = libdir + Config::CONFIG['sitearch']
|
||||
|
||||
$LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
|
||||
$LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
|
||||
$LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
|
||||
}
|
||||
|
||||
begin
|
||||
require 'readline'
|
||||
include Readline
|
||||
rescue LoadError
|
||||
# Fall back to a plain prompt
|
||||
def readline( text )
|
||||
$stderr.print( text.chomp )
|
||||
return $stdin.gets
|
||||
end
|
||||
end
|
||||
|
||||
begin
|
||||
require 'rubygems'
|
||||
rescue LoadError
|
||||
module Gem
|
||||
class Specification; end
|
||||
end
|
||||
end
|
||||
#!/usr/bin/env rake
|
||||
|
||||
require 'rbconfig'
|
||||
require 'rake'
|
||||
require 'rake/testtask'
|
||||
require 'rake/packagetask'
|
||||
require 'pathname'
|
||||
require 'tmpdir'
|
||||
|
||||
begin
|
||||
require 'rake/extensiontask'
|
||||
rescue LoadError
|
||||
abort "This Rakefile requires rake-compiler (gem install rake-compiler)"
|
||||
end
|
||||
|
||||
begin
|
||||
require 'hoe'
|
||||
rescue LoadError
|
||||
abort "This Rakefile requires hoe (gem install hoe)"
|
||||
end
|
||||
|
||||
require 'rake/clean'
|
||||
# require 'rake/191_compat.rb'
|
||||
|
||||
$dryrun = false
|
||||
# Build directory constants
|
||||
BASEDIR = Pathname( __FILE__ ).dirname
|
||||
SPECDIR = BASEDIR + 'spec'
|
||||
LIBDIR = BASEDIR + 'lib'
|
||||
EXTDIR = BASEDIR + 'ext'
|
||||
PKGDIR = BASEDIR + 'pkg'
|
||||
TMPDIR = BASEDIR + 'tmp'
|
||||
|
||||
### Config constants
|
||||
BASEDIR = Pathname.new( __FILE__ ).dirname.relative_path_from( Pathname.getwd )
|
||||
BINDIR = BASEDIR + 'bin'
|
||||
LIBDIR = BASEDIR + 'lib'
|
||||
EXTDIR = BASEDIR + 'ext'
|
||||
DOCSDIR = BASEDIR + 'docs'
|
||||
PKGDIR = BASEDIR + 'pkg'
|
||||
DATADIR = BASEDIR + 'data'
|
||||
DLEXT = Config::CONFIG['DLEXT']
|
||||
EXT = LIBDIR + "pg_ext.#{DLEXT}"
|
||||
|
||||
MANUALDIR = DOCSDIR + 'manual'
|
||||
TESTING_TMPDIRS = Rake::FileList[ "#{Dir.tmpdir}/tmp_test_*" ]
|
||||
|
||||
PROJECT_NAME = 'pg'
|
||||
PKG_NAME = PROJECT_NAME.downcase
|
||||
PKG_SUMMARY = 'A Ruby interface to the PostgreSQL RDBMS'
|
||||
CLOBBER.include( *TESTING_TMPDIRS )
|
||||
CLEAN.include( PKGDIR.to_s, TMPDIR.to_s )
|
||||
|
||||
# Cruisecontrol stuff
|
||||
CC_BUILD_LABEL = ENV['CC_BUILD_LABEL']
|
||||
CC_BUILD_ARTIFACTS = ENV['CC_BUILD_ARTIFACTS'] || 'artifacts'
|
||||
# Set up Hoe plugins
|
||||
Hoe.plugin :mercurial
|
||||
Hoe.plugin :signing
|
||||
|
||||
VERSION_FILE = LIBDIR + '../ext/pg.c'
|
||||
if VERSION_FILE.exist? && buildrev = ENV['CC_BUILD_LABEL']
|
||||
PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] + '.' + buildrev
|
||||
elsif VERSION_FILE.exist?
|
||||
PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ]
|
||||
Hoe.plugins.delete :rubyforge
|
||||
Hoe.plugins.delete :compiler
|
||||
|
||||
|
||||
# Hoe specification
|
||||
$hoespec = Hoe.spec 'pg' do
|
||||
self.readme_file = 'README.md'
|
||||
self.history_file = 'History.md'
|
||||
|
||||
self.developer 'Jeff Davis', 'ruby-pg@j-davis.com'
|
||||
self.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
||||
|
||||
self.dependency 'rake-compiler', '~> 0.7'
|
||||
self.dependency 'rspec', '~> 2.4', :developer
|
||||
|
||||
self.spec_extras[:licenses] = ['BSD', 'Ruby', 'GPL']
|
||||
self.spec_extras[:extensions] = [ 'ext/extconf.rb' ]
|
||||
|
||||
self.require_ruby_version( '>= 1.8.7' )
|
||||
|
||||
self.hg_sign_tags = true if self.plugin?( :mercurial )
|
||||
|
||||
self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
|
||||
end
|
||||
|
||||
PKG_VERSION = '0.0.0' unless defined?( PKG_VERSION ) && !PKG_VERSION.nil?
|
||||
ENV['VERSION'] ||= $hoespec.spec.version.to_s
|
||||
|
||||
PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}"
|
||||
GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem"
|
||||
# Tests should pass before checking in
|
||||
task 'hg:precheckin' => :spec
|
||||
|
||||
# Universal VCS constants
|
||||
DEFAULT_EDITOR = 'vi'
|
||||
COMMIT_MSG_FILE = 'commit-msg.txt'
|
||||
FILE_INDENT = " " * 12
|
||||
LOG_INDENT = " " * 3
|
||||
# Support for 'rvm specs'
|
||||
task :specs => :spec
|
||||
|
||||
EXTCONF = EXTDIR + 'extconf.rb'
|
||||
# Compile before testing
|
||||
task :spec => :compile
|
||||
|
||||
ARTIFACTS_DIR = Pathname.new( CC_BUILD_ARTIFACTS )
|
||||
|
||||
TEXT_FILES = Rake::FileList.new( %w[Rakefile ChangeLog README* LICENSE] )
|
||||
BIN_FILES = Rake::FileList.new( "#{BINDIR}/*" )
|
||||
LIB_FILES = Rake::FileList.new( "#{LIBDIR}/**/*.rb" )
|
||||
EXT_FILES = Rake::FileList.new( "#{EXTDIR}/**/*.{c,h,rb}" )
|
||||
DATA_FILES = Rake::FileList.new( "#{DATADIR}/**/*" )
|
||||
|
||||
SPECDIR = BASEDIR + 'spec'
|
||||
SPECLIBDIR = SPECDIR + 'lib'
|
||||
SPEC_FILES = Rake::FileList.new( "#{SPECDIR}/**/*_spec.rb", "#{SPECLIBDIR}/**/*.rb" )
|
||||
|
||||
TESTDIR = BASEDIR + 'tests'
|
||||
TEST_FILES = Rake::FileList.new( "#{TESTDIR}/**/*.tests.rb" )
|
||||
|
||||
RAKE_TASKDIR = BASEDIR + 'rake'
|
||||
RAKE_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/*.rb" )
|
||||
PKG_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/{191_compat,helpers,packaging,rdoc,testing}.rb" )
|
||||
PKG_TASKLIBS.include( "#{RAKE_TASKDIR}/manual.rb" ) if MANUALDIR.exist?
|
||||
|
||||
RAKE_TASKLIBS_URL = 'http://repo.deveiate.org/rake-tasklibs'
|
||||
|
||||
LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local'
|
||||
|
||||
EXTRA_PKGFILES = Rake::FileList.new
|
||||
EXTRA_PKGFILES.include( "#{BASEDIR}/README.*" )
|
||||
EXTRA_PKGFILES.include( "#{BASEDIR}/GPL" )
|
||||
EXTRA_PKGFILES.include( "#{BASEDIR}/BSD" )
|
||||
EXTRA_PKGFILES.include( "#{BASEDIR}/Contributors" )
|
||||
|
||||
RELEASE_FILES = TEXT_FILES +
|
||||
SPEC_FILES +
|
||||
TEST_FILES +
|
||||
BIN_FILES +
|
||||
LIB_FILES +
|
||||
EXT_FILES +
|
||||
DATA_FILES +
|
||||
RAKE_TASKLIBS +
|
||||
EXTRA_PKGFILES
|
||||
|
||||
|
||||
RELEASE_FILES << LOCAL_RAKEFILE.to_s if LOCAL_RAKEFILE.exist?
|
||||
|
||||
RELEASE_ANNOUNCE_ADDRESSES = [
|
||||
"Ruby-Talk List <ruby-talk@ruby-lang.org>",
|
||||
]
|
||||
|
||||
COVERAGE_MINIMUM = ENV['COVERAGE_MINIMUM'] ? Float( ENV['COVERAGE_MINIMUM'] ) : 85.0
|
||||
RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib'
|
||||
RCOV_OPTS = [
|
||||
'--exclude', RCOV_EXCLUDES,
|
||||
'--xrefs',
|
||||
'--save',
|
||||
'--callsites',
|
||||
#'--aggregate', 'coverage.data' # <- doesn't work as of 0.8.1.2.0
|
||||
]
|
||||
|
||||
|
||||
### Load some task libraries that need to be loaded early
|
||||
if !RAKE_TASKDIR.exist?
|
||||
$stderr.puts "It seems you don't have the build task directory. Shall I fetch it "
|
||||
ans = readline( "for you? [y]" )
|
||||
ans = 'y' if !ans.nil? && ans.empty?
|
||||
|
||||
if ans =~ /^y/i
|
||||
$stderr.puts "Okay, fetching #{RAKE_TASKLIBS_URL} into #{RAKE_TASKDIR}..."
|
||||
system 'hg', 'clone', RAKE_TASKLIBS_URL, "./#{RAKE_TASKDIR}"
|
||||
if ! $?.success?
|
||||
fail "Damn. That didn't work. Giving up; maybe try manually fetching?"
|
||||
end
|
||||
else
|
||||
$stderr.puts "Then I'm afraid I can't continue. Best of luck."
|
||||
fail "Rake tasklibs not present."
|
||||
end
|
||||
|
||||
RAKE_TASKLIBS.include( "#{RAKE_TASKDIR}/*.rb" )
|
||||
# gem-testers support
|
||||
task :test do
|
||||
# rake-compiler always wants to copy the compiled extension into lib/, but
|
||||
# we don't want testers to have to re-compile, especially since that
|
||||
# often fails because they can't (and shouldn't have to) write to tmp/ in
|
||||
# the installed gem dir. So we clear the task rake-compiler set up
|
||||
# to break the dependency between :spec and :compile when running under
|
||||
# rubygems-test, and then run :spec.
|
||||
Rake::Task[ EXT.to_s ].clear
|
||||
Rake::Task[ :spec ].execute
|
||||
end
|
||||
|
||||
require RAKE_TASKDIR + 'helpers.rb'
|
||||
include RakefileHelpers
|
||||
|
||||
# Set the build ID if the mercurial executable is available
|
||||
if hg = which( 'hg' )
|
||||
id = `#{hg} id -n`.chomp
|
||||
PKG_BUILD = (id.chomp[ /^[[:xdigit:]]+/ ] || '1')
|
||||
else
|
||||
PKG_BUILD = '0'
|
||||
end
|
||||
SNAPSHOT_PKG_NAME = "#{PKG_FILE_NAME}.#{PKG_BUILD}"
|
||||
SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem"
|
||||
|
||||
# Documentation constants
|
||||
API_DOCSDIR = DOCSDIR + 'api'
|
||||
README_FILE = TEXT_FILES.find {|path| path =~ /^README/ } || 'README'
|
||||
RDOC_OPTIONS = [
|
||||
'--tab-width=4',
|
||||
'--show-hash',
|
||||
'--include', BASEDIR.to_s,
|
||||
"--main=#{README_FILE}",
|
||||
"--title=#{PKG_NAME}",
|
||||
]
|
||||
YARD_OPTIONS = [
|
||||
'--use-cache',
|
||||
'--protected',
|
||||
'-r', README_FILE,
|
||||
'--exclude', 'extconf\\.rb',
|
||||
'--files', 'ChangeLog,LICENSE',
|
||||
'--output-dir', API_DOCSDIR.to_s,
|
||||
'--title', "#{PKG_NAME} #{PKG_VERSION}",
|
||||
]
|
||||
|
||||
# Release constants
|
||||
SMTP_HOST = "mail.faeriemud.org"
|
||||
SMTP_PORT = 465 # SMTP + SSL
|
||||
|
||||
# Project constants
|
||||
PROJECT_HOST = 'deveiate.org'
|
||||
PROJECT_PUBDIR = '/usr/local/www/public/code/'
|
||||
PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}"
|
||||
PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}"
|
||||
PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}"
|
||||
|
||||
GEM_PUBHOST = 'rubygems.org'
|
||||
|
||||
# Gem dependencies: gemname => version
|
||||
DEPENDENCIES = {
|
||||
}
|
||||
|
||||
# Developer Gem dependencies: gemname => version
|
||||
DEVELOPMENT_DEPENDENCIES = {
|
||||
'rake' => '~> 0.8.7',
|
||||
'rcodetools' => '~> 0.7.0.0',
|
||||
'rcov' => '~> 0.8.1.2.0',
|
||||
'yard' => '~> 0.6.1',
|
||||
'RedCloth' => '~> 4.2.3',
|
||||
'rspec' => '~> 2.0.1',
|
||||
'ruby-termios' => '~> 0.9.6',
|
||||
'text-format' => '~> 1.0.0',
|
||||
'tmail' => '~> 1.2.3.1',
|
||||
'rake-compiler' => '~>0.7.0',
|
||||
}
|
||||
|
||||
# Non-gem requirements: packagename => version
|
||||
REQUIREMENTS = {
|
||||
'PostgreSQL' => '>=7.4',
|
||||
}
|
||||
|
||||
# RubyGem specification
|
||||
GEMSPEC = Gem::Specification.new do |gem|
|
||||
gem.name = PKG_NAME.downcase
|
||||
gem.version = PKG_VERSION
|
||||
|
||||
gem.summary = PKG_SUMMARY
|
||||
gem.description = [
|
||||
"This is the extension library to access a PostgreSQL database from Ruby.",
|
||||
"This library works with PostgreSQL 7.4 and later.",
|
||||
].join( "\n" )
|
||||
|
||||
gem.authors = ["Jeff Davis", "Michael Granger"]
|
||||
gem.email = ["ruby-pg@j-davis.com", "ged@FaerieMUD.org"]
|
||||
gem.homepage = 'http://bitbucket.org/ged/ruby-pg/'
|
||||
gem.licenses = ["Ruby", "GPL", "BSD"]
|
||||
|
||||
gem.has_rdoc = true
|
||||
gem.rdoc_options = RDOC_OPTIONS
|
||||
gem.extra_rdoc_files = TEXT_FILES - [ 'Rakefile' ]
|
||||
|
||||
gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s
|
||||
gem.executables = BIN_FILES.select {|pn| File.executable?(pn) }.
|
||||
collect {|pn| File.basename(pn) }
|
||||
gem.require_paths << EXTDIR.relative_path_from( BASEDIR ).to_s if EXTDIR.exist?
|
||||
|
||||
if EXTCONF.exist?
|
||||
gem.extensions << EXTCONF.relative_path_from( BASEDIR ).to_s
|
||||
end
|
||||
|
||||
gem.files = RELEASE_FILES
|
||||
gem.test_files = SPEC_FILES
|
||||
|
||||
# signing key and certificate chain
|
||||
gem.signing_key = '/Volumes/Keys/ged-private_gem_key.pem'
|
||||
gem.cert_chain = [File.expand_path('~/.gem/ged-public_gem_cert.pem')]
|
||||
|
||||
|
||||
gem.required_ruby_version = '>=1.8.7'
|
||||
|
||||
DEPENDENCIES.each do |name, version|
|
||||
version = '>= 0' if version.length.zero?
|
||||
gem.add_runtime_dependency( name, version )
|
||||
end
|
||||
|
||||
REQUIREMENTS.each do |name, version|
|
||||
gem.requirements << [ name, version ].compact.join(' ')
|
||||
end
|
||||
desc "Turn on warnings and debugging in the build."
|
||||
task :maint do
|
||||
ENV['MAINTAINER_MODE'] = 'yes'
|
||||
end
|
||||
|
||||
$trace = Rake.application.options.trace ? true : false
|
||||
$dryrun = Rake.application.options.dryrun ? true : false
|
||||
$include_dev_dependencies = false
|
||||
ENV['RUBY_CC_VERSION'] = '1.8.7:1.9.2'
|
||||
|
||||
# Load any remaining task libraries
|
||||
RAKE_TASKLIBS.each do |tasklib|
|
||||
next if tasklib.to_s =~ %r{/helpers\.rb$}
|
||||
# Rake-compiler task
|
||||
Rake::ExtensionTask.new do |ext|
|
||||
ext.name = 'pg_ext'
|
||||
ext.gem_spec = $hoespec.spec
|
||||
ext.ext_dir = 'ext'
|
||||
ext.lib_dir = 'lib'
|
||||
ext.source_pattern = "*.{c,h}"
|
||||
ext.cross_compile = true
|
||||
ext.cross_platform = %w[i386-mswin32 i386-mingw32]
|
||||
end
|
||||
|
||||
|
||||
# Make the ChangeLog update if the repo has changed since it was last built
|
||||
file '.hg/branch' do
|
||||
abort "You need the Mercurial repo to make packages"
|
||||
end
|
||||
file 'ChangeLog' => '.hg/branch' do |task|
|
||||
$stderr.puts "Updating the changelog..."
|
||||
begin
|
||||
trace " loading tasklib %s" % [ tasklib ]
|
||||
import tasklib
|
||||
rescue ScriptError => err
|
||||
fail "Task library '%s' failed to load: %s: %s" %
|
||||
[ tasklib, err.class.name, err.message ]
|
||||
trace "Backtrace: \n " + err.backtrace.join( "\n " )
|
||||
rescue => err
|
||||
log "Task library '%s' failed to load: %s: %s. Some tasks may not be available." %
|
||||
[ tasklib, err.class.name, err.message ]
|
||||
trace "Backtrace: \n " + err.backtrace.join( "\n " )
|
||||
content = make_changelog()
|
||||
rescue NameError
|
||||
abort "Packaging tasks require the hoe-mercurial plugin (gem install hoe-mercurial)"
|
||||
end
|
||||
File.open( task.name, 'w', 0644 ) do |fh|
|
||||
fh.print( content )
|
||||
end
|
||||
end
|
||||
|
||||
# Load any project-specific rules defined in 'Rakefile.local' if it exists
|
||||
import LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist?
|
||||
# Rebuild the ChangeLog immediately before release
|
||||
task :prerelease => 'ChangeLog'
|
||||
|
||||
|
||||
#####################################################################
|
||||
### T A S K S
|
||||
#####################################################################
|
||||
|
||||
### Default task
|
||||
task :default => [:clean, :local, :spec, :apidocs, :package]
|
||||
|
||||
### Task the local Rakefile can append to -- no-op by default
|
||||
task :local
|
||||
|
||||
### Task: clean
|
||||
CLEAN.include 'coverage', '**/*.orig', '**/*.rej'
|
||||
CLOBBER.include 'artifacts', 'coverage.info', 'ChangeLog', PKGDIR
|
||||
|
||||
### Task: changelog
|
||||
file 'ChangeLog' do |task|
|
||||
log "Updating #{task.name}"
|
||||
|
||||
changelog = make_changelog()
|
||||
File.open( task.name, 'w' ) do |fh|
|
||||
fh.print( changelog )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
### Task: cruise (Cruisecontrol task)
|
||||
desc "Cruisecontrol build"
|
||||
task :cruise => [:clean, 'spec:quiet', :package] do |task|
|
||||
raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty?
|
||||
artifact_dir = ARTIFACTS_DIR.cleanpath + (CC_BUILD_LABEL || Time.now.strftime('%Y%m%d-%T'))
|
||||
artifact_dir.mkpath
|
||||
|
||||
coverage = BASEDIR + 'coverage'
|
||||
if coverage.exist? && coverage.directory?
|
||||
$stderr.puts "Copying coverage stats..."
|
||||
FileUtils.cp_r( 'coverage', artifact_dir )
|
||||
end
|
||||
|
||||
$stderr.puts "Copying packages..."
|
||||
FileUtils.cp_r( FileList['pkg/*'].to_a, artifact_dir )
|
||||
end
|
||||
|
||||
|
||||
desc "Update the build system to the latest version"
|
||||
task :update_build do
|
||||
log "Updating the build system"
|
||||
run 'hg', '-R', RAKE_TASKDIR, 'pull', '-u'
|
||||
log "Updating the Rakefile"
|
||||
sh 'rake', '-f', RAKE_TASKDIR + 'Metarakefile'
|
||||
desc "Stop any Postmaster instances that remain after testing."
|
||||
task :cleanup_testing_dbs do
|
||||
require 'spec/lib/helpers'
|
||||
PgTestingHelpers.stop_existing_postmasters()
|
||||
Rake::Task[:clean].invoke
|
||||
end
|
||||
|
||||
|
|
312
Rakefile.local
312
Rakefile.local
|
@ -1,312 +0,0 @@
|
|||
#!rake
|
||||
|
||||
require 'uri'
|
||||
require 'tempfile'
|
||||
require 'rbconfig'
|
||||
|
||||
MISCDIR = BASEDIR + 'misc'
|
||||
|
||||
EXT_MAKEFILE = EXTDIR + 'Makefile'
|
||||
EXT_SOURCES = FileList[ EXTDIR + '*.c' ]
|
||||
EXT_SO = EXTDIR + "pg_ext.#{CONFIG['DLEXT']}"
|
||||
|
||||
NUM_CPUS = if File.exist?('/proc/cpuinfo')
|
||||
File.read('/proc/cpuinfo').scan('processor').length
|
||||
elsif RUBY_PLATFORM.include?( 'darwin' )
|
||||
`system_profiler SPHardwareDataType | grep 'Cores' | awk '{print $5}'`.chomp
|
||||
else
|
||||
1
|
||||
end
|
||||
|
||||
# Cross-compilation constants
|
||||
OPENSSL_VERSION = ENV['OPENSSL_VERSION'] || '1.0.0d'
|
||||
POSTGRESQL_VERSION = ENV['POSTGRESQL_VERSION'] || '9.0.3'
|
||||
|
||||
COMPILE_HOME = Pathname( "~/.rake-compiler" ).expand_path
|
||||
STATIC_SOURCESDIR = COMPILE_HOME + 'sources'
|
||||
STATIC_BUILDDIR = COMPILE_HOME + 'builds'
|
||||
|
||||
# Static OpenSSL build vars
|
||||
STATIC_OPENSSL_BUILDDIR = STATIC_BUILDDIR + "openssl-#{OPENSSL_VERSION}"
|
||||
|
||||
OPENSSL_SOURCE_URI =
|
||||
URI( "http://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz" )
|
||||
OPENSSL_TARBALL = STATIC_SOURCESDIR + File.basename( OPENSSL_SOURCE_URI.path )
|
||||
OPENSSL_MAKEFILE = STATIC_OPENSSL_BUILDDIR + 'Makefile'
|
||||
|
||||
LIBSSLEAY32 = STATIC_OPENSSL_BUILDDIR + 'libssleay32.a'
|
||||
LIBEAY32 = STATIC_OPENSSL_BUILDDIR + 'libeay32.a'
|
||||
|
||||
OPENSSL_PATCHES = Rake::FileList[ MISCDIR + "openssl-#{OPENSSL_VERSION}.*.patch" ]
|
||||
|
||||
# Static PostgreSQL build vars
|
||||
STATIC_POSTGRESQL_BUILDDIR = STATIC_BUILDDIR + "postgresql-#{POSTGRESQL_VERSION}"
|
||||
POSTGRESQL_SOURCE_URI = begin
|
||||
uristring = "http://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/" +
|
||||
"v%s/postgresql-%s.tar.gz" % [ POSTGRESQL_VERSION, POSTGRESQL_VERSION ]
|
||||
URI( uristring )
|
||||
end
|
||||
POSTGRESQL_TARBALL = STATIC_SOURCESDIR + File.basename( POSTGRESQL_SOURCE_URI.path )
|
||||
|
||||
STATIC_POSTGRESQL_SRCDIR = STATIC_POSTGRESQL_BUILDDIR + 'src'
|
||||
STATIC_POSTGRESQL_LIBDIR = STATIC_POSTGRESQL_SRCDIR + 'interfaces/libpq'
|
||||
STATIC_POSTGRESQL_INCDIR = STATIC_POSTGRESQL_SRCDIR + 'include'
|
||||
|
||||
POSTGRESQL_GLOBAL_MAKEFILE = STATIC_POSTGRESQL_SRCDIR + 'Makefile.global'
|
||||
POSTGRESQL_SHLIB_MAKEFILE = STATIC_POSTGRESQL_SRCDIR + 'Makefile.shlib'
|
||||
POSTGRESQL_SHLIB_MF_ORIG = STATIC_POSTGRESQL_SRCDIR + 'Makefile.shlib.orig'
|
||||
POSTGRESQL_LIB = STATIC_POSTGRESQL_LIBDIR + 'libpq.a'
|
||||
|
||||
CROSS_PREFIX = if RUBY_PLATFORM.include?( 'darwin' )
|
||||
'i386-mingw32'
|
||||
else
|
||||
'i586-mingw32msvc'
|
||||
end
|
||||
|
||||
# Make sure the spec data is packaged up with the gem
|
||||
SPEC_DATA = Rake::FileList[ SPECDIR + 'data/*' ]
|
||||
GEMSPEC.test_files += SPEC_DATA.to_a
|
||||
|
||||
# Clean up any testing database directories
|
||||
TESTING_TMPDIRS = Rake::FileList[ "#{BASEDIR}/tmp_test_*" ]
|
||||
CLOBBER.include( STATIC_SOURCESDIR.to_s, *TESTING_TMPDIRS )
|
||||
|
||||
# clean intermediate files and folders
|
||||
CLEAN.include( STATIC_BUILDDIR.to_s )
|
||||
|
||||
|
||||
#####################################################################
|
||||
### T A S K S
|
||||
#####################################################################
|
||||
|
||||
# Make both the default task and the spec task depend on building the extension
|
||||
task :local => :compile
|
||||
task :spec => :compile
|
||||
namespace :spec do
|
||||
task :doc => [ :compile ]
|
||||
task :quiet => [ :compile ]
|
||||
task :html => [ :compile ]
|
||||
task :text => [ :compile ]
|
||||
end
|
||||
|
||||
ENV['RUBY_CC_VERSION'] ||= '1.8.7:1.9.2'
|
||||
|
||||
begin
|
||||
require 'rake/clean'
|
||||
require 'rake/extensiontask'
|
||||
require 'rake/extensioncompiler'
|
||||
|
||||
Rake::ExtensionTask.new do |ext|
|
||||
ext.name = 'pg_ext'
|
||||
ext.gem_spec = GEMSPEC
|
||||
ext.ext_dir = EXTDIR.to_s
|
||||
ext.lib_dir = LIBDIR.to_s
|
||||
ext.source_pattern = "*.{c,h}"
|
||||
|
||||
# If there's an explicit 'compile' argument, use everything after it as options.
|
||||
if offset = ARGV.index( 'compile' )
|
||||
trace "config options = %p" % [ ARGV[(offset + 1)..-1] ]
|
||||
ext.config_options = ARGV[ (offset + 1)..-1 ]
|
||||
# Otherwise, just grab everything from the first option onward
|
||||
elsif offset = ARGV.index( ARGV.find {|arg| arg =~ /^--/ } )
|
||||
trace "config options = %p" % [ ARGV[offset..-1] ]
|
||||
ext.config_options = ARGV[ offset..-1 ]
|
||||
else
|
||||
trace "No config options (ARGV = %p)" % [ ARGV ]
|
||||
end
|
||||
|
||||
ext.cross_compile = true
|
||||
ext.cross_platform = %w[i386-mswin32 i386-mingw32]
|
||||
|
||||
# configure options only for cross compile
|
||||
ext.cross_config_options += [
|
||||
"--with-pg-include=#{STATIC_POSTGRESQL_LIBDIR}",
|
||||
"--with-opt-include=#{STATIC_POSTGRESQL_INCDIR}",
|
||||
"--with-pg-lib=#{STATIC_POSTGRESQL_LIBDIR}",
|
||||
"--with-opt-lib=#{STATIC_OPENSSL_BUILDDIR}",
|
||||
"--enable-static-build",
|
||||
]
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
#####################################################################
|
||||
### C R O S S - C O M P I L A T I O N - T A S K S
|
||||
#####################################################################
|
||||
|
||||
|
||||
directory STATIC_SOURCESDIR.to_s
|
||||
|
||||
#
|
||||
# Static OpenSSL build tasks
|
||||
#
|
||||
directory STATIC_OPENSSL_BUILDDIR.to_s
|
||||
|
||||
# openssl source file should be stored there
|
||||
file OPENSSL_TARBALL => STATIC_SOURCESDIR do |t|
|
||||
download( OPENSSL_SOURCE_URI, t.name )
|
||||
end
|
||||
|
||||
# Extract the openssl builds
|
||||
file STATIC_OPENSSL_BUILDDIR => OPENSSL_TARBALL do |t|
|
||||
trace "extracting %s to %s" % [ OPENSSL_TARBALL, STATIC_OPENSSL_BUILDDIR.parent ]
|
||||
STATIC_OPENSSL_BUILDDIR.mkpath
|
||||
run 'tar', '-xzf', OPENSSL_TARBALL.to_s, '-C', STATIC_OPENSSL_BUILDDIR.parent.to_s
|
||||
OPENSSL_MAKEFILE.unlink if OPENSSL_MAKEFILE.exist?
|
||||
|
||||
OPENSSL_PATCHES.each do |patchfile|
|
||||
trace " applying patch #{patchfile}..."
|
||||
run 'patch', '-Np1', '-d', STATIC_OPENSSL_BUILDDIR.to_s,
|
||||
'-i', File.expand_path( patchfile, BASEDIR )
|
||||
end
|
||||
end
|
||||
|
||||
CMD_PRELUDE = [
|
||||
'env',
|
||||
"CC=#{CROSS_PREFIX}-gcc",
|
||||
"CFLAGS=-DDSO_WIN32",
|
||||
"AR=#{CROSS_PREFIX}-ar",
|
||||
"RANLIB=#{CROSS_PREFIX}-ranlib"
|
||||
]
|
||||
|
||||
|
||||
# generate the makefile in a clean build location
|
||||
file OPENSSL_MAKEFILE => STATIC_OPENSSL_BUILDDIR do |t|
|
||||
Dir.chdir( STATIC_OPENSSL_BUILDDIR ) do
|
||||
cmd = CMD_PRELUDE.dup
|
||||
cmd << "./Configure" << 'mingw'
|
||||
|
||||
run( *cmd )
|
||||
end
|
||||
end
|
||||
|
||||
desc "compile static openssl libraries"
|
||||
task :openssl_libs => [ LIBSSLEAY32, LIBEAY32 ]
|
||||
|
||||
task :compile_static_openssl => OPENSSL_MAKEFILE do |t|
|
||||
Dir.chdir( STATIC_OPENSSL_BUILDDIR ) do
|
||||
cmd = CMD_PRELUDE.dup
|
||||
cmd << 'make' << "-j#{NUM_CPUS}" << 'build_libs'
|
||||
|
||||
run( *cmd )
|
||||
end
|
||||
end
|
||||
|
||||
desc "compile static #{LIBEAY32}"
|
||||
file LIBEAY32 => :compile_static_openssl do |t|
|
||||
FileUtils.cp( STATIC_OPENSSL_BUILDDIR + 'libcrypto.a', LIBEAY32.to_s )
|
||||
end
|
||||
|
||||
desc "compile static #{LIBSSLEAY32}"
|
||||
file LIBSSLEAY32 => :compile_static_openssl do |t|
|
||||
FileUtils.cp( STATIC_OPENSSL_BUILDDIR + 'libssl.a', LIBSSLEAY32.to_s )
|
||||
end
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Static PostgreSQL build tasks
|
||||
#
|
||||
directory STATIC_POSTGRESQL_BUILDDIR.to_s
|
||||
|
||||
|
||||
# postgresql source file should be stored there
|
||||
file POSTGRESQL_TARBALL => STATIC_SOURCESDIR do |t|
|
||||
download( POSTGRESQL_SOURCE_URI, t.name )
|
||||
end
|
||||
|
||||
# Extract the postgresql sources
|
||||
file STATIC_POSTGRESQL_BUILDDIR => POSTGRESQL_TARBALL do |t|
|
||||
trace "extracting %s to %s" % [ POSTGRESQL_TARBALL, STATIC_POSTGRESQL_BUILDDIR.parent ]
|
||||
STATIC_POSTGRESQL_BUILDDIR.mkpath
|
||||
run 'tar', '-xzf', POSTGRESQL_TARBALL.to_s, '-C', STATIC_POSTGRESQL_BUILDDIR.parent.to_s
|
||||
mv POSTGRESQL_SHLIB_MAKEFILE, POSTGRESQL_SHLIB_MF_ORIG
|
||||
end
|
||||
|
||||
# generate the makefile in a clean build location
|
||||
file POSTGRESQL_GLOBAL_MAKEFILE => [ STATIC_POSTGRESQL_BUILDDIR, :openssl_libs ] do |t|
|
||||
options = [
|
||||
'--target=i386-mingw32',
|
||||
"--host=#{Rake::ExtensionCompiler.mingw_host}",
|
||||
'--with-openssl',
|
||||
'--without-zlib',
|
||||
'--disable-shared',
|
||||
]
|
||||
|
||||
Dir.chdir( STATIC_POSTGRESQL_BUILDDIR ) do
|
||||
configure_path = STATIC_POSTGRESQL_BUILDDIR + 'configure'
|
||||
cmd = [ configure_path.to_s, *options ]
|
||||
cmd << "CFLAGS=-L#{STATIC_OPENSSL_BUILDDIR}"
|
||||
cmd << "LDFLAGS=-L#{STATIC_OPENSSL_BUILDDIR}"
|
||||
cmd << "LDFLAGS_SL=-L#{STATIC_OPENSSL_BUILDDIR}"
|
||||
cmd << "LIBS=-lwsock32 -lws2_32 -lgdi32"
|
||||
cmd << "CPPFLAGS=-I#{STATIC_OPENSSL_BUILDDIR}/include"
|
||||
|
||||
run( *cmd )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# patch the Makefile.shlib -- depend on the build dir so it's only
|
||||
# rewritten if the tarball is re-extracted.
|
||||
file POSTGRESQL_SHLIB_MAKEFILE => POSTGRESQL_SHLIB_MF_ORIG do |t|
|
||||
tf = Tempfile.new( POSTGRESQL_SHLIB_MAKEFILE.basename )
|
||||
POSTGRESQL_SHLIB_MF_ORIG.open( File::RDONLY ) do |ifh|
|
||||
ifh.each_line do |line|
|
||||
tf.print( line.sub(/^(\s*haslibarule\s*=\s*yes)/, "# \\1 ") )
|
||||
end
|
||||
end
|
||||
tf.close
|
||||
|
||||
FileUtils.mv( tf.path, t.name, :verbose => $trace )
|
||||
end
|
||||
|
||||
|
||||
# make libpq.a
|
||||
task POSTGRESQL_LIB => [ POSTGRESQL_GLOBAL_MAKEFILE, POSTGRESQL_SHLIB_MAKEFILE ] do |t|
|
||||
Dir.chdir( POSTGRESQL_LIB.dirname ) do
|
||||
sh 'make', "-j#{NUM_CPUS}", POSTGRESQL_LIB.basename.to_s, 'PORTNAME=win32'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#desc 'compile static libpg.a'
|
||||
task :static_libpq => POSTGRESQL_LIB
|
||||
|
||||
desc 'cross compile pg for win32'
|
||||
task :cross do
|
||||
ENV['CROSS_COMPILING'] = 'yes'
|
||||
end
|
||||
task :cross => [ :mingw32, :static_libpq ]
|
||||
|
||||
task :mingw32 do
|
||||
# Use Rake::ExtensionCompiler helpers to find the proper host
|
||||
unless Rake::ExtensionCompiler.mingw_host then
|
||||
warn "You need to install mingw32 cross compile functionality to be able to continue."
|
||||
warn "Please refer to your distribution/package manager documentation about installation."
|
||||
fail
|
||||
end
|
||||
end
|
||||
|
||||
rescue LoadError => err
|
||||
task :no_rake_compiler do
|
||||
log "You'll need to install rake-compiler to compile this."
|
||||
fail
|
||||
end
|
||||
|
||||
task :compile => :no_rake_compiler
|
||||
task :cross => :no_rake_compiler
|
||||
task :mingw32 => :no_rake_compiler
|
||||
task :static_libpq => :no_rake_compiler
|
||||
end
|
||||
|
||||
|
||||
desc "Stop any Postmaster instances that remain after testing."
|
||||
task :cleanup_testing_dbs do
|
||||
require 'spec/lib/helpers'
|
||||
PgTestingHelpers.stop_existing_postmasters()
|
||||
Rake::Task[:clean].invoke
|
||||
end
|
||||
|
||||
|
|
@ -1,278 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<meta name="Keywords" lang="en" content="Ruby PostgreSQL">
|
||||
<link rev="made" href="mailto:noborus@netlab.jp">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
address { text-align: right }
|
||||
div.lastmodifed { text-align: right }
|
||||
div.language { text-align: right }
|
||||
pre {
|
||||
white-space: pre;
|
||||
background-color: antiquewhite;
|
||||
border: inset thin;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
<title>Postgres reference</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class = "language">
|
||||
[English | <a href="postgres.jp.html">Japanese</a>]
|
||||
</div>
|
||||
<h1><a name="reference">Postgres reference</a></h1>
|
||||
<div class = "lastmodifed">
|
||||
Last update: Sun, 4 Mar 2001 15:40:08 +0000
|
||||
</div>
|
||||
<hr>
|
||||
<div>
|
||||
<h2><a name="PGconn">PGconn</a></h2>
|
||||
<p>
|
||||
The class to access PostgreSQL database. All other functionality of libpq
|
||||
save the large object to a file.
|
||||
</p>
|
||||
<p>
|
||||
For example, to send query to the database on the localhost.
|
||||
</p>
|
||||
<pre>
|
||||
require "postgres"
|
||||
conn = PGconn.connect("localhost", 5432, "", "", "test1")
|
||||
# or: conn = PGconn.open('dbname=test1')
|
||||
res = conn.exec("select * from a;")
|
||||
</pre>
|
||||
<h3>super class:</h3>
|
||||
<code>Object</code>
|
||||
<h3>class methods:</h3>
|
||||
<p>
|
||||
<a name="PGconn.connect"><code>connect(<var>pghost</var>,
|
||||
<var>pgport</var>, <var>pgoptions</var>,
|
||||
<var>pgtty</var>, <var>dbname</var>, <var>login</var>,
|
||||
<var>passwd</var>)</code></a>
|
||||
<a name="PGconn.new"><code>new(<var>pghost</var>,
|
||||
<var>pgport</var>, <var>pgoptions</var>,
|
||||
<var>pgtty</var>, <var>dbname</var>, <var>login</var>,
|
||||
<var>passwd</var>)</code></a>
|
||||
<a name="PGconn.open"><code>open(<var>string</var>)</code></a>
|
||||
</p>
|
||||
<dl>
|
||||
<dt>Connect to the PostgreSQL server. Options are:</dt>
|
||||
<dd><var>pghost</var> : Server hostname(string)
|
||||
<dd><var>pgport</var> : Server port number(integer)
|
||||
<dd><var>pgoptions</var> : backend options(string)
|
||||
<dd><var>pgtty</var> : tty to print backend debug message(string)
|
||||
<dd><var>dbname</var> : connecting database name(string)
|
||||
<dd><var>login</var> : login user name(string)
|
||||
<dd><var>passwd</var> : login password(string)
|
||||
<dt>Options in string format (separated by whitespace) are:</dt>
|
||||
<dd><var>host=name</var> : Server hostname(string) (defaults to localhost)
|
||||
<dd><var>hostaddr=addr</var> : Server host IP address(string)
|
||||
<dd><var>port=number</var> : Server port number(integer) (default: 5432)
|
||||
<dd><var>options=string</var> : backend options(string) (sent to server, not well explained)
|
||||
<dd><var>tty=anything</var> : ignored, used to be debug TTY(string)
|
||||
<dd><var>dbname=name</var> : connecting database name(string) (default: your username)
|
||||
<dd><var>user=username</var> : login user name(string) (default: your username)
|
||||
<dd><var>password=censored</var> : login password(string)
|
||||
<dd><var>sslmode=mode</var> : how to treat SSL(string) (one of disable, allow, prefer, require)
|
||||
<dd><var>service=name</var> : service name in pg_service.conf(string)
|
||||
<dd><var>connect_timeout=seconds</var> : how long to wait for a connection(integer) (0 means forever)
|
||||
</dl>
|
||||
<p>On failure, it raises <code>PGError</code> exception.</p>
|
||||
<h3>methods:</h3>
|
||||
<dl>
|
||||
<dt><a name="db"><code>db</code></a>
|
||||
<dd>Returns the connected database name.
|
||||
<dt><a name="host"><code>host</code></a>
|
||||
<dd>Returns the connected server name.
|
||||
<dt><a name="user"><code>user</code></a>
|
||||
<dd>Returns the authenticated user name.
|
||||
<dt><a name="options"><code>options</code></a>
|
||||
<dd>Returns backend option string.
|
||||
<dt><a name="port"><code>port</code></a>
|
||||
<dd>Returns the connected server port number.
|
||||
<dt><a name="tty"><code>tty</code></a>
|
||||
<dd>Returns the connected pgtty.
|
||||
<dt><a name="error"><code>error</code></a>
|
||||
<dd>Returns the error message about connection.
|
||||
<dt> <a name="finish"><code>finish</code></a>
|
||||
<dt> <a name="close"><code>close</code></a>
|
||||
<dd>Closes the backend connection.
|
||||
<dt><a name="reset"><code>reset</code></a>
|
||||
<dd>Resets the backend connection. This method closes the backend
|
||||
connection and tries to re-connect.
|
||||
<dt><a name="trace"><code>trace(<var>port</var>)</code></a>
|
||||
<dd>Enables tracing message passing between backend. The trace
|
||||
message will be written to the port object, which is the
|
||||
instance of the class File.
|
||||
<dt><a name="untrace"><code>untrace</code></a>
|
||||
<dd>Disables the message tracing.
|
||||
<dt><a name="exec"><code>exec(<var>sql</var>)</code></a>
|
||||
<dd>Sends SQL query request specified by <var>sql</var> to the
|
||||
PostgreSQL. Returns the <a href="#PGresult">PGresult</a>
|
||||
instance on success. On failure, it raises <code>PGError</code>
|
||||
exception.
|
||||
<dt><a name="query"><code>query(<var>sql</var>)</code></a>
|
||||
<dd>Sends SQL query request specified by <var>sql</var> to the
|
||||
PostgreSQL.Returns an Array as the resulting tuple on success.
|
||||
On failure, it returns nil, and error detail can be obtained
|
||||
by error.
|
||||
<dt><a name="async_exec"><code>async_exec(<var>sql</var>)</code></a>
|
||||
<dd>Sends SQL asynchronous query request specified by <var>sql</var>
|
||||
to the PostgreSQL. Returns the <a href="#PGresult">PGresult</a>
|
||||
instance on success. On failure, it raises <code>PGError</code>
|
||||
exception.
|
||||
<dt><a name="async_query"><code>async_query(<var>sql</var>)</code></a>
|
||||
<dd>Sends SQL asynchronous query request specified by <var>sql</var>
|
||||
to the PostgreSQL.Returns an Array as the resulting tuple on
|
||||
success. On failure, it returns nil, and error detail can be
|
||||
obtained by error.
|
||||
<dt><a name="get_notify"><code>get_notify</code></a>
|
||||
<dd>Returns the array of the unprocessed notifiers.
|
||||
If there is no unprocessed notifier, it returns nil.
|
||||
<dt><a name="insert_table"><code>insert_table(<var>table</var>,
|
||||
<var>array</var>)</code></a>
|
||||
<dd>Inserts contents of the <var>array</var> into the
|
||||
<var>table</var>.
|
||||
<dt><a name="getline"><code>getline</code></a>
|
||||
<dd>Reads a line from the backend server into internal buffer.
|
||||
Returns nil for EOF, 0 for success, 1 for buffer overflowed.
|
||||
You need to ensure single "." from backend to confirm
|
||||
transmission completion. The sample program <a href="../sample/psql.rb">psql.rb</a>
|
||||
treats this copy protocol right.
|
||||
<dt><a name="putline"><code>putline(<var>string</var>)</code></a>
|
||||
<dd>Sends the <var>string</var> to the backend server.
|
||||
Users must send a single "." to denote the end of data transmission.
|
||||
<dt><a name="endcopy"><code>endcopy</code></a>
|
||||
<dd>Waits until the backend completes the copying. You should call
|
||||
this method after putline, or getline.Returns nil on success,
|
||||
raises an exception otherwise.
|
||||
<dt><a name="set_client_encoding"><code>set_client_encoding</code></a>
|
||||
<dd>Set client encoding(String).
|
||||
<dt><a name="client_encoding"><code>client_encoding</code></a>
|
||||
<dd>Returns client encoding(String).
|
||||
<dt><a name="set_notice_processor"><code>set_notice_processor(proc)</code></a>
|
||||
<dd>Control reporting of notice and warning messages generated by the
|
||||
backend server (with Proc or anything else responding to :call).
|
||||
Pass nil to disable processing of the messages.
|
||||
|
||||
<dt><a name="lo_import"><code>lo_import(<var>file</var>)</code></a>
|
||||
<dd>Import a <var>file</var> to a large object. Return the <a href="#PGlarge">PGlarge</a> instance on success. On failure, it raises <code>PGError</code> exception.
|
||||
<dt><a name="lo_export"><code>lo_export(<var>oid</var>, <var>file</var>)</code></a>
|
||||
<dd>Save a large object of oid to a <var>file</var>.
|
||||
<dt><a name="lo_create"><code>lo_create([<var>mode</var>])</code></a>
|
||||
<dd>Return the <a href="#PGlarge">PGlarge</a> instance on success. On failure, it raises <code>PGError</code> exception.
|
||||
<dt><a name="lo_open"><code>lo_open(<var>oid</var>, [<var>mode</var>])</code></a>
|
||||
<dd>Open a large object of oid. Return the <a href="#PGlarge">PGlarge</a> instance on success. The mode argument specifies the mode for the opened large object, which is either <var>"INV_READ"</var>, or <var>"INV_WRITE"</var>. If mode On failure, it raises <code>PGError</code> exception. If mode omitted, the default is <var>"INV_READ"</var>
|
||||
<dt><a name="lo_unlink"><code>lo_unlink(<var>oid</var>)</code></a>
|
||||
<dd>Unlink (deletes) the postgres large object of oid.
|
||||
</dl>
|
||||
</div>
|
||||
<hr>
|
||||
<div>
|
||||
<h2><a name="PGresult">PGresult</a></h2>
|
||||
<P>
|
||||
The class to represent the query result tuples. The object of this
|
||||
class is created as the result of every query. You may need to invoke
|
||||
clear method for the finished object for better memory performance.
|
||||
</P>
|
||||
<h3>super class:</h3>
|
||||
<p>
|
||||
<code>Object</code>
|
||||
</p>
|
||||
<h2>methods:</h2>
|
||||
<dl>
|
||||
<dt><a name="status"><code>status</code></a>
|
||||
<dd><dl>
|
||||
<dt>Returns the status of the query. The status value is
|
||||
either:
|
||||
<dd>EMPTY_QUERY
|
||||
<dd>COMMAND_OK
|
||||
<dd>TUPLES_OK
|
||||
<dd>COPY_OUT
|
||||
<dd>COPY_IN
|
||||
</dl>
|
||||
<dt><a name="result"><code>result</code></a>
|
||||
<dd>Returns the query result tuple in the array.
|
||||
<dt><a name="fields"><code>fields</code></a>
|
||||
<dd>Returns the array of the fields of the query result.
|
||||
<dt><a name="num_tuples"><code>num_tuples</code></a>
|
||||
<dd>Returns the number of tuples of the query result.
|
||||
<dt><a name="num_fields"><code>num_fields</code></a>
|
||||
<dd>Returns the number of fields of the query result.
|
||||
<dt><a name="fieldname"><code>fieldname(<var>index</var>)</code></a>
|
||||
<dd>Returns the field name corresponding field index.
|
||||
<dt><a name="fieldnum"><code>fieldnum(<var>name</var>)</code></a>
|
||||
<dd>Returns the index of the <var>name</var>ed field.
|
||||
<dt><a name="type"><code>type(<var>index</var>)</code></a>
|
||||
<dd>Returns the integer corresponding the type of the field.
|
||||
The field indicator starts from zero.
|
||||
<dt><a name="size"><code>size(<var>index</var>)</code></a>
|
||||
<dd>Returns the size of the field in bytes.
|
||||
Returns <code>-1</code> if the field is variable sized.
|
||||
<dt><a name="getvalue"><code>getvalue(<var>tup_num, field_num</var>)
|
||||
</code></a>
|
||||
<dd>Returns the field value.
|
||||
<dt><a name="getlength"><code>getlength(<var>tup_num, field_num</var>)
|
||||
</code></a>
|
||||
<dd>Returns the length of the field in bytes.
|
||||
<dt><a name="cmdstatus"><code>cmdtuples</code></a>
|
||||
<dd>the number of tuples (rows) affected by the SQL command.
|
||||
<dt><a name="cmdstatus"><code>cmdstatus</code></a>
|
||||
<dd>Returns the status string of the last query command.
|
||||
<dt><a name="oid"><code>oid</code></a>
|
||||
<dd>Returns the oid of the inserted row, or <code>nil</code> if
|
||||
the last statement was not an <code>INSERT</code>
|
||||
<dt><a name="clear"><code>clear</code></a>
|
||||
<dd>Clears the <a href="#PGresult">PGresult</a> object as the result
|
||||
of the query.
|
||||
</dl>
|
||||
</div>
|
||||
<hr>
|
||||
<div>
|
||||
<h2><a name="PGlarge">PGlarge</a></h2>
|
||||
<P>
|
||||
The class to access large objects. The object of this class is created as the
|
||||
result of <a href="#lo_import">lo_import</a>, <a href="#lo_create">lo_create</a>, and <a href="#lo_open">lo_open</a>.
|
||||
</P>
|
||||
<h3>super class:</h3>
|
||||
<p>
|
||||
<code>Object</code>
|
||||
</p>
|
||||
<h2>methods:</h2>
|
||||
<dl>
|
||||
<dt><a name="open"><code>open([<var>mode</var>])</code></a>
|
||||
<dd>Open a large object. The mode argument specifies the mode for the opened large object, which is either <var>"INV_READ"</var>,<var>"INV_READ"</var>.
|
||||
<dt><a name="close"><code>close</code></a>
|
||||
<dd>Close a large object. Closed when they are garbage-collected.
|
||||
<dt><a name="read"><code>read([<var>length</var>])</code></a>
|
||||
<dd>Attempts to read <var>length</var> bytes from large object. If no <var>length</var> given, reads all data.
|
||||
<dt><a name="write"><code>write(<var>str</var>)</code></a>
|
||||
<dd>Write the string to the large object. Return the number of bytes written.
|
||||
<dt><a name="seek"><code>seek(<var>offset</var>, <var>whence</var>)</code></a>
|
||||
<dd>Move the large object pointer to the <var>offset</var>. The value for <var>whence</var> are SEEK_SET, SEEK_CUR, and SEEK_END.Or it is 0,1,2.
|
||||
<dt><a name="tell"><code>tell</code></a>
|
||||
<dd>Return the current position of the large object pointer.
|
||||
<dt><a name="unlink"><code>unlink</code></a>
|
||||
<dd>Delete large object.
|
||||
<dt><a name="oid"><code>oid</code></a>
|
||||
<dd>Return the large object oid.
|
||||
<dt><a name="size"><code>size</code></a>
|
||||
<dd>Return the size of large object.
|
||||
<dt><a name="export"><code>export(<var>file</var>)</code></a>
|
||||
<dd>Save a large object of oid to a <var>file</var>.
|
||||
</dl>
|
||||
</div>
|
||||
<hr>
|
||||
<address>
|
||||
mailto:
|
||||
<a href="mailto:noborus@netlab.jp">Noboru Saitou</a>
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
|
@ -1,256 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="ja">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<meta name="Keywords" lang="en" content="Ruby PostgreSQL">
|
||||
<link rev="made" href="mailto:noborus@netlab.jp">
|
||||
<link rel="contents" href="./index.html">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
address { text-align: right }
|
||||
div.lastmodifed { text-align: right }
|
||||
div.language { text-align: right }
|
||||
pre {
|
||||
white-space: pre;
|
||||
background-color: antiquewhite;
|
||||
border: inset thin;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
<title>Postgres reference</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class = "language">
|
||||
[<a href="postgres.html">English</a> | Japanese]
|
||||
</div>
|
||||
<h1><a name="reference">Postgres reference</a></h1>
|
||||
<div class = "lastmodifed">
|
||||
Last update: Mon, 5 Mar 2001 00:34:55 +0900
|
||||
</div>
|
||||
<hr>
|
||||
<div>
|
||||
<h2><a name="PGconn">PGconn</a></h2>
|
||||
<p>
|
||||
PostgreSQL$B$K%"%/%;%9$9$k$?$a$N%/%i%9!#$=$NB>$N%a%=%C%I$O(Blibpq$B$H$[$\F1$8%$%s%?%U%'!<%9$GDs6!$5$l$^$9!#(B
|
||||
</p>
|
||||
<p>
|
||||
$BNc$($P!"(Blocalhost $B>e$N(B PostgreSQL $B$K@\B3$7!"(Bquery $B$r=P$9$?$a$K$O0J2<$N$h$&$K$7$F9T$$$^$9!#(B
|
||||
</p>
|
||||
<pre>
|
||||
require "postgres"
|
||||
conn = PGconn.connect("localhost", 5432, "", "", "test1")
|
||||
res = conn.exec("select * from a;")
|
||||
</pre>
|
||||
<h3>$B%9!<%P!<%/%i%9(B:</h3>
|
||||
<code>Object</code>
|
||||
<h3>$B%/%i%9%a%=%C%I(B:</h3>
|
||||
<p>
|
||||
<a name="PGconn.connect"><code>connect(<var>pghost</var>,
|
||||
<var>pgport</var>, <var>pgoptions</var>,
|
||||
<var>pgtty</var>, <var>dbname</var>, <var>login</var>,
|
||||
<var>passwd</var>)</code></a>
|
||||
<a name="PGconn.new"><code>new(<var>pghost</var>,
|
||||
<var>pgport</var>, <var>pgoptions</var>,
|
||||
<var>pgtty</var>, <var>dbname</var>, <var>login</var>,
|
||||
<var>passwd</var>)</code></a>
|
||||
<a name="PGconn.open"><code>open(<var>string</var>)</code></a>
|
||||
</p>
|
||||
<dl>
|
||||
<dt>PostgreSQL$B%5!<%P$H@\B3$7$^$9!#%*%W%7%g%s$N0UL#$O0J2<$NDL$j$G$9!#(B</dt>
|
||||
<dd><var>pghost</var> : $B%5!<%P$N%[%9%HL>(B($BJ8;zNs(B)
|
||||
<dd><var>pgport</var> : $B%5!<%P$,(Blisten$B$7$F$$$k%]!<%HHV9f(B($B@0?t(B)
|
||||
<dd><var>pgoptions</var> : backend$B$r5/F0$9$k:]$N%*%W%7%g%s(B($BJ8;zNs(B)
|
||||
<dd><var>pgtty</var> : backend$B$,%G%P%C%0%a%C%;!<%8$rI=<($9$k(Btty($BJ8;zNs(B)
|
||||
<dd><var>dbname</var> : $B@\B3$9$k%G!<%?%Y!<%9L>(B($BJ8;zNs(B)
|
||||
<dd><var>login</var> : $B%f!<%6L>(B($BJ8;zNs(B)
|
||||
<dd><var>passwd</var> : $B%Q%9%o!<%I(B($BJ8;zNs(B)
|
||||
<dt>$B%*%W%7%g%s$rJ8;zNs$GEO$9>l9g$N%U%)!<%^%C%H$G$9!#(B</dt>
|
||||
<dd><var>host=name</var> : $B%5!<%P$N%[%9%HL>(B($BJ8;zNs(B)
|
||||
<dd><var>hostaddr=addr</var> : $B%5!<%P$N(BIP$B%"%I%l%9(B($BJ8;zNs(B)
|
||||
<dd><var>port=number</var> $B%5!<%P$,(Blisten$B$7$F$$$k%]!<%HHV9f(B($B@0?t(B)
|
||||
<dd><var>options=string</var> : backend$B$r5/F0$9$k:]$N%*%W%7%g%s(B($BJ8;zNs(B)
|
||||
<dd><var>tty=anything</var> : backend$B$,%G%P%C%0%a%C%;!<%8$rI=<($9$k(Btty($BJ8;zNs(B)
|
||||
<dd><var>dbname=name</var> : $B@\B3$9$k%G!<%?%Y!<%9L>(B($BJ8;zNs(B)
|
||||
<dd><var>user=username</var> : $B%f!<%6L>(B($BJ8;zNs(B)
|
||||
<dd><var>password=censored</var> : $B%Q%9%o!<%I(B($BJ8;zNs(B)
|
||||
<dd><var>sslmode=mode</var> : SSL$B%b!<%I$N;XDj(B($BJ8;zNs(B) (disable, allow, prefer, require)
|
||||
<dd><var>service=name</var> : $BB>$N%Q%i%a!<%?MQ$K;HMQ$5$l$k%5!<%S%9L>(B($BJ8;zNs(B)
|
||||
<dd><var>connect_timeout=seconds</var> : $B@\B3%?%$%`%"%&%H;~4V(B($B@0?t(B)
|
||||
</dl>
|
||||
<p>$B<:GT$7$?>l9g$O(B <code>PGError</code> $BNc30$,H/@8$7$^$9!#(B</p>
|
||||
<h3>methods:</h3>
|
||||
<dl>
|
||||
<dt><a name="db"><code>db</code></a>
|
||||
<dd>$B@\B3$7$?%G!<%?%Y!<%9L>$rJV$7$^$9!#(B
|
||||
<dt><a name="host"><code>host</code></a>
|
||||
<dd>$B@\B3$7$?%5!<%PL>$rJV$7$^$9!#(B
|
||||
<dt><a name="user"><code>user</code></a>
|
||||
<dd>$B%5!<%P$X@\B3;~$KG'>Z$7$?%f!<%6L>$rJV$7$^$9!#(B
|
||||
<dt><a name="options"><code>options</code></a>
|
||||
<dd>backend$B$r5/F0$9$k:]$K;XDj$7$?(Boption$B$rJV$7$^$9!#(B
|
||||
<dt><a name="port"><code>port</code></a>
|
||||
<dd>$B%5!<%P$X@\B3$9$k:]$K;HMQ$7$?%]!<%HHV9f$rJV$7$^$9!#(B
|
||||
<dt><a name="tty"><code>tty</code></a>
|
||||
<dd>$B@\B3$7$F$$$k(Bpgtty$B$rJV$7$^$9!#(B
|
||||
<dt><a name="error"><code>error</code></a>
|
||||
<dd>$B@\B3$K4X$9$k%(%i!<%a%C%;!<%8$rJV$7$^$9!#(B
|
||||
<dt> <a name="finish"><code>finish</code></a>
|
||||
<dt> <a name="close"><code>close</code></a>
|
||||
<dd>$B%P%C%/%(%s%I$H$N@\B3$r=*N;$7$^$9!#(B
|
||||
<dt><a name="reset"><code>reset</code></a>
|
||||
<dd>$B%P%C%/%(%s%I$H$NDL?.%]!<%H$r%j%;%C%H$7$^$9!#$3$N4X?t$O%P%C%/%(%s%I$H$N%=%1%C%H@\B3$r=*N;$7!"$$$:$l$+$N%P%C%/%(%s%I$H$N?7$7$$@\B3$N:F3NN)$r;n$_$^$9!#(B
|
||||
<dt><a name="trace"><code>trace(<var>port</var>)</code></a>
|
||||
<dd>$B%P%C%/%(%s%I$H$N%a%C%;!<%8$N<uEO$7$N%H%l!<%9$rM-8z$K$7$^$9!#%a%C%;!<%8$O(B<var>port</var>$B$G;XDj$5$l$?(B File $B%/%i%9$N%$%s%9%?%s%9$X=q$-=P$5$l$^$9!#(B
|
||||
<dt><a name="untrace"><code>untrace</code></a>
|
||||
<dd>$B%P%C%/%(%s%I$H$N%a%C%;!<%8$N<uEO$7$N%H%l!<%9$rL58z$K$7$^$9!#(B
|
||||
<dt><a name="exec"><code>exec(<var>sql</var>)</code></a>
|
||||
<dd><var>sql</var>$B$G;XDj$5$l$?(BSQL$BLd$$9g$o$;J8$r(BPostgreSQL$B$XAw$j$^$9!#(B
|
||||
$BLd$$9g$o$;$,@.8y$7$?>l9g$K$O!"7k2L$,(B<a href="#PGresult">PGresult</a>$B%/%i%9$N(B
|
||||
$B%$%s%9%?%s%9$H$7$FJV$5$l!"$=$&$G$J$$>l9g$ONc30$,H/@8$7$^$9!#(B
|
||||
<dt><a name="query"><code>query(<var>sql</var>)</code></a>
|
||||
<dd><var>sql</var>$B$G;XDj$5$l$?(BSQL$BLd$$9g$o$;J8$r(BPostgreSQL$B$XAw$j$^$9!#(B
|
||||
$BLd$$9g$o$;$,@.8y$7$?>l9g$K$O!"7k2L$,(B Array $B%/%i%9$N(B
|
||||
$B%$%s%9%?%s%9$H$7$FJV$5$l!"$=$&$G$J$$>l9g$O(B nil $B$,JV$5$l$^$9!#(B
|
||||
<dt><a name="async_exec"><code>async_exec(<var>sql</var>)</code></a>
|
||||
<dd><var>sql</var>$B$G;XDj$5$l$?(BSQL$BLd$$9g$o$;J8$r(BPostgreSQL$B$X(B
|
||||
$BHsF14|$G(B $BAw$j$^$9!#Ld$$9g$o$;$,@.8y$7$?>l9g$K$O!"(B
|
||||
$B7k2L$,(B<a href="#PGresult">PGresult</a>$B%/%i%9$N(B
|
||||
$B%$%s%9%?%s%9$H$7$FJV$5$l!"$=$&$G$J$$>l9g$ONc30$,H/@8$7$^$9!#(B
|
||||
<dt><a name="async_query"><code>async_query(<var>sql</var>)</code></a>
|
||||
<dd><var>sql</var>$B$G;XDj$5$l$?(BSQL$BLd$$9g$o$;J8$r(BPostgreSQL$B$X(B
|
||||
$BHsF14|$G(B $BAw$j$^$9!#Ld$$9g$o$;$,@.8y$7$?>l9g$K$O!"7k2L$,(B Array $B%/%i%9$N(B
|
||||
$B%$%s%9%?%s%9$H$7$FJV$5$l!"$=$&$G$J$$>l9g$O(B nil $B$,JV$5$l$^$9!#(B
|
||||
<dt><a name="get_notify"><code>get_notify</code></a>
|
||||
<dd>$B%P%C%/%(%s%I$+$iL$=hM}$NDLCN%j%9%H$rF@$F!"(BArray $B%/%i%9$N%$%s%9%?%s%9$H$7$FJV$7$^$9!#%P%C%/%(%s%I$+$i$NL$=hM}$NDLCN$,$J$$>l9g$K$O!"(Bnil $B$,JV$5$l$^$9!#(B
|
||||
<dt><a name="insert_table"><code>insert_table(<var>table</var>,
|
||||
<var>array</var>)</code></a>
|
||||
<dd><var>table</var>$B$G;XDj$5$l$?%F!<%V%k$KBP$7!"(B<var>array</var>$B$NFbMF$rA^F~$7$^$9!#(B<var>array</var>$B$O(B Array $B%/%i%9$N%$%s%9%?%s%9$G$J$1$l$P$J$j$^$;$s!#(B
|
||||
<dt><a name="getline"><code>getline</code></a>
|
||||
<dd>$B%P%C%/%(%s%I%5!<%P$+$i2~9T%3!<%I$G=*$k9T$rFI$_<h$j$^$9!#(B<code>fgets(3)</code>$B$HF1MM$K!"$3$N%a%=%C%I$O(B<code>get(3)</code>$B$HF1MM$K=*C<9T$r%L%k$KJQ49$7$^$9!#(Bgetline$B$O(BEOF$B$N>l9g$O!"(Bnil $B$r!"9TA4BN$rFI$_<h$C$?>l9g$O(B0$B$r!"$^$@2~9T%3!<%I$rFI$_<h$C$F$$$J$$>l9g$O(B1$B$rJV$7$^$9!#$3$N%a%=%C%I$r;HMQ$9$k;~$NCm0UE@$O!"%P%C%/%(%s%I%5!<%P$,7k2L$NAw?.$r40N;$7$?$3$H$r<($9C10lJ8;z(B"."$B$r?75,9T$KAw?.$7$?$3$H$r3NG'$7$J$1$l$P$J$i$J$$$3$H$G$9!#(B<br>
|
||||
$B%5%s%W%k%3!<%I(B<a href="../sample/psql.rb">psql.rb</a>$B$O!"(Bcopy$B%W%m%H%3%k$r@5$7$/07$&%=!<%9$r4^$s$G$$$^$9!#(B
|
||||
<dt><a name="putline"><code>putline(<var>string</var>)</code></a>
|
||||
<dd><var>string</var>$B$G;XDj$5$l$?J8;zNs$r%P%C%/%(%s%I!<%5!<%P$XAw?.$7$^$9!#;HMQ<T$O%G!<%?$NAw?.$,40N;$7$?$3$H$r%P%C%/%(%s%I$K<($9$?$a$K!"C10lJ8;z(B"."$B$rL@<(E*$KAw?.$7$J$1$l$P$J$j$^$;$s!#(B
|
||||
<dt><a name="endcopy"><code>endcopy</code></a>
|
||||
<dd>$B%P%C%/%(%s%I$HF14|$r$H$j$^$9!#$3$N%a%=%C%I$O%P%C%/%(%s%I$,(Bcopy$B$r40N;$9$k$^$GBT$A$^$9!#(B<a href="#putline">putline</a>$B$d(B<a href="#getline">getline</a>$B$r;HMQ$7$?>l9g$K;HMQ$9$Y$-%a%=%C%I$G$9!#(Bcopy$B$,$&$^$/40N;$7$?>l9g$K$O(B nil $B$,JV$j!"$=$&$G$J$$>l9g$ONc30$,H/@8$7$^$9!#(B
|
||||
<dt><a name="set_client_encoding"><code>set_client_encoding</code></a>
|
||||
<dd>$B%/%i%$%"%s%H$NJ8;z%3!<%I$r;XDj$7$^$9(B($BJ8;zNs(B)$B!#(B
|
||||
<dt><a name="client_encoding"><code>client_encoding</code></a>
|
||||
<dd>$B%/%i%$%"%s%H$NJ8;z%3!<%I$rJV$7$^$9(B($BJ8;zNs(B)$B!#(B
|
||||
|
||||
<dt><a name="lo_import"><code>lo_import(<var>file</var>)</code></a>
|
||||
<dd><var>file</var>$B$r%i!<%8%*%V%8%'%/%H$K%$%s%]!<%H$7$^$9!#@.8y$9$k$H(B<a href="#PGlarge">PGlarge</a>$B%/%i%9$N%$%s%9%?%s%9$,JV$5$l$^$9!#<:GT$9$k$H(B <code>PGError</code> $BNc30$,H/@8$7$^$9!#(B
|
||||
<dt><a name="lo_export"><code>lo_export(<var>oid</var>, <var>file</var>)</code></a>
|
||||
<dd>$B%i!<%8%*%V%8%'%/%H$r(B <var>file</var> $B$KJ]B8$7$^$9!#(B
|
||||
<dt><a name="lo_create"><code>lo_create([<var>mode</var>])</code></a>
|
||||
<dd>$B?7$7$/%i!<%8%*%V%8%'%/%H$r$D$/$j$^$9!#@.8y$9$k$H(B<a href="#PGlarge">PGlarge</a> $B%/%i%9$N%$%s%9%?%s%9$,JV$5$l$^$9!#<:GT$9$k$H(B <code>PGError</code> $BNc30$,H/@8$7$^$9!#(B
|
||||
<dt><a name="lo_open"><code>lo_open(<var>oid</var>, [<var>mode</var>])</code></a>
|
||||
<dd>oid $B$N%i!<%8%*%V%8%'%/%H$r3+$-$^$9!#@.8y$9$k$H(B<a href="#PGlarge">PGlarge</a> $B%/%i%9$N%$%s%9%?%s%9$,JV$5$l$^$9!#<:GT$9$k$H(B <code>PGError</code> $BNc30$,H/@8$7$^$9!#(B<var>"INV_READ"</var>,<var>"INV_WRITE"</var>$B$N$I$A$i$+$N%b!<%I$r;XDj$7$^$9!#<:GT$9$k$H(B <code>PGError</code> $BNc30$,H/@8$7$^$9!#%b!<%I$r>JN,$7$?>l9g$O(B<var>"INV_READ"</var>$B$G$9!#(B
|
||||
<dt><a name="lo_unlink"><code>lo_unlink(<var>oid</var>)</code></a>
|
||||
<dd><var>oid</var>$B$N%i!<%8%*%V%8%'%/%H$r:o=|$7$^$9!#(B
|
||||
</dl>
|
||||
</div>
|
||||
<hr>
|
||||
<div>
|
||||
<h2><a name="PGresult">PGresult</a></h2>
|
||||
<P>
|
||||
Query$B$N7k2L$H$7$FF@$i$l$?%?%C%W%k$r(Bwrap$B$9$k%/%i%9!%$3$N%/%i%9(B
|
||||
$B$N%$%s%9%?%s%9$O!"(Bquery$B$r9T$&$?$S$K@8@.$5$l$^$9!#8N$KF@$i$l$?(B
|
||||
$B7k2L$,ITMW$K$J$C$?>l9g$K$O!"(Bclear$B$r8F$S=P$7$F%a%b%j$r2rJ|$9$k(B
|
||||
$B$h$&$K$7$F2<$5$$!#(B
|
||||
</P>
|
||||
<h3>$B%9!<%Q!<%/%i%9(B:</h3>
|
||||
<p>
|
||||
<code>Object</code>
|
||||
</p>
|
||||
<h2>$B%a%=%C%I(B:</h2>
|
||||
<dl>
|
||||
<dt><a name="status"><code>status</code></a>
|
||||
<dd><dl>
|
||||
<dt>$BLd$$9g$o$;7k2L$N%9%F!<%?%9$rJV$7$^$9!#%9%F!<%?%9$O0J2<$NCM$N$&$A$N$$$:$l$+0l$D$rJV$7$^$9!#(B
|
||||
<dd>EMPTY_QUERY
|
||||
<dd>COMMAND_OK
|
||||
<dd>TUPLES_OK
|
||||
<dd>COPY_OUT
|
||||
<dd>COPY_IN
|
||||
</dl>
|
||||
<dt><a name="result"><code>result</code></a>
|
||||
<dd>$BLd$$9g$o$;7k2L$N%?%C%W%k(B($B%$%s%9%?%s%9(B)$B$r!"G[Ns$GJV$7$^$9!#(B
|
||||
<dt><a name="fields"><code>fields</code></a>
|
||||
<dd>$BLd$$9g$o$;$N7k2L$N%U%#!<%k%I(B($BB0@-(B)$B$r!"G[Ns$GJV$7$^$9!#(B
|
||||
<dt><a name="num_tuples"><code>num_tuples</code></a>
|
||||
<dd>$BLd$$9g$o$;7k2L$N%?%C%W%k(B($B%$%s%9%?%s%9(B)$B$N?t$rJV$7$^$9!#(B
|
||||
<dt><a name="num_fields"><code>num_fields</code></a>
|
||||
<dd>$BLd$$9g$o$;$N7k2L$N%U%#!<%k%I(B($BB0@-(B)$B$N?t$rJV$7$^$9!#(B
|
||||
<dt><a name="fieldname"><code>fieldname(<var>index</var>)</code></a>
|
||||
<dd>$BM?$($i$l$?%U%#!<%k%I(B($BB0@-(B)$B$N:w0z(B(field index)$B$KBP1~$9$k%U%#!<%k%I(B($BB0@-(B)$B$NL>A0$rJV$7$^$9!#%U%#!<%k%I!&%$%s%G%#%1!<%?$O(B0$B$+$i3+;O$5$l$^$9!#(B
|
||||
<dt><a name="fieldnum"><code>fieldnum(<var>name</var>)</code></a>
|
||||
<dd>$BM?$($i$l$?%U%#!<%k%I(B($BB0@-(B)$B$NL>A0$KBP1~$9$k!"%U%#!<%k%I(B($BB0@-(B)$B$N:w0z$rJV$7$^$9!#(B
|
||||
<dt><a name="type"><code>type(<var>index</var>)</code></a>
|
||||
<dd>$BM?$($i$l$?%U%#!<%k%I(B($BB0@-(B)$B$KBP1~$9$k%U%#!<%k%I$N7?$rJV$7$^$9!#FbIt%3!<%G%#%s%0$5$l$F$$$k7?$,@0?t$GJV$5$l$^$9!#%U%#!<%k%I!&%$%s%G%#%1!<%?$O(B0$B$+$i3+;O$5$l$^$9!#(B
|
||||
<dt><a name="size"><code>size(<var>index</var>)</code></a>
|
||||
<dd>$BM?$($i$l$?%U%#!<%k%I(B($BB0@-(B)$B$KBP1~$9$k%U%#!<%k%I$N%5%$%:$r%P%$%H?t$GJV$7$^$9!#JV$5$l$k%5%$%:$,(B-1$B$N>l9g!"%U%#!<%k%I$O2DJQD9$G$9!#%U%#!<%k%I!&%$%s%G%#%1!<%?$O(B0$B$+$i3+;O$5$l$^$9!#(B
|
||||
<dt><a name="getvalue"><code>getvalue(<var>tup_num, field_num</var>)
|
||||
</code></a>
|
||||
<dd>$B%U%#!<%k%I(B($BB0@-(B)$B$NCM$rJV$7$^$9!#$[$H$s$I$NLd$$9g$o$;$KBP$7$F!"(B<a href="#getvalue">getvalue</a>$B$K$h$C$FJV$5$l$kCM$O!"%L%k$G=*$o$k(BASCII$BJ8;zNs$GI=8=$5$l$^$9!#Ld$$9g$o$;$N7k2L$,%P%$%J%j%+!<%=%k$G$"$C$?>l9g!"(B<a href="#getvalue">getvalue</a>$B$K$h$C$FJV$5$l$kCM$O!"%P%C%/%(%s%I!&%5!<%P$NFbIt%U%)!<%^%C%H$K0MB8$7$?%P%$%J%j$GI=8=$5$l$^$9!#%G!<%?$r@5$7$$%?%$%W$K%-%c%9%H$7$?$j!"JQ49$7$?$j$9$k$N$O%W%m%0%i%^$N@UG$$G$9!#(B<a href="#PGresult">PGresult</a>$B$N%$%s%9%?%s%9$O(Bquery$B$N$?$S$K@8@.$5$l$^$9!#ITMW$K$J$C$?>l9g$O!"%W%m%0%i%^$,@UG$$r$b$C$F(B<a href="#clear">clear</a>$B$r8F$S=P$7%a%b%j$r2rJ|$7$F2<$5$$!#(B
|
||||
<dt><a name="getlength"><code>getlength(<var>tup_num, field_num</var>)
|
||||
</code></a>
|
||||
<dd>$B%U%#!<%k%I(B($BB0@-(B)$B$ND9$5$r%P%$%H$GJV$7$^$9!#(B
|
||||
<dt><a name="cmdtuples"><code>cmdtuples</code></a>
|
||||
<dd>$B:G8e$NLd$$9g$o$;%3%^%s%I$N1F6A$r$&$1$?9T?t$rJV$7$^$9!#(B
|
||||
<dt><a name="cmdstatus"><code>cmdstatus</code></a>
|
||||
<dd>$B:G8e$NLd$$9g$o$;%3%^%s%I$N%3%^%s%I%9%F!<%?%9$rJ8;zNs$GJV$7$^$9!#(B
|
||||
<dt><a name="oid"><code>oid</code></a>
|
||||
<dd>$BA^F~$5$l$?9T$N(BOID$B$rJV$7$^$9!#(B
|
||||
<dt><a name="clear"><code>clear</code></a>
|
||||
<dd>$BLd$$9g$o$;$N7k2L@8@.$5$l$?(B<a href="#PGresult">PGresult</a>$B$N%$%s%9%?%s%9$r%/%j%"$7$^$9!#(B
|
||||
</dl>
|
||||
</div>
|
||||
<hr>
|
||||
<div>
|
||||
<h2><a name="PGlarge">PGlarge</a></h2>
|
||||
<p>
|
||||
$B%i!<%8%*%V%8%'%/%H$K%"%/%;%9$9$k$?$a$N%/%i%9!#$3$N%*%V%8%'%/%H$O(B <a href="lo_import">lo_import</a>, <a href="lo_create">lo_create</a>, <a href="lo_open">lo_open</a> $B$N7k2L$H$7$FJV$5$l$^$9!#(B
|
||||
</p>
|
||||
<h3>super class:</h3>
|
||||
<p>
|
||||
<code>Object</code>
|
||||
</p>
|
||||
<h2>methods:</h2>
|
||||
<dl>
|
||||
<dt><a name="open"><code>open([<var>mode</var>])</code></a>
|
||||
<dd>$B%i!<%8%*%V%8%'%/%H$r3+$-$^$9!#(B <var>"INV_READ"</var>,<var>"INV_WRITE"</var>$B$N$I$A$i$+$N%b!<%I$r;XDj$7$^$9!#<:GT$9$k$H(B <code>PGError</code> $BNc30$,H/@8$7$^$9!#%b!<%I$r>JN,$7$?>l9g$O(B<var>"INV_READ"</var>$B$G$9!#(B
|
||||
<dt><a name="close"><code>close</code></a>
|
||||
<dd>$B%i!<%8%*%V%8%'%/%H$rJD$8$^$9!#0J9_$3$N%*%V%8%'%/%H$KBP$9$k%"%/%;%9$ONc30$rH/@8$7$^$9!#(B
|
||||
<dt><a name="read"><code>read([<var>length</var>])</code></a>
|
||||
<dd><var>length</var> $B%P%$%HFI$_9~$s$G$=$NJ8;zNs$rJV$7$^$9!#(B<var>length</var> $B$,>JN,$5$l$?;~$K$O!"A4$F$N%G!<%?$rFI$_9~$_$^$9!#(B
|
||||
<dt><a name="write"><code>write(<var>str</var>)</code></a>
|
||||
<dd><var>str</var>$B$r%i!<%8%*%V%8%'%/%H$K=q$-9~$_$^$9!#=q$-9~$s$@%P%$%H?t$rJV$7$^$9!#(B
|
||||
<dt><a name="seek"><code>seek(<var>offset</var>, <var>whence</var>)</code></a>
|
||||
<dd>$B%i!<%8%*%V%8%'%/%H$N%]%$%s%?$r(B <var>offset</var> $B0\F0$7$^$9!#(B<var>whence</var> $B$O(B SEEK_SET, SEEK_CUR, and SEEK_END $B$,;XDj$G$-$^$9!#$=$l$>$l(B 0,1,2$B$H?t;z$G;XDj$7$F$b9=$$$^$;$s!#(B
|
||||
<dt><a name="tell"><code>tell</code></a>
|
||||
<dd>$B%i!<%8%*%V%8%'%/%H$N%]%$%s%?$N8=:_$N0LCV$rJV$7$^$9!#(B
|
||||
<dt><a name="unlink"><code>unlink</code></a>
|
||||
<dd>$B%i!<%8%*%V%8%'%/%H$r:o=|$7$^$9!#(B
|
||||
<dt><a name="oid"><code>oid</code></a>
|
||||
<dd>$B%i!<%8%*%V%8%'%/%H$N(B oid $B$rJV$7$^$9!#(B
|
||||
<dt><a name="size"><code>size</code></a>
|
||||
<dd>$B%i!<%8%*%V%8%'%/%H$N%5%$%:$rJV$7$^$9!#(B
|
||||
<dt><a name="export"><code>export(<var>file</var>)</code></a>
|
||||
<dd><var>file</var>$B$K%i!<%8%*%V%8%'%/%H$r=q$-=P$7$^$9!#(B
|
||||
</dl>
|
||||
</div>
|
||||
<hr>
|
||||
<address>
|
||||
mailto:
|
||||
<a href="mailto:noborus@netlab.jp">Noboru Saitou</a>
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -2,6 +2,11 @@ require 'pp'
|
|||
require 'mkmf'
|
||||
|
||||
|
||||
if ENV['MAINTAINER_MODE']
|
||||
$stderr.puts "Maintainer mode enabled."
|
||||
$CFLAGS << ' -Wall' << ' -ggdb' << ' -DDEBUG'
|
||||
end
|
||||
|
||||
if pgdir = with_config( 'pg' )
|
||||
ENV['PATH'] = "#{pgdir}/bin" + File::PATH_SEPARATOR + ENV['PATH']
|
||||
end
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
# We can't use Ruby's standard build procedures
|
||||
# on Windows because the Ruby executable is
|
||||
# built with VC++ while here we want to build
|
||||
# with MingW. So just roll our own...
|
||||
|
||||
require 'fileutils'
|
||||
require 'rbconfig'
|
||||
|
||||
EXTENSION_NAME = "pg.#{Config::CONFIG["DLEXT"]}"
|
||||
|
||||
# This is called when the Windows GEM is installed!
|
||||
task :install do
|
||||
# Gems will pass these two environment variables:
|
||||
# RUBYARCHDIR=#{dest_path}
|
||||
# RUBYLIBDIR=#{dest_path}
|
||||
|
||||
dest_path = ENV['RUBYLIBDIR']
|
||||
mkdir_p(dest_path)
|
||||
|
||||
# Copy the extension
|
||||
cp(EXTENSION_NAME, dest_path)
|
||||
end
|
||||
|
||||
task :default => :install
|
|
@ -1,40 +0,0 @@
|
|||
# We can't use Ruby's standard build procedures
|
||||
# on Windows because the Ruby executable is
|
||||
# built with VC++ while here we want to build
|
||||
# with MingW. So just roll our own...
|
||||
|
||||
require 'rake/clean'
|
||||
require 'rbconfig'
|
||||
|
||||
RUBY_INCLUDE_DIR = Config::CONFIG["archdir"]
|
||||
RUBY_BIN_DIR = Config::CONFIG["bindir"]
|
||||
RUBY_LIB_DIR = Config::CONFIG["libdir"]
|
||||
RUBY_SHARED_LIB = Config::CONFIG["LIBRUBY"]
|
||||
RUBY_SHARED_DLL = RUBY_SHARED_LIB.gsub(/lib$/, 'dll')
|
||||
|
||||
EXTENSION_NAME = "pg.#{Config::CONFIG["DLEXT"]}"
|
||||
|
||||
CLEAN.include('*.o')
|
||||
CLOBBER.include(EXTENSION_NAME)
|
||||
|
||||
task :default => "pg"
|
||||
|
||||
DEFINES = "-DHAVE_LIBPQ_FE_H -DHAVE_LIBPQ_LIBPQ_FS_H -DHAVE_PQCONNECTIONUSEDPASSWORD -DHAVE_PQISTHREADSAFE -DHAVE_LO_CREATE -DHAVE_PQPREPARE -DHAVE_PQEXECPARAMS -DHAVE_PQESCAPESTRING -DHAVE_PQESCAPESTRINGCONN -DHAVE_PG_ENCODING_TO_CHAR -DHAVE_PQSETCLIENTENCODING"
|
||||
LIBS = "-lpq -lm"
|
||||
SRC = FileList['../*.c']
|
||||
OBJ = SRC.collect do |file_name|
|
||||
File.basename(file_name).ext('o')
|
||||
end
|
||||
|
||||
SRC.each do |srcfile|
|
||||
objfile = File.basename(srcfile).ext('o')
|
||||
file objfile => srcfile do
|
||||
command = "gcc -c -O2 -Wall #{DEFINES} -o #{objfile} -I/usr/local/include #{srcfile} -I#{RUBY_INCLUDE_DIR}"
|
||||
sh "sh -c '#{command}'"
|
||||
end
|
||||
end
|
||||
|
||||
file "pg" => OBJ do
|
||||
command = "gcc -shared -o #{EXTENSION_NAME} #{OBJ} -L/usr/local/lib #{LIBS} #{RUBY_BIN_DIR}/#{RUBY_SHARED_DLL}"
|
||||
sh "sh -c '#{command}'"
|
||||
end
|
34
project.yml
34
project.yml
|
@ -1,34 +0,0 @@
|
|||
---
|
||||
project_name: pg
|
||||
project_homepage: http://bitbucket.org/ged/ruby-pg/
|
||||
project_summary: A Ruby interface to the PostgreSQL RDBMS
|
||||
project_description: |-
|
||||
This is the extension library to access a PostgreSQL database from Ruby.
|
||||
This library works with PostgreSQL 7.4 and later.
|
||||
project_pubhost: deveiate.org
|
||||
project_pubdir: /usr/local/www/public/code/
|
||||
project_licenses:
|
||||
- Ruby
|
||||
- GPL
|
||||
- BSD
|
||||
gem_pubhost: rubygems.org
|
||||
release_mailto: Ruby-Talk List <ruby-talk@ruby-lang.org>
|
||||
release_smtphost: mail.faeriemud.org
|
||||
post_install_message: ""
|
||||
authors:
|
||||
Jeff Davis: ruby-pg@j-davis.com
|
||||
Michael Granger: ged@FaerieMUD.org
|
||||
project_dependencies: {}
|
||||
dev_dependencies:
|
||||
rake-compiler: ~>0.7.0
|
||||
project_requirements:
|
||||
PostgreSQL: ">=7.4"
|
||||
additional_pkgfiles:
|
||||
- README.*
|
||||
- GPL
|
||||
- BSD
|
||||
- Contributors
|
||||
excluded_pkgfiles: []
|
||||
|
||||
required_ruby_version: ">=1.8.7"
|
||||
version_file: ../ext/pg.c
|
Loading…
Reference in New Issue