diff options
author | CVS to git conversion script <webmaster@postgresql.org> | 2002-06-20 20:29:55 +0000 |
---|---|---|
committer | CVS to git conversion script <webmaster@postgresql.org> | 2002-06-20 20:29:55 +0000 |
commit | 05dedace84ef8c93fea5309c3ac55f889011429b (patch) | |
tree | 4c7f513afbbc03060039a165d1770e11be711773 /src/interfaces/python | |
parent | d84fe82230c593f3dc5d7f427849b99d1efa8a0a (diff) |
This commit was manufactured by cvs2git to create branch 'ecpg_big_bison'.
Sprout from master 2002-06-20 20:29:54 UTC Bruce Momjian <bruce@momjian.us> 'Update copyright to 2002.'
Delete:
COPYRIGHT
GNUmakefile.in
HISTORY
INSTALL
Makefile
README
aclocal.m4
config/ac_func_accept_argtypes.m4
config/c-compiler.m4
config/c-library.m4
config/config.guess
config/config.sub
config/cxx.m4
config/docbook.m4
config/general.m4
config/install-sh
config/java.m4
config/libtool.m4
config/missing
config/mkinstalldirs
config/perl.m4
config/prep_buildtree
config/programs.m4
config/python.m4
config/tcl.m4
configure
configure.in
contrib/Makefile
contrib/README
contrib/array/Makefile
contrib/array/README.array_iterator
contrib/array/array_iterator.c
contrib/array/array_iterator.h
contrib/array/array_iterator.sql.in
contrib/btree_gist/Makefile
contrib/btree_gist/README.btree_gist
contrib/btree_gist/btree_gist.c
contrib/btree_gist/btree_gist.sql.in
contrib/btree_gist/data/test_btree.data
contrib/btree_gist/data/test_btree_ts.data
contrib/btree_gist/expected/btree_gist.out
contrib/btree_gist/sql/btree_gist.sql
contrib/chkpass/Makefile
contrib/chkpass/README.chkpass
contrib/chkpass/chkpass.c
contrib/chkpass/chkpass.sql.in
contrib/contrib-global.mk
contrib/cube/Makefile
contrib/cube/README.cube
contrib/cube/buffer.c
contrib/cube/buffer.h
contrib/cube/cube.c
contrib/cube/cube.sql.in
contrib/cube/cubedata.h
contrib/cube/cubeparse.y
contrib/cube/cubescan.l
contrib/cube/data/test_cube.data
contrib/cube/expected/cube.out
contrib/cube/sql/cube.sql
contrib/dbase/Makefile
contrib/dbase/README.dbf2pg
contrib/dbase/dbf.c
contrib/dbase/dbf.h
contrib/dbase/dbf2pg.1
contrib/dbase/dbf2pg.c
contrib/dbase/endian.c
contrib/dblink/Makefile
contrib/dblink/README.dblink
contrib/dblink/dblink.c
contrib/dblink/dblink.h
contrib/dblink/dblink.sql.in
contrib/dbsize/Makefile
contrib/dbsize/README.dbsize
contrib/dbsize/dbsize.c
contrib/dbsize/dbsize.sql.in
contrib/earthdistance/Makefile
contrib/earthdistance/README.earthdistance
contrib/earthdistance/earthdistance.c
contrib/earthdistance/earthdistance.sql.in
contrib/findoidjoins/Makefile
contrib/findoidjoins/README.findoidjoins
contrib/findoidjoins/findoidjoins.c
contrib/findoidjoins/make_oidjoins_check
contrib/fulltextindex/Makefile
contrib/fulltextindex/README.fti
contrib/fulltextindex/TODO
contrib/fulltextindex/fti.c
contrib/fulltextindex/fti.pl
contrib/fulltextindex/fti.sql.in
contrib/fulltextindex/timings.sh
contrib/fuzzystrmatch/Makefile
contrib/fuzzystrmatch/README.fuzzystrmatch
contrib/fuzzystrmatch/README.soundex
contrib/fuzzystrmatch/fuzzystrmatch.c
contrib/fuzzystrmatch/fuzzystrmatch.h
contrib/fuzzystrmatch/fuzzystrmatch.sql.in
contrib/intagg/Makefile
contrib/intagg/README.int_aggregate
contrib/intagg/int_aggregate.c
contrib/intagg/int_aggregate.sql.in
contrib/intarray/Makefile
contrib/intarray/README.intarray
contrib/intarray/_int.c
contrib/intarray/_int.sql.in
contrib/intarray/bench/bench.pl
contrib/intarray/bench/create_test.pl
contrib/intarray/data/test__int.data
contrib/intarray/expected/_int.out
contrib/intarray/sql/_int.sql
contrib/ipc_check/README
contrib/ipc_check/ipc_check.pl
contrib/isbn_issn/Makefile
contrib/isbn_issn/README.isbn_issn
contrib/isbn_issn/isbn_issn.c
contrib/isbn_issn/isbn_issn.sql.in
contrib/lo/Makefile
contrib/lo/README.lo
contrib/lo/lo.c
contrib/lo/lo.sql.in
contrib/lo/lo_drop.sql
contrib/lo/lo_test.sql
contrib/mSQL-interface/Makefile
contrib/mSQL-interface/README.mpgsql
contrib/mSQL-interface/mpgsql.c
contrib/mac/README.mac
contrib/mac/createoui
contrib/mac/dropoui
contrib/mac/ouiparse.awk
contrib/mac/updateoui
contrib/miscutil/Makefile
contrib/miscutil/README.misc_utils
contrib/miscutil/misc_utils.c
contrib/miscutil/misc_utils.h
contrib/miscutil/misc_utils.sql.in
contrib/mysql/README
contrib/mysql/my2pg.pl
contrib/mysql/mysql2pgsql
contrib/noupdate/Makefile
contrib/noupdate/README.noup
contrib/noupdate/noup.c
contrib/noupdate/noup.sql.in
contrib/oid2name/Makefile
contrib/oid2name/README.oid2name
contrib/oid2name/oid2name.c
contrib/oracle/CHANGES
contrib/oracle/Ora2Pg.pm
contrib/oracle/README.ora2pg
contrib/oracle/TODO
contrib/oracle/ora2pg.html
contrib/oracle/ora2pg.pl
contrib/pg_controldata/Makefile
contrib/pg_controldata/README.pg_controldata
contrib/pg_controldata/pg_controldata.c
contrib/pg_dumplo/Makefile
contrib/pg_dumplo/README.pg_dumplo
contrib/pg_dumplo/lo_export.c
contrib/pg_dumplo/lo_import.c
contrib/pg_dumplo/main.c
contrib/pg_dumplo/pg_dumplo.h
contrib/pg_dumplo/utils.c
contrib/pg_logger/Makefile
contrib/pg_logger/README.pg_logger
contrib/pg_logger/pg_logger.c
contrib/pg_resetxlog/Makefile
contrib/pg_resetxlog/README.pg_resetxlog
contrib/pg_resetxlog/pg_resetxlog.c
contrib/pg_upgrade/README
contrib/pg_upgrade/pg_upgrade
contrib/pg_upgrade/pg_upgrade.1
contrib/pgbench/Makefile
contrib/pgbench/README.pgbench
contrib/pgbench/README.pgbench_jis
contrib/pgbench/pgbench.c
contrib/pgcrypto/API
contrib/pgcrypto/Makefile
contrib/pgcrypto/README.pgcrypto
contrib/pgcrypto/blf.c
contrib/pgcrypto/blf.h
contrib/pgcrypto/crypt-blowfish.c
contrib/pgcrypto/crypt-des.c
contrib/pgcrypto/crypt-gensalt.c
contrib/pgcrypto/crypt-md5.c
contrib/pgcrypto/expected/blowfish.out
contrib/pgcrypto/expected/crypt-blowfish.out
contrib/pgcrypto/expected/crypt-des.out
contrib/pgcrypto/expected/crypt-md5.out
contrib/pgcrypto/expected/crypt-xdes.out
contrib/pgcrypto/expected/hmac-md5.out
contrib/pgcrypto/expected/hmac-sha1.out
contrib/pgcrypto/expected/init.out
contrib/pgcrypto/expected/md5.out
contrib/pgcrypto/expected/rijndael.out
contrib/pgcrypto/expected/sha1.out
contrib/pgcrypto/internal.c
contrib/pgcrypto/md5.c
contrib/pgcrypto/md5.h
contrib/pgcrypto/mhash.c
contrib/pgcrypto/misc.c
contrib/pgcrypto/openssl.c
contrib/pgcrypto/pgcrypto.c
contrib/pgcrypto/pgcrypto.h
contrib/pgcrypto/pgcrypto.sql.in
contrib/pgcrypto/px-crypt.c
contrib/pgcrypto/px-crypt.h
contrib/pgcrypto/px-hmac.c
contrib/pgcrypto/px.c
contrib/pgcrypto/px.h
contrib/pgcrypto/random.c
contrib/pgcrypto/rijndael.c
contrib/pgcrypto/rijndael.h
contrib/pgcrypto/rijndael.tbl
contrib/pgcrypto/sha1.c
contrib/pgcrypto/sha1.h
contrib/pgcrypto/sql/blowfish.sql
contrib/pgcrypto/sql/crypt-blowfish.sql
contrib/pgcrypto/sql/crypt-des.sql
contrib/pgcrypto/sql/crypt-md5.sql
contrib/pgcrypto/sql/crypt-xdes.sql
contrib/pgcrypto/sql/hmac-md5.sql
contrib/pgcrypto/sql/hmac-sha1.sql
contrib/pgcrypto/sql/init.sql
contrib/pgcrypto/sql/md5.sql
contrib/pgcrypto/sql/rijndael.sql
contrib/pgcrypto/sql/sha1.sql
contrib/pgstattuple/Makefile
contrib/pgstattuple/README.pgstattuple
contrib/pgstattuple/README.pgstattuple.euc_jp
contrib/pgstattuple/pgstattuple.c
contrib/pgstattuple/pgstattuple.sql.in
contrib/retep/CHANGELOG
contrib/retep/Implementation
contrib/retep/Makefile
contrib/retep/README
contrib/retep/build.xml
contrib/retep/data/cds.dtd
contrib/retep/data/cds.xml
contrib/retep/retep.jpx
contrib/retep/uk/org/retep/dtu/DCollection.java
contrib/retep/uk/org/retep/dtu/DConstants.java
contrib/retep/uk/org/retep/dtu/DElement.java
contrib/retep/uk/org/retep/dtu/DEnvironment.java
contrib/retep/uk/org/retep/dtu/DModule.java
contrib/retep/uk/org/retep/dtu/DModuleXML.java
contrib/retep/uk/org/retep/dtu/DNode.java
contrib/retep/uk/org/retep/dtu/DProcessor.java
contrib/retep/uk/org/retep/dtu/DTransform.java
contrib/retep/uk/org/retep/tools/Tool.java
contrib/retep/uk/org/retep/tools.properties
contrib/retep/uk/org/retep/util/ExceptionDialog.java
contrib/retep/uk/org/retep/util/Globals.java
contrib/retep/uk/org/retep/util/Logger.java
contrib/retep/uk/org/retep/util/Main.java
contrib/retep/uk/org/retep/util/StandaloneApp.java
contrib/retep/uk/org/retep/util/hba/Editor.java
contrib/retep/uk/org/retep/util/hba/Main.java
contrib/retep/uk/org/retep/util/hba/Record.java
contrib/retep/uk/org/retep/util/misc/IPAddress.java
contrib/retep/uk/org/retep/util/misc/PropertiesIO.java
contrib/retep/uk/org/retep/util/misc/WStringTokenizer.java
contrib/retep/uk/org/retep/util/models/HBATableModel.java
contrib/retep/uk/org/retep/util/models/PropertiesTableModel.java
contrib/retep/uk/org/retep/util/proped/Main.java
contrib/retep/uk/org/retep/util/proped/PropertyEditor.java
contrib/retep/uk/org/retep/xml/core/XMLFactory.java
contrib/retep/uk/org/retep/xml/core/XMLFactoryException.java
contrib/retep/uk/org/retep/xml/jdbc/XMLDatabase.java
contrib/retep/uk/org/retep/xml/jdbc/XMLResultSet.java
contrib/retep/uk/org/retep/xml/parser/TagHandler.java
contrib/retep/uk/org/retep/xml/parser/TagListener.java
contrib/retep/uk/org/retep/xml/test/XMLExport.java
contrib/rserv/ApplySnapshot.in
contrib/rserv/CleanLog.in
contrib/rserv/GetSyncID.in
contrib/rserv/InitRservTest.in
contrib/rserv/Makefile
contrib/rserv/MasterAddTable.in
contrib/rserv/MasterInit.in
contrib/rserv/MasterSync.in
contrib/rserv/PrepareSnapshot.in
contrib/rserv/README.rserv
contrib/rserv/RServ.pm
contrib/rserv/Replicate.in
contrib/rserv/RservTest.in
contrib/rserv/SlaveAddTable.in
contrib/rserv/SlaveInit.in
contrib/rserv/master.sql.in
contrib/rserv/regress.sh
contrib/rserv/rserv.c
contrib/rserv/slave.sql.in
contrib/rtree_gist/Makefile
contrib/rtree_gist/README.rtree_gist
contrib/rtree_gist/bench/bench.pl
contrib/rtree_gist/bench/create_test.pl
contrib/rtree_gist/data/test_box.data
contrib/rtree_gist/expected/rtree_gist.out
contrib/rtree_gist/rtree_gist.c
contrib/rtree_gist/rtree_gist.sql.in
contrib/rtree_gist/sql/rtree_gist.sql
contrib/seg/Makefile
contrib/seg/README.seg
contrib/seg/buffer.c
contrib/seg/buffer.h
contrib/seg/data/test_seg.data
contrib/seg/expected/seg.out
contrib/seg/seg-validate.pl
contrib/seg/seg.c
contrib/seg/seg.sql.in
contrib/seg/segdata.h
contrib/seg/segparse.y
contrib/seg/segscan.l
contrib/seg/sort-segments.pl
contrib/seg/sql/seg.sql
contrib/spi/Makefile
contrib/spi/README.spi
contrib/spi/autoinc.c
contrib/spi/autoinc.example
contrib/spi/autoinc.sql.in
contrib/spi/insert_username.c
contrib/spi/insert_username.example
contrib/spi/insert_username.sql.in
contrib/spi/moddatetime.c
contrib/spi/moddatetime.example
contrib/spi/moddatetime.sql.in
contrib/spi/preprocessor/README.MAX
contrib/spi/preprocessor/example.sql
contrib/spi/preprocessor/step1.c
contrib/spi/preprocessor/step1.e
contrib/spi/preprocessor/step2.pl
contrib/spi/refint.c
contrib/spi/refint.example
contrib/spi/refint.sql.in
contrib/spi/timetravel.c
contrib/spi/timetravel.example
contrib/spi/timetravel.sql.in
contrib/start-scripts/freebsd
contrib/start-scripts/linux
contrib/string/Makefile
contrib/string/README.string_io
contrib/string/string_io.c
contrib/string/string_io.h
contrib/string/string_io.sql.in
contrib/tips/Makefile
contrib/tips/README.apachelog
contrib/tools/add-emacs-variables
contrib/tools/find-sources
contrib/tools/make-tags
contrib/tsearch/Makefile
contrib/tsearch/README.tsearch
contrib/tsearch/crc32.c
contrib/tsearch/crc32.h
contrib/tsearch/data/test_tsearch.data
contrib/tsearch/deflex.h
contrib/tsearch/dict/porter_english.dct
contrib/tsearch/dict/russian_stemming.dct
contrib/tsearch/dict.h
contrib/tsearch/expected/tsearch.out
contrib/tsearch/gistidx.c
contrib/tsearch/gistidx.h
contrib/tsearch/makedict/makedict.pl
contrib/tsearch/morph.c
contrib/tsearch/morph.h
contrib/tsearch/parser.h
contrib/tsearch/parser.l
contrib/tsearch/query.c
contrib/tsearch/query.h
contrib/tsearch/rewrite.c
contrib/tsearch/rewrite.h
contrib/tsearch/sql/tsearch.sql
contrib/tsearch/tsearch.sql.in
contrib/tsearch/txtidx.c
contrib/tsearch/txtidx.h
contrib/userlock/Makefile
contrib/userlock/README.user_locks
contrib/userlock/user_locks.c
contrib/userlock/user_locks.h
contrib/userlock/user_locks.sql.in
contrib/vacuumlo/Makefile
contrib/vacuumlo/README.vacuumlo
contrib/vacuumlo/vacuumlo.c
contrib/xml/Makefile
contrib/xml/README
contrib/xml/TODO
contrib/xml/pgxml.c
contrib/xml/pgxml.h
contrib/xml/pgxml.source
contrib/xml/pgxml_dom.c
contrib/xml/pgxml_dom.source
doc/FAQ
doc/FAQ_AIX
doc/FAQ_DEV
doc/FAQ_HPUX
doc/FAQ_IRIX
doc/FAQ_MSWIN
doc/FAQ_QNX4
doc/FAQ_SCO
doc/FAQ_Solaris
doc/FAQ_german
doc/FAQ_japanese
doc/FAQ_polish
doc/FAQ_russian
doc/KNOWN_BUGS
doc/MISSING_FEATURES
doc/Makefile
doc/README.mb.big5
doc/README.mb.jp
doc/TODO
doc/TODO.detail/README
doc/TODO.detail/atttypmod
doc/TODO.detail/crossdb
doc/TODO.detail/cursor
doc/TODO.detail/drop
doc/TODO.detail/exists
doc/TODO.detail/foreign
doc/TODO.detail/fsync
doc/TODO.detail/inheritance
doc/TODO.detail/java
doc/TODO.detail/mmap
doc/TODO.detail/namedatalen
doc/TODO.detail/optimizer
doc/TODO.detail/performance
doc/TODO.detail/persistent
doc/TODO.detail/pool
doc/TODO.detail/prepare
doc/TODO.detail/privileges
doc/TODO.detail/replication
doc/TODO.detail/schema
doc/TODO.detail/tablespaces
doc/TODO.detail/thread
doc/TODO.detail/transactions
doc/TODO.detail/typeconv
doc/TODO.detail/update
doc/TODO.detail/vacuum
doc/TODO.detail/view
doc/TODO.detail/win32
doc/TODO.detail/yacc
doc/bug.template
doc/src/FAQ/FAQ.html
doc/src/FAQ/FAQ_DEV.html
doc/src/FAQ/FAQ_german.html
doc/src/FAQ/FAQ_japanese.html
doc/src/FAQ/FAQ_polish.html
doc/src/FAQ/FAQ_russian.html
doc/src/Makefile
doc/src/graphics/catalogs.ag
doc/src/graphics/catalogs.cgm
doc/src/graphics/catalogs.gif
doc/src/graphics/catalogs.ps
doc/src/graphics/clientserver.ag
doc/src/graphics/clientserver.gif
doc/src/graphics/connections.ag
doc/src/graphics/connections.gif
doc/src/sgml/Makefile
doc/src/sgml/admin.sgml
doc/src/sgml/advanced.sgml
doc/src/sgml/arch-dev.sgml
doc/src/sgml/arch-pg.sgml
doc/src/sgml/array.sgml
doc/src/sgml/backup.sgml
doc/src/sgml/biblio.sgml
doc/src/sgml/bki.sgml
doc/src/sgml/book-decl.sgml
doc/src/sgml/catalogs.sgml
doc/src/sgml/charset.sgml
doc/src/sgml/client-auth.sgml
doc/src/sgml/compiler.sgml
doc/src/sgml/contacts.sgml
doc/src/sgml/cvs.sgml
doc/src/sgml/datatype.sgml
doc/src/sgml/datetime.sgml
doc/src/sgml/developer.sgml
doc/src/sgml/dfunc.sgml
doc/src/sgml/diskusage.sgml
doc/src/sgml/docguide.sgml
doc/src/sgml/ecpg.sgml
doc/src/sgml/extend.sgml
doc/src/sgml/features.sgml
doc/src/sgml/filelist.sgml
doc/src/sgml/fixrtf
doc/src/sgml/func-ref.sgml
doc/src/sgml/func.sgml
doc/src/sgml/geqo.sgml
doc/src/sgml/gist.sgml
doc/src/sgml/history.sgml
doc/src/sgml/indexcost.sgml
doc/src/sgml/indices.sgml
doc/src/sgml/info.sgml
doc/src/sgml/inherit.sgml
doc/src/sgml/install-win32.sgml
doc/src/sgml/installation.sgml
doc/src/sgml/intro.sgml
doc/src/sgml/jdbc.sgml
doc/src/sgml/keywords.sgml
doc/src/sgml/legal.sgml
doc/src/sgml/libpgeasy.sgml
doc/src/sgml/libpgtcl.sgml
doc/src/sgml/libpq++.sgml
doc/src/sgml/libpq.sgml
doc/src/sgml/lobj.sgml
doc/src/sgml/maintenance.sgml
doc/src/sgml/manage-ag.sgml
doc/src/sgml/manage.sgml
doc/src/sgml/monitoring.sgml
doc/src/sgml/mvcc.sgml
doc/src/sgml/nls.sgml
doc/src/sgml/notation.sgml
doc/src/sgml/odbc.sgml
doc/src/sgml/page.sgml
doc/src/sgml/perform.sgml
doc/src/sgml/plperl.sgml
doc/src/sgml/plpython.sgml
doc/src/sgml/plsql.sgml
doc/src/sgml/pltcl.sgml
doc/src/sgml/postgres.sgml
doc/src/sgml/problems.sgml
doc/src/sgml/programmer.sgml
doc/src/sgml/protocol.sgml
doc/src/sgml/pygresql.sgml
doc/src/sgml/queries.sgml
doc/src/sgml/query.sgml
doc/src/sgml/recovery.sgml
doc/src/sgml/ref/abort.sgml
doc/src/sgml/ref/allfiles.sgml
doc/src/sgml/ref/alter_database.sgml
doc/src/sgml/ref/alter_group.sgml
doc/src/sgml/ref/alter_table.sgml
doc/src/sgml/ref/alter_trigger.sgml
doc/src/sgml/ref/alter_user.sgml
doc/src/sgml/ref/analyze.sgml
doc/src/sgml/ref/begin.sgml
doc/src/sgml/ref/checkpoint.sgml
doc/src/sgml/ref/close.sgml
doc/src/sgml/ref/cluster.sgml
doc/src/sgml/ref/comment.sgml
doc/src/sgml/ref/commit.sgml
doc/src/sgml/ref/copy.sgml
doc/src/sgml/ref/create_aggregate.sgml
doc/src/sgml/ref/create_constraint.sgml
doc/src/sgml/ref/create_database.sgml
doc/src/sgml/ref/create_domain.sgml
doc/src/sgml/ref/create_function.sgml
doc/src/sgml/ref/create_group.sgml
doc/src/sgml/ref/create_index.sgml
doc/src/sgml/ref/create_language.sgml
doc/src/sgml/ref/create_operator.sgml
doc/src/sgml/ref/create_rule.sgml
doc/src/sgml/ref/create_schema.sgml
doc/src/sgml/ref/create_sequence.sgml
doc/src/sgml/ref/create_table.sgml
doc/src/sgml/ref/create_table_as.sgml
doc/src/sgml/ref/create_trigger.sgml
doc/src/sgml/ref/create_type.sgml
doc/src/sgml/ref/create_user.sgml
doc/src/sgml/ref/create_view.sgml
doc/src/sgml/ref/createdb.sgml
doc/src/sgml/ref/createlang.sgml
doc/src/sgml/ref/createuser.sgml
doc/src/sgml/ref/current_date.sgml
doc/src/sgml/ref/current_time.sgml
doc/src/sgml/ref/current_timestamp.sgml
doc/src/sgml/ref/current_user.sgml
doc/src/sgml/ref/declare.sgml
doc/src/sgml/ref/delete.sgml
doc/src/sgml/ref/drop_aggregate.sgml
doc/src/sgml/ref/drop_database.sgml
doc/src/sgml/ref/drop_domain.sgml
doc/src/sgml/ref/drop_function.sgml
doc/src/sgml/ref/drop_group.sgml
doc/src/sgml/ref/drop_index.sgml
doc/src/sgml/ref/drop_language.sgml
doc/src/sgml/ref/drop_operator.sgml
doc/src/sgml/ref/drop_rule.sgml
doc/src/sgml/ref/drop_sequence.sgml
doc/src/sgml/ref/drop_table.sgml
doc/src/sgml/ref/drop_trigger.sgml
doc/src/sgml/ref/drop_type.sgml
doc/src/sgml/ref/drop_user.sgml
doc/src/sgml/ref/drop_view.sgml
doc/src/sgml/ref/dropdb.sgml
doc/src/sgml/ref/droplang.sgml
doc/src/sgml/ref/dropuser.sgml
doc/src/sgml/ref/ecpg-ref.sgml
doc/src/sgml/ref/end.sgml
doc/src/sgml/ref/explain.sgml
doc/src/sgml/ref/fetch.sgml
doc/src/sgml/ref/grant.sgml
doc/src/sgml/ref/initdb.sgml
doc/src/sgml/ref/initlocation.sgml
doc/src/sgml/ref/insert.sgml
doc/src/sgml/ref/ipcclean.sgml
doc/src/sgml/ref/listen.sgml
doc/src/sgml/ref/load.sgml
doc/src/sgml/ref/lock.sgml
doc/src/sgml/ref/move.sgml
doc/src/sgml/ref/notify.sgml
doc/src/sgml/ref/pg_config-ref.sgml
doc/src/sgml/ref/pg_ctl-ref.sgml
doc/src/sgml/ref/pg_dump.sgml
doc/src/sgml/ref/pg_dumpall.sgml
doc/src/sgml/ref/pg_restore.sgml
doc/src/sgml/ref/pgaccess-ref.sgml
doc/src/sgml/ref/pgtclsh.sgml
doc/src/sgml/ref/pgtksh.sgml
doc/src/sgml/ref/postgres-ref.sgml
doc/src/sgml/ref/postmaster.sgml
doc/src/sgml/ref/psql-ref.sgml
doc/src/sgml/ref/reindex.sgml
doc/src/sgml/ref/reset.sgml
doc/src/sgml/ref/revoke.sgml
doc/src/sgml/ref/rollback.sgml
doc/src/sgml/ref/select.sgml
doc/src/sgml/ref/select_into.sgml
doc/src/sgml/ref/set.sgml
doc/src/sgml/ref/set_constraints.sgml
doc/src/sgml/ref/set_session_auth.sgml
doc/src/sgml/ref/set_transaction.sgml
doc/src/sgml/ref/show.sgml
doc/src/sgml/ref/truncate.sgml
doc/src/sgml/ref/unlisten.sgml
doc/src/sgml/ref/update.sgml
doc/src/sgml/ref/vacuum.sgml
doc/src/sgml/ref/vacuumdb.sgml
doc/src/sgml/refentry.sgml
doc/src/sgml/reference.ced
doc/src/sgml/reference.sgml
doc/src/sgml/regress.sgml
doc/src/sgml/release.sgml
doc/src/sgml/rules.sgml
doc/src/sgml/runtime.sgml
doc/src/sgml/sources.sgml
doc/src/sgml/spi.sgml
doc/src/sgml/sql.sgml
doc/src/sgml/standalone-install.sgml
doc/src/sgml/start.sgml
doc/src/sgml/stylesheet.css
doc/src/sgml/stylesheet.dsl
doc/src/sgml/syntax.sgml
doc/src/sgml/trigger.sgml
doc/src/sgml/tutorial.sgml
doc/src/sgml/typeconv.sgml
doc/src/sgml/user-manag.sgml
doc/src/sgml/user.sgml
doc/src/sgml/version.sgml
doc/src/sgml/wal.sgml
doc/src/sgml/xaggr.sgml
doc/src/sgml/xfunc.sgml
doc/src/sgml/xindex.sgml
doc/src/sgml/xoper.sgml
doc/src/sgml/xplang.sgml
doc/src/sgml/xtypes.sgml
doc/src/sgml/y2k.sgml
register.txt
src/DEVELOPERS
src/Makefile
src/Makefile.global.in
src/Makefile.shlib
src/backend/Makefile
src/backend/access/Makefile
src/backend/access/common/Makefile
src/backend/access/common/heaptuple.c
src/backend/access/common/indextuple.c
src/backend/access/common/indexvalid.c
src/backend/access/common/printtup.c
src/backend/access/common/scankey.c
src/backend/access/common/tupdesc.c
src/backend/access/gist/Makefile
src/backend/access/gist/gist.c
src/backend/access/gist/gistget.c
src/backend/access/gist/gistscan.c
src/backend/access/gist/giststrat.c
src/backend/access/hash/Makefile
src/backend/access/hash/hash.c
src/backend/access/hash/hashfunc.c
src/backend/access/hash/hashinsert.c
src/backend/access/hash/hashovfl.c
src/backend/access/hash/hashpage.c
src/backend/access/hash/hashscan.c
src/backend/access/hash/hashsearch.c
src/backend/access/hash/hashstrat.c
src/backend/access/hash/hashutil.c
src/backend/access/heap/Makefile
src/backend/access/heap/heapam.c
src/backend/access/heap/hio.c
src/backend/access/heap/tuptoaster.c
src/backend/access/index/Makefile
src/backend/access/index/genam.c
src/backend/access/index/indexam.c
src/backend/access/index/istrat.c
src/backend/access/nbtree/Makefile
src/backend/access/nbtree/README
src/backend/access/nbtree/nbtcompare.c
src/backend/access/nbtree/nbtinsert.c
src/backend/access/nbtree/nbtpage.c
src/backend/access/nbtree/nbtree.c
src/backend/access/nbtree/nbtsearch.c
src/backend/access/nbtree/nbtsort.c
src/backend/access/nbtree/nbtstrat.c
src/backend/access/nbtree/nbtutils.c
src/backend/access/rtree/Makefile
src/backend/access/rtree/rtget.c
src/backend/access/rtree/rtproc.c
src/backend/access/rtree/rtree.c
src/backend/access/rtree/rtscan.c
src/backend/access/rtree/rtstrat.c
src/backend/access/transam/Makefile
src/backend/access/transam/clog.c
src/backend/access/transam/rmgr.c
src/backend/access/transam/transam.c
src/backend/access/transam/varsup.c
src/backend/access/transam/xact.c
src/backend/access/transam/xid.c
src/backend/access/transam/xlog.c
src/backend/access/transam/xlogutils.c
src/backend/bootstrap/.cvsignore
src/backend/bootstrap/Makefile
src/backend/bootstrap/bootparse.y
src/backend/bootstrap/bootscanner.l
src/backend/bootstrap/bootstrap.c
src/backend/catalog/Makefile
src/backend/catalog/README
src/backend/catalog/aclchk.c
src/backend/catalog/catalog.c
src/backend/catalog/genbki.sh
src/backend/catalog/heap.c
src/backend/catalog/index.c
src/backend/catalog/indexing.c
src/backend/catalog/namespace.c
src/backend/catalog/pg_aggregate.c
src/backend/catalog/pg_largeobject.c
src/backend/catalog/pg_namespace.c
src/backend/catalog/pg_operator.c
src/backend/catalog/pg_proc.c
src/backend/catalog/pg_type.c
src/backend/commands/Makefile
src/backend/commands/_deadcode/recipe.c
src/backend/commands/_deadcode/recipe.h
src/backend/commands/_deadcode/version.c
src/backend/commands/aggregatecmds.c
src/backend/commands/analyze.c
src/backend/commands/async.c
src/backend/commands/cluster.c
src/backend/commands/comment.c
src/backend/commands/copy.c
src/backend/commands/dbcommands.c
src/backend/commands/define.c
src/backend/commands/explain.c
src/backend/commands/functioncmds.c
src/backend/commands/indexcmds.c
src/backend/commands/lockcmds.c
src/backend/commands/operatorcmds.c
src/backend/commands/portalcmds.c
src/backend/commands/proclang.c
src/backend/commands/schemacmds.c
src/backend/commands/sequence.c
src/backend/commands/tablecmds.c
src/backend/commands/trigger.c
src/backend/commands/typecmds.c
src/backend/commands/user.c
src/backend/commands/vacuum.c
src/backend/commands/vacuumlazy.c
src/backend/commands/variable.c
src/backend/commands/view.c
src/backend/executor/Makefile
src/backend/executor/README
src/backend/executor/_deadcode/nodeTee.c
src/backend/executor/execAmi.c
src/backend/executor/execJunk.c
src/backend/executor/execMain.c
src/backend/executor/execProcnode.c
src/backend/executor/execQual.c
src/backend/executor/execScan.c
src/backend/executor/execTuples.c
src/backend/executor/execUtils.c
src/backend/executor/functions.c
src/backend/executor/instrument.c
src/backend/executor/nodeAgg.c
src/backend/executor/nodeAppend.c
src/backend/executor/nodeFunctionscan.c
src/backend/executor/nodeGroup.c
src/backend/executor/nodeHash.c
src/backend/executor/nodeHashjoin.c
src/backend/executor/nodeIndexscan.c
src/backend/executor/nodeLimit.c
src/backend/executor/nodeMaterial.c
src/backend/executor/nodeMergejoin.c
src/backend/executor/nodeNestloop.c
src/backend/executor/nodeResult.c
src/backend/executor/nodeSeqscan.c
src/backend/executor/nodeSetOp.c
src/backend/executor/nodeSort.c
src/backend/executor/nodeSubplan.c
src/backend/executor/nodeSubqueryscan.c
src/backend/executor/nodeTidscan.c
src/backend/executor/nodeUnique.c
src/backend/executor/spi.c
src/backend/lib/Makefile
src/backend/lib/bit.c
src/backend/lib/dllist.c
src/backend/lib/lispsort.c
src/backend/lib/stringinfo.c
src/backend/libpq/Makefile
src/backend/libpq/README.SSL
src/backend/libpq/auth.c
src/backend/libpq/be-fsstubs.c
src/backend/libpq/be-secure.c
src/backend/libpq/crypt.c
src/backend/libpq/hba.c
src/backend/libpq/md5.c
src/backend/libpq/pg_hba.conf.sample
src/backend/libpq/pg_ident.conf.sample
src/backend/libpq/pqcomm.c
src/backend/libpq/pqformat.c
src/backend/libpq/pqsignal.c
src/backend/main/Makefile
src/backend/main/main.c
src/backend/nodes/Makefile
src/backend/nodes/README
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/list.c
src/backend/nodes/makefuncs.c
src/backend/nodes/nodeFuncs.c
src/backend/nodes/nodes.c
src/backend/nodes/outfuncs.c
src/backend/nodes/print.c
src/backend/nodes/read.c
src/backend/nodes/readfuncs.c
src/backend/optimizer/Makefile
src/backend/optimizer/README
src/backend/optimizer/geqo/Makefile
src/backend/optimizer/geqo/geqo_copy.c
src/backend/optimizer/geqo/geqo_cx.c
src/backend/optimizer/geqo/geqo_erx.c
src/backend/optimizer/geqo/geqo_eval.c
src/backend/optimizer/geqo/geqo_main.c
src/backend/optimizer/geqo/geqo_misc.c
src/backend/optimizer/geqo/geqo_mutation.c
src/backend/optimizer/geqo/geqo_ox1.c
src/backend/optimizer/geqo/geqo_ox2.c
src/backend/optimizer/geqo/geqo_pmx.c
src/backend/optimizer/geqo/geqo_pool.c
src/backend/optimizer/geqo/geqo_px.c
src/backend/optimizer/geqo/geqo_recombination.c
src/backend/optimizer/geqo/geqo_selection.c
src/backend/optimizer/path/Makefile
src/backend/optimizer/path/_deadcode/predmig.c
src/backend/optimizer/path/_deadcode/xfunc.c
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/clausesel.c
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/joinpath.c
src/backend/optimizer/path/joinrels.c
src/backend/optimizer/path/orindxpath.c
src/backend/optimizer/path/pathkeys.c
src/backend/optimizer/path/tidpath.c
src/backend/optimizer/plan/Makefile
src/backend/optimizer/plan/README
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/planmain.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/plan/subselect.c
src/backend/optimizer/prep/Makefile
src/backend/optimizer/prep/_deadcode/prepkeyset.c
src/backend/optimizer/prep/prepqual.c
src/backend/optimizer/prep/preptlist.c
src/backend/optimizer/prep/prepunion.c
src/backend/optimizer/util/Makefile
src/backend/optimizer/util/clauses.c
src/backend/optimizer/util/joininfo.c
src/backend/optimizer/util/pathnode.c
src/backend/optimizer/util/plancat.c
src/backend/optimizer/util/relnode.c
src/backend/optimizer/util/restrictinfo.c
src/backend/optimizer/util/tlist.c
src/backend/optimizer/util/var.c
src/backend/parser/.cvsignore
src/backend/parser/Makefile
src/backend/parser/README
src/backend/parser/analyze.c
src/backend/parser/gram.y
src/backend/parser/keywords.c
src/backend/parser/parse_agg.c
src/backend/parser/parse_clause.c
src/backend/parser/parse_coerce.c
src/backend/parser/parse_expr.c
src/backend/parser/parse_func.c
src/backend/parser/parse_node.c
src/backend/parser/parse_oper.c
src/backend/parser/parse_relation.c
src/backend/parser/parse_target.c
src/backend/parser/parse_type.c
src/backend/parser/parser.c
src/backend/parser/scan.l
src/backend/parser/scansup.c
src/backend/po/Makefile
src/backend/po/cs.po
src/backend/po/de.po
src/backend/po/hu.po
src/backend/po/nls.mk
src/backend/po/ru.po
src/backend/po/zh_CN.po
src/backend/po/zh_TW.po
src/backend/port/Makefile
src/backend/port/aix/mkldexport.sh
src/backend/port/beos/Makefile
src/backend/port/beos/sem.c
src/backend/port/beos/shm.c
src/backend/port/beos/support.c
src/backend/port/darwin/Makefile
src/backend/port/darwin/README
src/backend/port/darwin/system.c
src/backend/port/dynloader/README.dlfcn.aix
src/backend/port/dynloader/aix.c
src/backend/port/dynloader/aix.h
src/backend/port/dynloader/beos.c
src/backend/port/dynloader/beos.h
src/backend/port/dynloader/bsdi.c
src/backend/port/dynloader/bsdi.h
src/backend/port/dynloader/darwin.c
src/backend/port/dynloader/darwin.h
src/backend/port/dynloader/dgux.c
src/backend/port/dynloader/dgux.h
src/backend/port/dynloader/freebsd.c
src/backend/port/dynloader/freebsd.h
src/backend/port/dynloader/hpux.c
src/backend/port/dynloader/hpux.h
src/backend/port/dynloader/irix5.c
src/backend/port/dynloader/irix5.h
src/backend/port/dynloader/linux.c
src/backend/port/dynloader/linux.h
src/backend/port/dynloader/netbsd.c
src/backend/port/dynloader/netbsd.h
src/backend/port/dynloader/nextstep.c
src/backend/port/dynloader/nextstep.h
src/backend/port/dynloader/openbsd.c
src/backend/port/dynloader/openbsd.h
src/backend/port/dynloader/osf.c
src/backend/port/dynloader/osf.h
src/backend/port/dynloader/qnx4.c
src/backend/port/dynloader/qnx4.h
src/backend/port/dynloader/sco.c
src/backend/port/dynloader/sco.h
src/backend/port/dynloader/solaris.c
src/backend/port/dynloader/solaris.h
src/backend/port/dynloader/sunos4.c
src/backend/port/dynloader/sunos4.h
src/backend/port/dynloader/svr4.c
src/backend/port/dynloader/svr4.h
src/backend/port/dynloader/ultrix4.c
src/backend/port/dynloader/ultrix4.h
src/backend/port/dynloader/univel.c
src/backend/port/dynloader/univel.h
src/backend/port/dynloader/unixware.c
src/backend/port/dynloader/unixware.h
src/backend/port/dynloader/win.c
src/backend/port/dynloader/win.h
src/backend/port/gethostname.c
src/backend/port/getrusage.c
src/backend/port/hpux/tas.c.template
src/backend/port/inet_aton.c
src/backend/port/inet_aton.h
src/backend/port/ipc_test.c
src/backend/port/isinf.c
src/backend/port/memcmp.c
src/backend/port/nextstep/Makefile
src/backend/port/nextstep/port.c
src/backend/port/posix_sema.c
src/backend/port/qnx4/Makefile
src/backend/port/qnx4/ipc.h
src/backend/port/qnx4/isnan.c
src/backend/port/qnx4/rint.c
src/backend/port/qnx4/sem.c
src/backend/port/qnx4/sem.h
src/backend/port/qnx4/shm.c
src/backend/port/qnx4/shm.h
src/backend/port/qnx4/tstrint.c
src/backend/port/qnx4/tstsem.c
src/backend/port/qnx4/tstshm.c
src/backend/port/random.c
src/backend/port/snprintf.c
src/backend/port/srandom.c
src/backend/port/strcasecmp.c
src/backend/port/strerror.c
src/backend/port/strtol.c
src/backend/port/strtoul.c
src/backend/port/sunos4/Makefile
src/backend/port/sunos4/float.h
src/backend/port/sysv_sema.c
src/backend/port/sysv_shmem.c
src/backend/port/tas/dummy.s
src/backend/port/tas/hpux.s
src/backend/port/tas/solaris_i386.s
src/backend/port/tas/solaris_sparc.s
src/backend/postmaster/Makefile
src/backend/postmaster/pgstat.c
src/backend/postmaster/postmaster.c
src/backend/regex/COPYRIGHT
src/backend/regex/Makefile
src/backend/regex/WHATSNEW
src/backend/regex/engine.c
src/backend/regex/re_format.7
src/backend/regex/regcomp.c
src/backend/regex/regerror.c
src/backend/regex/regex.3
src/backend/regex/regexec.c
src/backend/regex/regfree.c
src/backend/regex/retest.c
src/backend/rewrite/Makefile
src/backend/rewrite/rewriteDefine.c
src/backend/rewrite/rewriteHandler.c
src/backend/rewrite/rewriteManip.c
src/backend/rewrite/rewriteRemove.c
src/backend/rewrite/rewriteSupport.c
src/backend/storage/Makefile
src/backend/storage/buffer/Makefile
src/backend/storage/buffer/README
src/backend/storage/buffer/buf_init.c
src/backend/storage/buffer/buf_table.c
src/backend/storage/buffer/bufmgr.c
src/backend/storage/buffer/freelist.c
src/backend/storage/buffer/localbuf.c
src/backend/storage/file/Makefile
src/backend/storage/file/buffile.c
src/backend/storage/file/fd.c
src/backend/storage/freespace/Makefile
src/backend/storage/freespace/freespace.c
src/backend/storage/ipc/Makefile
src/backend/storage/ipc/README
src/backend/storage/ipc/ipc.c
src/backend/storage/ipc/ipci.c
src/backend/storage/ipc/pmsignal.c
src/backend/storage/ipc/shmem.c
src/backend/storage/ipc/shmqueue.c
src/backend/storage/ipc/sinval.c
src/backend/storage/ipc/sinvaladt.c
src/backend/storage/large_object/Makefile
src/backend/storage/large_object/inv_api.c
src/backend/storage/lmgr/Makefile
src/backend/storage/lmgr/README
src/backend/storage/lmgr/deadlock.c
src/backend/storage/lmgr/lmgr.c
src/backend/storage/lmgr/lock.c
src/backend/storage/lmgr/lwlock.c
src/backend/storage/lmgr/proc.c
src/backend/storage/lmgr/s_lock.c
src/backend/storage/lmgr/spin.c
src/backend/storage/page/Makefile
src/backend/storage/page/bufpage.c
src/backend/storage/page/itemptr.c
src/backend/storage/smgr/Makefile
src/backend/storage/smgr/README
src/backend/storage/smgr/md.c
src/backend/storage/smgr/mm.c
src/backend/storage/smgr/smgr.c
src/backend/storage/smgr/smgrtype.c
src/backend/tcop/Makefile
src/backend/tcop/dest.c
src/backend/tcop/fastpath.c
src/backend/tcop/postgres.c
src/backend/tcop/pquery.c
src/backend/tcop/utility.c
src/backend/tioga/Arr_TgRecipe.h
src/backend/tioga/Makefile
src/backend/tioga/Varray.c
src/backend/tioga/Varray.h
src/backend/tioga/tgRecipe.c
src/backend/tioga/tgRecipe.h
src/backend/utils/.cvsignore
src/backend/utils/Gen_fmgrtab.sh
src/backend/utils/Makefile
src/backend/utils/adt/Makefile
src/backend/utils/adt/acl.c
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/adt/arrayutils.c
src/backend/utils/adt/ascii.c
src/backend/utils/adt/bool.c
src/backend/utils/adt/cash.c
src/backend/utils/adt/char.c
src/backend/utils/adt/date.c
src/backend/utils/adt/datetime.c
src/backend/utils/adt/datum.c
src/backend/utils/adt/encode.c
src/backend/utils/adt/float.c
src/backend/utils/adt/format_type.c
src/backend/utils/adt/formatting.c
src/backend/utils/adt/geo_ops.c
src/backend/utils/adt/geo_selfuncs.c
src/backend/utils/adt/inet_net_ntop.c
src/backend/utils/adt/inet_net_pton.c
src/backend/utils/adt/int.c
src/backend/utils/adt/int8.c
src/backend/utils/adt/like.c
src/backend/utils/adt/like_match.c
src/backend/utils/adt/mac.c
src/backend/utils/adt/misc.c
src/backend/utils/adt/nabstime.c
src/backend/utils/adt/name.c
src/backend/utils/adt/network.c
src/backend/utils/adt/not_in.c
src/backend/utils/adt/numeric.c
src/backend/utils/adt/numutils.c
src/backend/utils/adt/oid.c
src/backend/utils/adt/oracle_compat.c
src/backend/utils/adt/pg_locale.c
src/backend/utils/adt/pg_lzcompress.c
src/backend/utils/adt/pgstatfuncs.c
src/backend/utils/adt/quote.c
src/backend/utils/adt/regexp.c
src/backend/utils/adt/regproc.c
src/backend/utils/adt/ri_triggers.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/selfuncs.c
src/backend/utils/adt/sets.c
src/backend/utils/adt/tid.c
src/backend/utils/adt/timestamp.c
src/backend/utils/adt/varbit.c
src/backend/utils/adt/varchar.c
src/backend/utils/adt/varlena.c
src/backend/utils/adt/version.c
src/backend/utils/cache/Makefile
src/backend/utils/cache/catcache.c
src/backend/utils/cache/fcache.c
src/backend/utils/cache/inval.c
src/backend/utils/cache/lsyscache.c
src/backend/utils/cache/relcache.c
src/backend/utils/cache/syscache.c
src/backend/utils/error/Makefile
src/backend/utils/error/assert.c
src/backend/utils/error/elog.c
src/backend/utils/error/exc.c
src/backend/utils/error/excabort.c
src/backend/utils/error/excid.c
src/backend/utils/error/format.c
src/backend/utils/fmgr/Makefile
src/backend/utils/fmgr/README
src/backend/utils/fmgr/dfmgr.c
src/backend/utils/fmgr/fmgr.c
src/backend/utils/hash/Makefile
src/backend/utils/hash/dynahash.c
src/backend/utils/hash/hashfn.c
src/backend/utils/hash/pg_crc.c
src/backend/utils/init/Makefile
src/backend/utils/init/findbe.c
src/backend/utils/init/globals.c
src/backend/utils/init/miscinit.c
src/backend/utils/init/postinit.c
src/backend/utils/mb/Makefile
src/backend/utils/mb/README
src/backend/utils/mb/Unicode/ISO10646-GB18030.TXT
src/backend/utils/mb/Unicode/Makefile
src/backend/utils/mb/Unicode/UCS_to_8859.pl
src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
src/backend/utils/mb/Unicode/UCS_to_GBK.pl
src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
src/backend/utils/mb/Unicode/UCS_to_UHC.pl
src/backend/utils/mb/Unicode/UCS_to_WIN874.pl
src/backend/utils/mb/Unicode/UCS_to_WINX.pl
src/backend/utils/mb/Unicode/UCS_to_cyrillic.pl
src/backend/utils/mb/Unicode/alt_to_utf8.map
src/backend/utils/mb/Unicode/big5_to_utf8.map
src/backend/utils/mb/Unicode/euc_cn_to_utf8.map
src/backend/utils/mb/Unicode/euc_jp_to_utf8.map
src/backend/utils/mb/Unicode/euc_kr_to_utf8.map
src/backend/utils/mb/Unicode/euc_tw_to_utf8.map
src/backend/utils/mb/Unicode/gb18030_to_utf8.map
src/backend/utils/mb/Unicode/gbk_to_utf8.map
src/backend/utils/mb/Unicode/iso8859_10_to_utf8.map
src/backend/utils/mb/Unicode/iso8859_13_to_utf8.map
src/backend/utils/mb/Unicode/iso8859_14_to_utf8.map
src/backend/utils/mb/Unicode/iso8859_15_to_utf8.map
src/backend/utils/mb/Unicode/iso8859_16_to_utf8.map
src/backend/utils/mb/Unicode/iso8859_2_to_utf8.map
src/backend/utils/mb/Unicode/iso8859_3_to_utf8.map
src/backend/utils/mb/Unicode/iso8859_4_to_utf8.map
src/backend/utils/mb/Unicode/iso8859_5_to_utf8.map
src/backend/utils/mb/Unicode/iso8859_6_to_utf8.map
src/backend/utils/mb/Unicode/iso8859_7_to_utf8.map
src/backend/utils/mb/Unicode/iso8859_8_to_utf8.map
src/backend/utils/mb/Unicode/iso8859_9_to_utf8.map
src/backend/utils/mb/Unicode/johab_to_utf8.map
src/backend/utils/mb/Unicode/koi8r_to_utf8.map
src/backend/utils/mb/Unicode/sjis_to_utf8.map
src/backend/utils/mb/Unicode/tcvn_to_utf8.map
src/backend/utils/mb/Unicode/ucs2utf.pl
src/backend/utils/mb/Unicode/uhc_to_utf8.map
src/backend/utils/mb/Unicode/utf8_to_alt.map
src/backend/utils/mb/Unicode/utf8_to_big5.map
src/backend/utils/mb/Unicode/utf8_to_euc_cn.map
src/backend/utils/mb/Unicode/utf8_to_euc_jp.map
src/backend/utils/mb/Unicode/utf8_to_euc_kr.map
src/backend/utils/mb/Unicode/utf8_to_euc_tw.map
src/backend/utils/mb/Unicode/utf8_to_gb18030.map
src/backend/utils/mb/Unicode/utf8_to_gbk.map
src/backend/utils/mb/Unicode/utf8_to_iso8859_10.map
src/backend/utils/mb/Unicode/utf8_to_iso8859_13.map
src/backend/utils/mb/Unicode/utf8_to_iso8859_14.map
src/backend/utils/mb/Unicode/utf8_to_iso8859_15.map
src/backend/utils/mb/Unicode/utf8_to_iso8859_16.map
src/backend/utils/mb/Unicode/utf8_to_iso8859_2.map
src/backend/utils/mb/Unicode/utf8_to_iso8859_3.map
src/backend/utils/mb/Unicode/utf8_to_iso8859_4.map
src/backend/utils/mb/Unicode/utf8_to_iso8859_5.map
src/backend/utils/mb/Unicode/utf8_to_iso8859_6.map
src/backend/utils/mb/Unicode/utf8_to_iso8859_7.map
src/backend/utils/mb/Unicode/utf8_to_iso8859_8.map
src/backend/utils/mb/Unicode/utf8_to_iso8859_9.map
src/backend/utils/mb/Unicode/utf8_to_johab.map
src/backend/utils/mb/Unicode/utf8_to_koi8r.map
src/backend/utils/mb/Unicode/utf8_to_sjis.map
src/backend/utils/mb/Unicode/utf8_to_tcvn.map
src/backend/utils/mb/Unicode/utf8_to_uhc.map
src/backend/utils/mb/Unicode/utf8_to_win1250.map
src/backend/utils/mb/Unicode/utf8_to_win1251.map
src/backend/utils/mb/Unicode/utf8_to_win1256.map
src/backend/utils/mb/Unicode/utf8_to_win874.map
src/backend/utils/mb/Unicode/win1250_to_utf8.map
src/backend/utils/mb/Unicode/win1251_to_utf8.map
src/backend/utils/mb/Unicode/win1256_to_utf8.map
src/backend/utils/mb/Unicode/win874_to_utf8.map
src/backend/utils/mb/alt.c
src/backend/utils/mb/big5.c
src/backend/utils/mb/conv.c
src/backend/utils/mb/encnames.c
src/backend/utils/mb/iso.c
src/backend/utils/mb/mbutils.c
src/backend/utils/mb/sjis.map
src/backend/utils/mb/wchar.c
src/backend/utils/mb/win.c
src/backend/utils/mb/win1251.c
src/backend/utils/mb/wstrcmp.c
src/backend/utils/mb/wstrncmp.c
src/backend/utils/misc/.cvsignore
src/backend/utils/misc/Makefile
src/backend/utils/misc/README
src/backend/utils/misc/database.c
src/backend/utils/misc/guc-file.l
src/backend/utils/misc/guc.c
src/backend/utils/misc/postgresql.conf.sample
src/backend/utils/misc/ps_status.c
src/backend/utils/misc/superuser.c
src/backend/utils/mmgr/Makefile
src/backend/utils/mmgr/README
src/backend/utils/mmgr/aset.c
src/backend/utils/mmgr/mcxt.c
src/backend/utils/mmgr/portalmem.c
src/backend/utils/sort/Makefile
src/backend/utils/sort/logtape.c
src/backend/utils/sort/tuplesort.c
src/backend/utils/sort/tuplestore.c
src/backend/utils/time/Makefile
src/backend/utils/time/tqual.c
src/bin/Makefile
src/bin/initdb/Makefile
src/bin/initdb/initdb.sh
src/bin/initlocation/Makefile
src/bin/initlocation/initlocation.sh
src/bin/ipcclean/Makefile
src/bin/ipcclean/ipcclean.sh
src/bin/pg_config/Makefile
src/bin/pg_config/pg_config.sh
src/bin/pg_ctl/Makefile
src/bin/pg_ctl/pg_ctl.sh
src/bin/pg_dump/Makefile
src/bin/pg_dump/README
src/bin/pg_dump/common.c
src/bin/pg_dump/cs.po
src/bin/pg_dump/de.po
src/bin/pg_dump/nls.mk
src/bin/pg_dump/pg_backup.h
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.h
src/bin/pg_dump/pg_backup_custom.c
src/bin/pg_dump/pg_backup_db.c
src/bin/pg_dump/pg_backup_db.h
src/bin/pg_dump/pg_backup_files.c
src/bin/pg_dump/pg_backup_null.c
src/bin/pg_dump/pg_backup_tar.c
src/bin/pg_dump/pg_backup_tar.h
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h
src/bin/pg_dump/pg_dumpall.sh
src/bin/pg_dump/pg_restore.c
src/bin/pg_dump/ru.po
src/bin/pg_dump/sv.po
src/bin/pg_dump/zh_CN.po
src/bin/pg_dump/zh_TW.po
src/bin/pg_encoding/Makefile
src/bin/pg_encoding/pg_encoding.c
src/bin/pg_id/Makefile
src/bin/pg_id/pg_id.c
src/bin/pgaccess/Makefile
src/bin/pgaccess/README
src/bin/pgaccess/copyright.html
src/bin/pgaccess/demo/formdemo.sql
src/bin/pgaccess/doc/html/a_right.gif
src/bin/pgaccess/doc/html/addindex.gif
src/bin/pgaccess/doc/html/api.html
src/bin/pgaccess/doc/html/ball.gif
src/bin/pgaccess/doc/html/contents.html
src/bin/pgaccess/doc/html/copyright.html
src/bin/pgaccess/doc/html/documentation.html
src/bin/pgaccess/doc/html/download.html
src/bin/pgaccess/doc/html/faq.html
src/bin/pgaccess/doc/html/features.html
src/bin/pgaccess/doc/html/formdemo.sql
src/bin/pgaccess/doc/html/forms.gif
src/bin/pgaccess/doc/html/forms.html
src/bin/pgaccess/doc/html/function.gif
src/bin/pgaccess/doc/html/help.gif
src/bin/pgaccess/doc/html/index.html
src/bin/pgaccess/doc/html/irix.html
src/bin/pgaccess/doc/html/linux1.gif
src/bin/pgaccess/doc/html/maillist.html
src/bin/pgaccess/doc/html/main.html
src/bin/pgaccess/doc/html/mainwindow.gif
src/bin/pgaccess/doc/html/newtable.gif
src/bin/pgaccess/doc/html/newuser.gif
src/bin/pgaccess/doc/html/old_index.html
src/bin/pgaccess/doc/html/permissions.gif
src/bin/pgaccess/doc/html/pg93patch.html
src/bin/pgaccess/doc/html/pga-rad.html
src/bin/pgaccess/doc/html/qbtclet.html
src/bin/pgaccess/doc/html/qbtclet.tcl
src/bin/pgaccess/doc/html/screenshots.html
src/bin/pgaccess/doc/html/specialchars.html
src/bin/pgaccess/doc/html/todo.html
src/bin/pgaccess/doc/html/tutorial/addref.jpg
src/bin/pgaccess/doc/html/tutorial/altern_q.jpg
src/bin/pgaccess/doc/html/tutorial/altern_v.jpg
src/bin/pgaccess/doc/html/tutorial/copyright.html
src/bin/pgaccess/doc/html/tutorial/index.html
src/bin/pgaccess/doc/html/tutorial/intro.html
src/bin/pgaccess/doc/html/tutorial/irix.html
src/bin/pgaccess/doc/html/tutorial/newref.txt
src/bin/pgaccess/doc/html/tutorial/newtable.jpg
src/bin/pgaccess/doc/html/tutorial/newtable.tga
src/bin/pgaccess/doc/html/tutorial/problems.html
src/bin/pgaccess/doc/html/tutorial/screen1.jpg
src/bin/pgaccess/doc/html/tutorial/sel_tbl.jpg
src/bin/pgaccess/doc/html/tutorial/start.html
src/bin/pgaccess/doc/html/tutorial/tut.html
src/bin/pgaccess/doc/html/tutorial/tut_edit.html
src/bin/pgaccess/doc/html/tutorial/tut_new.html
src/bin/pgaccess/doc/html/tutorial/tut_sel1.html
src/bin/pgaccess/doc/html/tutorial/tut_user.html
src/bin/pgaccess/doc/html/vdesigner.gif
src/bin/pgaccess/doc/html/whatsnew.html
src/bin/pgaccess/doc/html/win32.html
src/bin/pgaccess/images/icon_button.gif
src/bin/pgaccess/images/icon_checkbutton.gif
src/bin/pgaccess/images/icon_entry.gif
src/bin/pgaccess/images/icon_frame.gif
src/bin/pgaccess/images/icon_label.gif
src/bin/pgaccess/images/icon_listbox.gif
src/bin/pgaccess/images/icon_query.gif
src/bin/pgaccess/images/icon_radiobutton.gif
src/bin/pgaccess/images/icon_text.gif
src/bin/pgaccess/lib/database.tcl
src/bin/pgaccess/lib/forms.tcl
src/bin/pgaccess/lib/functions.tcl
src/bin/pgaccess/lib/help/abort.hlp
src/bin/pgaccess/lib/help/add_records.hlp
src/bin/pgaccess/lib/help/alter_table.hlp
src/bin/pgaccess/lib/help/alter_user.hlp
src/bin/pgaccess/lib/help/author.hlp
src/bin/pgaccess/lib/help/begin.hlp
src/bin/pgaccess/lib/help/close.hlp
src/bin/pgaccess/lib/help/cluster.hlp
src/bin/pgaccess/lib/help/commit.hlp
src/bin/pgaccess/lib/help/copy.hlp
src/bin/pgaccess/lib/help/copyrights.hlp
src/bin/pgaccess/lib/help/create_aggregate.hlp
src/bin/pgaccess/lib/help/create_database.hlp
src/bin/pgaccess/lib/help/create_function.hlp
src/bin/pgaccess/lib/help/create_index.hlp
src/bin/pgaccess/lib/help/create_language.hlp
src/bin/pgaccess/lib/help/create_operator.hlp
src/bin/pgaccess/lib/help/create_rule.hlp
src/bin/pgaccess/lib/help/create_sequence.hlp
src/bin/pgaccess/lib/help/create_table.hlp
src/bin/pgaccess/lib/help/create_table_as.hlp
src/bin/pgaccess/lib/help/create_trigger.hlp
src/bin/pgaccess/lib/help/create_type.hlp
src/bin/pgaccess/lib/help/create_user.hlp
src/bin/pgaccess/lib/help/create_view.hlp
src/bin/pgaccess/lib/help/data_types.hlp
src/bin/pgaccess/lib/help/datefunc.hlp
src/bin/pgaccess/lib/help/declare.hlp
src/bin/pgaccess/lib/help/delete.hlp
src/bin/pgaccess/lib/help/drop_aggregate.hlp
src/bin/pgaccess/lib/help/drop_database.hlp
src/bin/pgaccess/lib/help/drop_function.hlp
src/bin/pgaccess/lib/help/drop_index.hlp
src/bin/pgaccess/lib/help/drop_language.hlp
src/bin/pgaccess/lib/help/drop_operator.hlp
src/bin/pgaccess/lib/help/drop_rule.hlp
src/bin/pgaccess/lib/help/drop_sequence.hlp
src/bin/pgaccess/lib/help/drop_table.hlp
src/bin/pgaccess/lib/help/drop_trigger.hlp
src/bin/pgaccess/lib/help/drop_type.hlp
src/bin/pgaccess/lib/help/drop_user.hlp
src/bin/pgaccess/lib/help/drop_view.hlp
src/bin/pgaccess/lib/help/explain.hlp
src/bin/pgaccess/lib/help/fetch.hlp
src/bin/pgaccess/lib/help/form_design.hlp
src/bin/pgaccess/lib/help/forms.hlp
src/bin/pgaccess/lib/help/functions.hlp
src/bin/pgaccess/lib/help/geomfunc.hlp
src/bin/pgaccess/lib/help/grant.hlp
src/bin/pgaccess/lib/help/history.hlp
src/bin/pgaccess/lib/help/index.hlp
src/bin/pgaccess/lib/help/inheritance.hlp
src/bin/pgaccess/lib/help/insert.hlp
src/bin/pgaccess/lib/help/ipv4func.hlp
src/bin/pgaccess/lib/help/isolation.hlp
src/bin/pgaccess/lib/help/keywords.hlp
src/bin/pgaccess/lib/help/listen.hlp
src/bin/pgaccess/lib/help/load.hlp
src/bin/pgaccess/lib/help/lock.hlp
src/bin/pgaccess/lib/help/mathfunc.hlp
src/bin/pgaccess/lib/help/move.hlp
src/bin/pgaccess/lib/help/mvcc.hlp
src/bin/pgaccess/lib/help/new_query.hlp
src/bin/pgaccess/lib/help/new_table.hlp
src/bin/pgaccess/lib/help/notify.hlp
src/bin/pgaccess/lib/help/open_query.hlp
src/bin/pgaccess/lib/help/open_table.hlp
src/bin/pgaccess/lib/help/pgfunctions.hlp
src/bin/pgaccess/lib/help/postgresql.hlp
src/bin/pgaccess/lib/help/queries.hlp
src/bin/pgaccess/lib/help/reports.hlp
src/bin/pgaccess/lib/help/reset.hlp
src/bin/pgaccess/lib/help/revoke.hlp
src/bin/pgaccess/lib/help/rollback.hlp
src/bin/pgaccess/lib/help/schema.hlp
src/bin/pgaccess/lib/help/scripts.hlp
src/bin/pgaccess/lib/help/select.hlp
src/bin/pgaccess/lib/help/select_into.hlp
src/bin/pgaccess/lib/help/sequences.hlp
src/bin/pgaccess/lib/help/set.hlp
src/bin/pgaccess/lib/help/show.hlp
src/bin/pgaccess/lib/help/sql_guide.hlp
src/bin/pgaccess/lib/help/sqlfunc.hlp
src/bin/pgaccess/lib/help/stringfunc.hlp
src/bin/pgaccess/lib/help/tables.hlp
src/bin/pgaccess/lib/help/unlisten.hlp
src/bin/pgaccess/lib/help/update.hlp
src/bin/pgaccess/lib/help/users.hlp
src/bin/pgaccess/lib/help/vacuum.hlp
src/bin/pgaccess/lib/help/view_table_structure.hlp
src/bin/pgaccess/lib/help/views.hlp
src/bin/pgaccess/lib/help/visual_designer.hlp
src/bin/pgaccess/lib/help/y2k.hlp
src/bin/pgaccess/lib/help.tcl
src/bin/pgaccess/lib/languages/chinese_big5
src/bin/pgaccess/lib/languages/chinese_gb
src/bin/pgaccess/lib/languages/czech
src/bin/pgaccess/lib/languages/deutsch
src/bin/pgaccess/lib/languages/euskara
src/bin/pgaccess/lib/languages/francais
src/bin/pgaccess/lib/languages/italiano
src/bin/pgaccess/lib/languages/japanese
src/bin/pgaccess/lib/languages/magyar
src/bin/pgaccess/lib/languages/nederlands
src/bin/pgaccess/lib/languages/portugues
src/bin/pgaccess/lib/languages/romana
src/bin/pgaccess/lib/languages/russian.koi8r
src/bin/pgaccess/lib/languages/russian_win
src/bin/pgaccess/lib/languages/spanish
src/bin/pgaccess/lib/mainlib.tcl
src/bin/pgaccess/lib/preferences.tcl
src/bin/pgaccess/lib/queries.tcl
src/bin/pgaccess/lib/reports.tcl
src/bin/pgaccess/lib/schema.tcl
src/bin/pgaccess/lib/scripts.tcl
src/bin/pgaccess/lib/sequences.tcl
src/bin/pgaccess/lib/tables.tcl
src/bin/pgaccess/lib/users.tcl
src/bin/pgaccess/lib/views.tcl
src/bin/pgaccess/lib/visualqb.tcl
src/bin/pgaccess/main.tcl
src/bin/pgaccess/pgaccess.sh
src/bin/pgtclsh/Makefile
src/bin/pgtclsh/README
src/bin/pgtclsh/pgtclAppInit.c
src/bin/pgtclsh/pgtclUtils.tcl
src/bin/pgtclsh/pgtkAppInit.c
src/bin/pgtclsh/updateStats.tcl
src/bin/psql/.cvsignore
src/bin/psql/Makefile
src/bin/psql/command.c
src/bin/psql/command.h
src/bin/psql/common.c
src/bin/psql/common.h
src/bin/psql/copy.c
src/bin/psql/copy.h
src/bin/psql/create_help.pl
src/bin/psql/cs.po
src/bin/psql/de.po
src/bin/psql/describe.c
src/bin/psql/describe.h
src/bin/psql/fr.po
src/bin/psql/help.c
src/bin/psql/help.h
src/bin/psql/input.c
src/bin/psql/input.h
src/bin/psql/large_obj.c
src/bin/psql/large_obj.h
src/bin/psql/mainloop.c
src/bin/psql/mainloop.h
src/bin/psql/mbprint.c
src/bin/psql/mbprint.h
src/bin/psql/nls.mk
src/bin/psql/print.c
src/bin/psql/print.h
src/bin/psql/prompt.c
src/bin/psql/prompt.h
src/bin/psql/ru.po
src/bin/psql/settings.h
src/bin/psql/startup.c
src/bin/psql/stringutils.c
src/bin/psql/stringutils.h
src/bin/psql/sv.po
src/bin/psql/tab-complete.c
src/bin/psql/tab-complete.h
src/bin/psql/variables.c
src/bin/psql/variables.h
src/bin/psql/win32.mak
src/bin/psql/zh_CN.po
src/bin/psql/zh_TW.po
src/bin/scripts/Makefile
src/bin/scripts/createdb
src/bin/scripts/createlang.sh
src/bin/scripts/createuser
src/bin/scripts/dropdb
src/bin/scripts/droplang
src/bin/scripts/dropuser
src/bin/scripts/vacuumdb
src/corba/CosQuery.idl
src/corba/CosQueryCollection.idl
src/corba/pgsql.idl
src/corba/pgsql_int.idl
src/corba/server.cc
src/data/charset.conf
src/data/isocz-wincz.tab
src/data/koi-alt.tab
src/data/koi-iso.tab
src/data/koi-koi.tab
src/data/koi-mac.tab
src/data/koi-win.tab
src/include/Makefile
src/include/access/attnum.h
src/include/access/clog.h
src/include/access/genam.h
src/include/access/gist.h
src/include/access/gistscan.h
src/include/access/hash.h
src/include/access/heapam.h
src/include/access/hio.h
src/include/access/htup.h
src/include/access/ibit.h
src/include/access/iqual.h
src/include/access/istrat.h
src/include/access/itup.h
src/include/access/nbtree.h
src/include/access/printtup.h
src/include/access/relscan.h
src/include/access/rmgr.h
src/include/access/rtree.h
src/include/access/rtscan.h
src/include/access/sdir.h
src/include/access/skey.h
src/include/access/strat.h
src/include/access/transam.h
src/include/access/tupdesc.h
src/include/access/tupmacs.h
src/include/access/tuptoaster.h
src/include/access/valid.h
src/include/access/xact.h
src/include/access/xlog.h
src/include/access/xlogdefs.h
src/include/access/xlogutils.h
src/include/bootstrap/bootstrap.h
src/include/c.h
src/include/catalog/catalog.h
src/include/catalog/catname.h
src/include/catalog/catversion.h
src/include/catalog/duplicate_oids
src/include/catalog/heap.h
src/include/catalog/index.h
src/include/catalog/indexing.h
src/include/catalog/namespace.h
src/include/catalog/pg_aggregate.h
src/include/catalog/pg_am.h
src/include/catalog/pg_amop.h
src/include/catalog/pg_amproc.h
src/include/catalog/pg_attrdef.h
src/include/catalog/pg_attribute.h
src/include/catalog/pg_class.h
src/include/catalog/pg_control.h
src/include/catalog/pg_database.h
src/include/catalog/pg_description.h
src/include/catalog/pg_group.h
src/include/catalog/pg_index.h
src/include/catalog/pg_inherits.h
src/include/catalog/pg_language.h
src/include/catalog/pg_largeobject.h
src/include/catalog/pg_listener.h
src/include/catalog/pg_namespace.h
src/include/catalog/pg_opclass.h
src/include/catalog/pg_operator.h
src/include/catalog/pg_proc.h
src/include/catalog/pg_relcheck.h
src/include/catalog/pg_rewrite.h
src/include/catalog/pg_shadow.h
src/include/catalog/pg_statistic.h
src/include/catalog/pg_trigger.h
src/include/catalog/pg_type.h
src/include/catalog/pg_version.h
src/include/catalog/unused_oids
src/include/commands/async.h
src/include/commands/cluster.h
src/include/commands/comment.h
src/include/commands/copy.h
src/include/commands/dbcommands.h
src/include/commands/defrem.h
src/include/commands/explain.h
src/include/commands/lockcmds.h
src/include/commands/portalcmds.h
src/include/commands/proclang.h
src/include/commands/schemacmds.h
src/include/commands/sequence.h
src/include/commands/tablecmds.h
src/include/commands/trigger.h
src/include/commands/user.h
src/include/commands/vacuum.h
src/include/commands/variable.h
src/include/commands/version.h
src/include/commands/view.h
src/include/executor/execdebug.h
src/include/executor/execdefs.h
src/include/executor/execdesc.h
src/include/executor/executor.h
src/include/executor/functions.h
src/include/executor/hashjoin.h
src/include/executor/instrument.h
src/include/executor/nodeAgg.h
src/include/executor/nodeAppend.h
src/include/executor/nodeFunctionscan.h
src/include/executor/nodeGroup.h
src/include/executor/nodeHash.h
src/include/executor/nodeHashjoin.h
src/include/executor/nodeIndexscan.h
src/include/executor/nodeLimit.h
src/include/executor/nodeMaterial.h
src/include/executor/nodeMergejoin.h
src/include/executor/nodeNestloop.h
src/include/executor/nodeResult.h
src/include/executor/nodeSeqscan.h
src/include/executor/nodeSetOp.h
src/include/executor/nodeSort.h
src/include/executor/nodeSubplan.h
src/include/executor/nodeSubqueryscan.h
src/include/executor/nodeTidscan.h
src/include/executor/nodeUnique.h
src/include/executor/spi.h
src/include/executor/spi_priv.h
src/include/executor/tuptable.h
src/include/fmgr.h
src/include/lib/dllist.h
src/include/lib/lispsort.h
src/include/lib/stringinfo.h
src/include/libpq/auth.h
src/include/libpq/be-fsstubs.h
src/include/libpq/crypt.h
src/include/libpq/hba.h
src/include/libpq/libpq-be.h
src/include/libpq/libpq-fs.h
src/include/libpq/libpq.h
src/include/libpq/password.h
src/include/libpq/pqcomm.h
src/include/libpq/pqformat.h
src/include/libpq/pqsignal.h
src/include/mb/pg_wchar.h
src/include/miscadmin.h
src/include/nodes/execnodes.h
src/include/nodes/makefuncs.h
src/include/nodes/memnodes.h
src/include/nodes/nodeFuncs.h
src/include/nodes/nodes.h
src/include/nodes/params.h
src/include/nodes/parsenodes.h
src/include/nodes/pg_list.h
src/include/nodes/plannodes.h
src/include/nodes/primnodes.h
src/include/nodes/print.h
src/include/nodes/readfuncs.h
src/include/nodes/relation.h
src/include/optimizer/_deadcode/xfunc.h
src/include/optimizer/clauses.h
src/include/optimizer/cost.h
src/include/optimizer/geqo.h
src/include/optimizer/geqo_copy.h
src/include/optimizer/geqo_gene.h
src/include/optimizer/geqo_misc.h
src/include/optimizer/geqo_mutation.h
src/include/optimizer/geqo_pool.h
src/include/optimizer/geqo_random.h
src/include/optimizer/geqo_recombination.h
src/include/optimizer/geqo_selection.h
src/include/optimizer/joininfo.h
src/include/optimizer/pathnode.h
src/include/optimizer/paths.h
src/include/optimizer/plancat.h
src/include/optimizer/planmain.h
src/include/optimizer/planner.h
src/include/optimizer/prep.h
src/include/optimizer/restrictinfo.h
src/include/optimizer/subselect.h
src/include/optimizer/tlist.h
src/include/optimizer/var.h
src/include/parser/analyze.h
src/include/parser/gramparse.h
src/include/parser/keywords.h
src/include/parser/parse_agg.h
src/include/parser/parse_clause.h
src/include/parser/parse_coerce.h
src/include/parser/parse_expr.h
src/include/parser/parse_func.h
src/include/parser/parse_node.h
src/include/parser/parse_oper.h
src/include/parser/parse_relation.h
src/include/parser/parse_target.h
src/include/parser/parse_type.h
src/include/parser/parser.h
src/include/parser/parsetree.h
src/include/parser/scansup.h
src/include/pg_config.h.in
src/include/pg_config.h.win32
src/include/pgstat.h
src/include/port/aix.h
src/include/port/beos.h
src/include/port/bsdi.h
src/include/port/darwin.h
src/include/port/dgux.h
src/include/port/freebsd.h
src/include/port/hpux.h
src/include/port/irix5.h
src/include/port/linux.h
src/include/port/netbsd.h
src/include/port/nextstep.h
src/include/port/openbsd.h
src/include/port/osf.h
src/include/port/qnx4.h
src/include/port/sco.h
src/include/port/solaris.h
src/include/port/sunos4.h
src/include/port/svr4.h
src/include/port/ultrix4.h
src/include/port/univel.h
src/include/port/unixware.h
src/include/port/win.h
src/include/port/win32.h
src/include/postgres.h
src/include/postgres_ext.h
src/include/postgres_fe.h
src/include/regex/cclass.h
src/include/regex/cname.h
src/include/regex/regex.h
src/include/regex/regex2.h
src/include/regex/utils.h
src/include/rewrite/prs2lock.h
src/include/rewrite/rewriteDefine.h
src/include/rewrite/rewriteHandler.h
src/include/rewrite/rewriteManip.h
src/include/rewrite/rewriteRemove.h
src/include/rewrite/rewriteSupport.h
src/include/rusagestub.h
src/include/storage/backendid.h
src/include/storage/block.h
src/include/storage/buf.h
src/include/storage/buf_internals.h
src/include/storage/buffile.h
src/include/storage/bufmgr.h
src/include/storage/bufpage.h
src/include/storage/fd.h
src/include/storage/freespace.h
src/include/storage/ipc.h
src/include/storage/item.h
src/include/storage/itemid.h
src/include/storage/itempos.h
src/include/storage/itemptr.h
src/include/storage/large_object.h
src/include/storage/lmgr.h
src/include/storage/lock.h
src/include/storage/lwlock.h
src/include/storage/off.h
src/include/storage/page.h
src/include/storage/pg_sema.h
src/include/storage/pg_shmem.h
src/include/storage/pmsignal.h
src/include/storage/pos.h
src/include/storage/proc.h
src/include/storage/relfilenode.h
src/include/storage/s_lock.h
src/include/storage/shmem.h
src/include/storage/sinval.h
src/include/storage/sinvaladt.h
src/include/storage/smgr.h
src/include/storage/spin.h
src/include/strdup.h
src/include/tcop/dest.h
src/include/tcop/fastpath.h
src/include/tcop/pquery.h
src/include/tcop/tcopdebug.h
src/include/tcop/tcopprot.h
src/include/tcop/utility.h
src/include/utils/acl.h
src/include/utils/array.h
src/include/utils/ascii.h
src/include/utils/bit.h
src/include/utils/builtins.h
src/include/utils/cash.h
src/include/utils/catcache.h
src/include/utils/date.h
src/include/utils/datetime.h
src/include/utils/datum.h
src/include/utils/dynahash.h
src/include/utils/dynamic_loader.h
src/include/utils/elog.h
src/include/utils/exc.h
src/include/utils/excid.h
src/include/utils/fcache.h
src/include/utils/fmgrtab.h
src/include/utils/formatting.h
src/include/utils/geo_decls.h
src/include/utils/guc.h
src/include/utils/hsearch.h
src/include/utils/inet.h
src/include/utils/int8.h
src/include/utils/inval.h
src/include/utils/logtape.h
src/include/utils/lsyscache.h
src/include/utils/memutils.h
src/include/utils/nabstime.h
src/include/utils/numeric.h
src/include/utils/palloc.h
src/include/utils/pg_crc.h
src/include/utils/pg_locale.h
src/include/utils/pg_lzcompress.h
src/include/utils/portal.h
src/include/utils/ps_status.h
src/include/utils/rel.h
src/include/utils/relcache.h
src/include/utils/selfuncs.h
src/include/utils/sets.h
src/include/utils/syscache.h
src/include/utils/timestamp.h
src/include/utils/tqual.h
src/include/utils/tuplesort.h
src/include/utils/tuplestore.h
src/include/utils/varbit.h
src/interfaces/Makefile
src/interfaces/cli/example1.c
src/interfaces/cli/example2.c
src/interfaces/cli/sqlcli.h
src/interfaces/jdbc/CHANGELOG
src/interfaces/jdbc/Implementation
src/interfaces/jdbc/Makefile
src/interfaces/jdbc/README
src/interfaces/jdbc/build.xml
src/interfaces/jdbc/example/ImageViewer.java
src/interfaces/jdbc/example/Unicode.java
src/interfaces/jdbc/example/basic.java
src/interfaces/jdbc/example/blobtest.java
src/interfaces/jdbc/example/corba/StockClient.java
src/interfaces/jdbc/example/corba/StockDB.java
src/interfaces/jdbc/example/corba/StockDispenserImpl.java
src/interfaces/jdbc/example/corba/StockItemImpl.java
src/interfaces/jdbc/example/corba/StockServer.java
src/interfaces/jdbc/example/corba/readme
src/interfaces/jdbc/example/corba/stock.idl
src/interfaces/jdbc/example/corba/stock.sql
src/interfaces/jdbc/example/datestyle.java
src/interfaces/jdbc/example/metadata.java
src/interfaces/jdbc/example/psql.java
src/interfaces/jdbc/example/threadsafe.java
src/interfaces/jdbc/jdbc.jpx
src/interfaces/jdbc/org/postgresql/Connection.java
src/interfaces/jdbc/org/postgresql/Driver.java.in
src/interfaces/jdbc/org/postgresql/Field.java
src/interfaces/jdbc/org/postgresql/PG_Stream.java
src/interfaces/jdbc/org/postgresql/PostgresqlDataSource.java
src/interfaces/jdbc/org/postgresql/ResultSet.java
src/interfaces/jdbc/org/postgresql/Statement.java
src/interfaces/jdbc/org/postgresql/core/BytePoolDim1.java
src/interfaces/jdbc/org/postgresql/core/BytePoolDim2.java
src/interfaces/jdbc/org/postgresql/core/Encoding.java
src/interfaces/jdbc/org/postgresql/core/MemoryPool.java
src/interfaces/jdbc/org/postgresql/core/ObjectPool.java
src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java
src/interfaces/jdbc/org/postgresql/core/SimpleObjectPool.java
src/interfaces/jdbc/org/postgresql/core/StartupPacket.java
src/interfaces/jdbc/org/postgresql/errors.properties
src/interfaces/jdbc/org/postgresql/errors_de.properties
src/interfaces/jdbc/org/postgresql/errors_fr.properties
src/interfaces/jdbc/org/postgresql/errors_it.properties
src/interfaces/jdbc/org/postgresql/errors_nl.properties
src/interfaces/jdbc/org/postgresql/errors_zh_TW.properties
src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java
src/interfaces/jdbc/org/postgresql/fastpath/FastpathArg.java
src/interfaces/jdbc/org/postgresql/geometric/PGbox.java
src/interfaces/jdbc/org/postgresql/geometric/PGcircle.java
src/interfaces/jdbc/org/postgresql/geometric/PGline.java
src/interfaces/jdbc/org/postgresql/geometric/PGlseg.java
src/interfaces/jdbc/org/postgresql/geometric/PGpath.java
src/interfaces/jdbc/org/postgresql/geometric/PGpoint.java
src/interfaces/jdbc/org/postgresql/geometric/PGpolygon.java
src/interfaces/jdbc/org/postgresql/jdbc1/CallableStatement.java
src/interfaces/jdbc/org/postgresql/jdbc1/Connection.java
src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java
src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java
src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java
src/interfaces/jdbc/org/postgresql/jdbc1/ResultSetMetaData.java
src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java
src/interfaces/jdbc/org/postgresql/jdbc2/Array.java
src/interfaces/jdbc/org/postgresql/jdbc2/CallableStatement.java
src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java
src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java
src/interfaces/jdbc/org/postgresql/jdbc2/PBatchUpdateException.java
src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java
src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java
src/interfaces/jdbc/org/postgresql/jdbc2/ResultSetMetaData.java
src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java
src/interfaces/jdbc/org/postgresql/jdbc2/UpdateableResultSet.java
src/interfaces/jdbc/org/postgresql/largeobject/BlobInputStream.java
src/interfaces/jdbc/org/postgresql/largeobject/BlobOutputStream.java
src/interfaces/jdbc/org/postgresql/largeobject/LargeObject.java
src/interfaces/jdbc/org/postgresql/largeobject/LargeObjectManager.java
src/interfaces/jdbc/org/postgresql/largeobject/PGblob.java
src/interfaces/jdbc/org/postgresql/largeobject/PGclob.java
src/interfaces/jdbc/org/postgresql/test/JDBC2Tests.java
src/interfaces/jdbc/org/postgresql/test/README
src/interfaces/jdbc/org/postgresql/test/jdbc2/ANTTest.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/BatchExecuteTest.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/BlobTest.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/ConnectionTest.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/DateTest.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/DriverTest.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/EncodingTest.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/JBuilderTest.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/MiscTest.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/ResultSetTest.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/TimeTest.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/TimestampTest.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java
src/interfaces/jdbc/org/postgresql/util/MD5Digest.java
src/interfaces/jdbc/org/postgresql/util/MessageTranslator.java
src/interfaces/jdbc/org/postgresql/util/PGbytea.java
src/interfaces/jdbc/org/postgresql/util/PGmoney.java
src/interfaces/jdbc/org/postgresql/util/PGobject.java
src/interfaces/jdbc/org/postgresql/util/PGtokenizer.java
src/interfaces/jdbc/org/postgresql/util/PSQLException.java
src/interfaces/jdbc/org/postgresql/util/Serialize.java
src/interfaces/jdbc/org/postgresql/util/UnixCrypt.java
src/interfaces/jdbc/org/postgresql/xa/ClientConnection.java
src/interfaces/jdbc/org/postgresql/xa/TwoPhaseConnection.java
src/interfaces/jdbc/org/postgresql/xa/TxConnection.java
src/interfaces/jdbc/org/postgresql/xa/XAConnectionImpl.java
src/interfaces/jdbc/org/postgresql/xa/XADataSourceImpl.java
src/interfaces/jdbc/utils/CheckVersion.java
src/interfaces/jdbc/utils/buildDriver
src/interfaces/jdbc/utils/changelog.pl
src/interfaces/libpgeasy/Makefile
src/interfaces/libpgeasy/README
src/interfaces/libpgeasy/examples/Makefile
src/interfaces/libpgeasy/examples/pginsert.c
src/interfaces/libpgeasy/examples/pgmultiresult.c
src/interfaces/libpgeasy/examples/pgnulltest.c
src/interfaces/libpgeasy/examples/pgwordcount.c
src/interfaces/libpgeasy/halt.c
src/interfaces/libpgeasy/halt.h
src/interfaces/libpgeasy/libpgeasy.c
src/interfaces/libpgeasy/libpgeasy.h
src/interfaces/libpgtcl/Makefile
src/interfaces/libpgtcl/README
src/interfaces/libpgtcl/libpgtcl.def
src/interfaces/libpgtcl/libpgtcl.h
src/interfaces/libpgtcl/pgtcl.c
src/interfaces/libpgtcl/pgtclCmds.c
src/interfaces/libpgtcl/pgtclCmds.h
src/interfaces/libpgtcl/pgtclId.c
src/interfaces/libpgtcl/pgtclId.h
src/interfaces/libpgtcl/win32.mak
src/interfaces/libpq/Makefile
src/interfaces/libpq/README
src/interfaces/libpq/cs.po
src/interfaces/libpq/de.po
src/interfaces/libpq/fe-auth.c
src/interfaces/libpq/fe-auth.h
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/fe-lobj.c
src/interfaces/libpq/fe-misc.c
src/interfaces/libpq/fe-print.c
src/interfaces/libpq/fe-secure.c
src/interfaces/libpq/fr.po
src/interfaces/libpq/libpq-fe.h
src/interfaces/libpq/libpq-int.h
src/interfaces/libpq/libpq.rc
src/interfaces/libpq/libpqdll.c
src/interfaces/libpq/libpqdll.def
src/interfaces/libpq/nls.mk
src/interfaces/libpq/pqexpbuffer.c
src/interfaces/libpq/pqexpbuffer.h
src/interfaces/libpq/pqsignal.c
src/interfaces/libpq/pqsignal.h
src/interfaces/libpq/ru.po
src/interfaces/libpq/sv.po
src/interfaces/libpq/win32.c
src/interfaces/libpq/win32.h
src/interfaces/libpq/win32.mak
src/interfaces/libpq/zh_CN.po
src/interfaces/libpq/zh_TW.po
src/interfaces/libpq++/CHANGES
src/interfaces/libpq++/Makefile
src/interfaces/libpq++/README
src/interfaces/libpq++/TODO
src/interfaces/libpq++/examples/Makefile
src/interfaces/libpq++/examples/testlibpq0.cc
src/interfaces/libpq++/examples/testlibpq1.cc
src/interfaces/libpq++/examples/testlibpq2.cc
src/interfaces/libpq++/examples/testlibpq2.sql
src/interfaces/libpq++/examples/testlibpq3.cc
src/interfaces/libpq++/examples/testlibpq3.sql
src/interfaces/libpq++/examples/testlibpq4.cc
src/interfaces/libpq++/examples/testlibpq4.sql
src/interfaces/libpq++/examples/testlibpq5.cc
src/interfaces/libpq++/examples/testlibpq5.sql
src/interfaces/libpq++/examples/testlibpq6.cc
src/interfaces/libpq++/examples/testlo.cc
src/interfaces/libpq++/libpq++.h
src/interfaces/libpq++/libpq++dll.rc
src/interfaces/libpq++/pgconnection.cc
src/interfaces/libpq++/pgconnection.h
src/interfaces/libpq++/pgcursordb.cc
src/interfaces/libpq++/pgcursordb.h
src/interfaces/libpq++/pgdatabase.cc
src/interfaces/libpq++/pgdatabase.h
src/interfaces/libpq++/pglobject.cc
src/interfaces/libpq++/pglobject.h
src/interfaces/libpq++/pgtransdb.cc
src/interfaces/libpq++/pgtransdb.h
src/interfaces/libpq++/win32.mak
src/interfaces/odbc/GNUmakefile
src/interfaces/odbc/bind.c
src/interfaces/odbc/bind.h
src/interfaces/odbc/columninfo.c
src/interfaces/odbc/columninfo.h
src/interfaces/odbc/connection.c
src/interfaces/odbc/connection.h
src/interfaces/odbc/convert.c
src/interfaces/odbc/convert.h
src/interfaces/odbc/descriptor.h
src/interfaces/odbc/dlg_specific.c
src/interfaces/odbc/dlg_specific.h
src/interfaces/odbc/dlg_wingui.c
src/interfaces/odbc/drvconn.c
src/interfaces/odbc/environ.c
src/interfaces/odbc/environ.h
src/interfaces/odbc/execute.c
src/interfaces/odbc/gpps.c
src/interfaces/odbc/gpps.h
src/interfaces/odbc/info.c
src/interfaces/odbc/info30.c
src/interfaces/odbc/iodbc.h
src/interfaces/odbc/isql.h
src/interfaces/odbc/isqlext.h
src/interfaces/odbc/license.txt
src/interfaces/odbc/lobj.c
src/interfaces/odbc/lobj.h
src/interfaces/odbc/md5.c
src/interfaces/odbc/md5.h
src/interfaces/odbc/misc.c
src/interfaces/odbc/misc.h
src/interfaces/odbc/multibyte.c
src/interfaces/odbc/multibyte.h
src/interfaces/odbc/notice.txt
src/interfaces/odbc/odbc.sql
src/interfaces/odbc/odbcapi.c
src/interfaces/odbc/odbcapi25w.c
src/interfaces/odbc/odbcapi30.c
src/interfaces/odbc/odbcapi30w.c
src/interfaces/odbc/odbcapiw.c
src/interfaces/odbc/odbcinst.ini
src/interfaces/odbc/options.c
src/interfaces/odbc/parse.c
src/interfaces/odbc/pgapi30.c
src/interfaces/odbc/pgapifunc.h
src/interfaces/odbc/pgtypes.c
src/interfaces/odbc/pgtypes.h
src/interfaces/odbc/psqlodbc.c
src/interfaces/odbc/psqlodbc.h
src/interfaces/odbc/psqlodbc.rc
src/interfaces/odbc/psqlodbc.reg
src/interfaces/odbc/psqlodbc30.reg
src/interfaces/odbc/psqlodbc30w.reg
src/interfaces/odbc/psqlodbc_api30.def
src/interfaces/odbc/psqlodbc_api30w.def
src/interfaces/odbc/psqlodbc_apiw.def
src/interfaces/odbc/psqlodbc_win32.def
src/interfaces/odbc/qresult.c
src/interfaces/odbc/qresult.h
src/interfaces/odbc/readme.txt
src/interfaces/odbc/resource.h
src/interfaces/odbc/results.c
src/interfaces/odbc/setup.c
src/interfaces/odbc/setup.rul
src/interfaces/odbc/socket.c
src/interfaces/odbc/socket.h
src/interfaces/odbc/statement.c
src/interfaces/odbc/statement.h
src/interfaces/odbc/tuple.c
src/interfaces/odbc/tuple.h
src/interfaces/odbc/tuplelist.c
src/interfaces/odbc/tuplelist.h
src/interfaces/odbc/version.h
src/interfaces/odbc/win32.mak
src/interfaces/odbc/win32_30.mak
src/interfaces/odbc/win32_30w.mak
src/interfaces/odbc/win32w.mak
src/interfaces/odbc/win_md5.c
src/interfaces/odbc/win_setup.h
src/interfaces/odbc/win_unicode.c
src/interfaces/perl5/Changes
src/interfaces/perl5/GNUmakefile
src/interfaces/perl5/MANIFEST
src/interfaces/perl5/Makefile.PL
src/interfaces/perl5/Pg.pm
src/interfaces/perl5/Pg.xs
src/interfaces/perl5/README
src/interfaces/perl5/examples/ApachePg.pl
src/interfaces/perl5/examples/example.newstyle
src/interfaces/perl5/examples/example.oldstyle
src/interfaces/perl5/ppport.h
src/interfaces/perl5/test.pl
src/interfaces/perl5/typemap
src/interfaces/python/Announce
src/interfaces/python/ChangeLog
src/interfaces/python/GNUmakefile
src/interfaces/python/PyGreSQL.spec
src/interfaces/python/README
src/interfaces/python/README.linux
src/interfaces/python/Setup.in.raw
src/interfaces/python/pg.py
src/interfaces/python/pgdb.py
src/interfaces/python/pgmodule.c
src/interfaces/python/setup.py
src/interfaces/python/tutorial/advanced.py
src/interfaces/python/tutorial/basics.py
src/interfaces/python/tutorial/func.py
src/interfaces/python/tutorial/syscat.py
src/interfaces/ssl/client.conf
src/interfaces/ssl/mkcert.sh
src/interfaces/ssl/pgkeygen.sh
src/interfaces/ssl/root.conf
src/interfaces/ssl/server.conf
src/makefiles/Makefile.aix
src/makefiles/Makefile.beos
src/makefiles/Makefile.bsdi
src/makefiles/Makefile.darwin
src/makefiles/Makefile.dgux
src/makefiles/Makefile.freebsd
src/makefiles/Makefile.hpux
src/makefiles/Makefile.irix5
src/makefiles/Makefile.linux
src/makefiles/Makefile.netbsd
src/makefiles/Makefile.openbsd
src/makefiles/Makefile.osf
src/makefiles/Makefile.qnx4
src/makefiles/Makefile.sco
src/makefiles/Makefile.solaris
src/makefiles/Makefile.sunos4
src/makefiles/Makefile.svr4
src/makefiles/Makefile.ultrix4
src/makefiles/Makefile.univel
src/makefiles/Makefile.unixware
src/makefiles/Makefile.win
src/nls-global.mk
src/pl/Makefile
src/pl/plperl/GNUmakefile
src/pl/plperl/README
src/pl/plperl/SPI.xs
src/pl/plperl/eloglvl.c
src/pl/plperl/eloglvl.h
src/pl/plperl/plperl.c
src/pl/plperl/ppport.h
src/pl/plpgsql/Makefile
src/pl/plpgsql/src/.cvsignore
src/pl/plpgsql/src/INSTALL
src/pl/plpgsql/src/Makefile
src/pl/plpgsql/src/gram.y
src/pl/plpgsql/src/pl_comp.c
src/pl/plpgsql/src/pl_exec.c
src/pl/plpgsql/src/pl_funcs.c
src/pl/plpgsql/src/pl_handler.c
src/pl/plpgsql/src/plpgsql.h
src/pl/plpgsql/src/scan.l
src/pl/plpgsql/test/README
src/pl/plpgsql/test/expected/tables.out
src/pl/plpgsql/test/expected/test.out
src/pl/plpgsql/test/expected/triggers.out
src/pl/plpgsql/test/expected/views.out
src/pl/plpgsql/test/runtest
src/pl/plpgsql/test/tables.sql
src/pl/plpgsql/test/test.sql
src/pl/plpgsql/test/triggers.sql
src/pl/plpgsql/test/views.sql
src/pl/plpython/Makefile
src/pl/plpython/README
src/pl/plpython/TODO
src/pl/plpython/error.expected
src/pl/plpython/feature.expected
src/pl/plpython/plpython.c
src/pl/plpython/plpython.h
src/pl/plpython/plpython_depopulate.sql
src/pl/plpython/plpython_deschema.sql
src/pl/plpython/plpython_drop.sql
src/pl/plpython/plpython_error.sql
src/pl/plpython/plpython_function.sql
src/pl/plpython/plpython_populate.sql
src/pl/plpython/plpython_schema.sql
src/pl/plpython/plpython_setof.sql
src/pl/plpython/plpython_test.sql
src/pl/plpython/test.sh
src/pl/tcl/Makefile
src/pl/tcl/license.terms
src/pl/tcl/modules/Makefile
src/pl/tcl/modules/README
src/pl/tcl/modules/pltcl_delmod.in
src/pl/tcl/modules/pltcl_listmod.in
src/pl/tcl/modules/pltcl_loadmod.in
src/pl/tcl/modules/unknown.pltcl
src/pl/tcl/pltcl.c
src/pl/tcl/test/README
src/pl/tcl/test/runtest
src/pl/tcl/test/test.expected
src/pl/tcl/test/test_queries.sql
src/pl/tcl/test/test_setup.sql
src/template/aix
src/template/beos
src/template/bsdi
src/template/darwin
src/template/dgux
src/template/freebsd
src/template/hpux
src/template/irix5
src/template/linux
src/template/netbsd
src/template/nextstep
src/template/openbsd
src/template/osf
src/template/qnx4
src/template/sco
src/template/solaris
src/template/sunos4
src/template/svr4
src/template/ultrix4
src/template/univel
src/template/unixware
src/template/win
src/test/Makefile
src/test/bench/Makefile
src/test/bench/WISC-README
src/test/bench/create.sh
src/test/bench/create.source
src/test/bench/perquery
src/test/bench/query01
src/test/bench/query02
src/test/bench/query03
src/test/bench/query04
src/test/bench/query05
src/test/bench/query06
src/test/bench/query07
src/test/bench/query08
src/test/bench/query09
src/test/bench/query10
src/test/bench/query11
src/test/bench/query12
src/test/bench/query13
src/test/bench/query14
src/test/bench/query15
src/test/bench/query16
src/test/bench/query17
src/test/bench/query18
src/test/bench/query19
src/test/bench/query20
src/test/bench/query21
src/test/bench/query22
src/test/bench/query23
src/test/bench/query24
src/test/bench/query25
src/test/bench/query26
src/test/bench/query27
src/test/bench/query28
src/test/bench/query29
src/test/bench/query30
src/test/bench/query31
src/test/bench/query32
src/test/bench/runwisc.sh
src/test/bench/wholebench.sh
src/test/examples/Makefile
src/test/examples/testlibpq.c
src/test/examples/testlibpq2.c
src/test/examples/testlibpq2.sql
src/test/examples/testlibpq3.c
src/test/examples/testlibpq3.sql
src/test/examples/testlibpq4.c
src/test/examples/testlo.c
src/test/locale/Makefile
src/test/locale/README
src/test/locale/de_DE.ISO8859-1/Makefile
src/test/locale/de_DE.ISO8859-1/README
src/test/locale/de_DE.ISO8859-1/expected/de-ctype.out
src/test/locale/de_DE.ISO8859-1/expected/test-de-char.sql.out
src/test/locale/de_DE.ISO8859-1/expected/test-de-select.sql.out
src/test/locale/de_DE.ISO8859-1/expected/test-de-sort.out
src/test/locale/de_DE.ISO8859-1/expected/test-de-text.sql.out
src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-char.sql.out
src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-text.sql.out
src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-varchar.sql.out
src/test/locale/de_DE.ISO8859-1/expected/test-de-varchar.sql.out
src/test/locale/de_DE.ISO8859-1/runall
src/test/locale/de_DE.ISO8859-1/test-de-select.sql.in
src/test/locale/de_DE.ISO8859-1/test-de-sort.in
src/test/locale/de_DE.ISO8859-1/test-de-upper.sql.in
src/test/locale/de_DE.ISO8859-1/test-de.sql.in
src/test/locale/gr_GR.ISO8859-7/Makefile
src/test/locale/gr_GR.ISO8859-7/README
src/test/locale/gr_GR.ISO8859-7/expected/gr-ctype.out
src/test/locale/gr_GR.ISO8859-7/expected/test-gr-char.sql.out
src/test/locale/gr_GR.ISO8859-7/expected/test-gr-select.sql.out
src/test/locale/gr_GR.ISO8859-7/expected/test-gr-sort.out
src/test/locale/gr_GR.ISO8859-7/expected/test-gr-text.sql.out
src/test/locale/gr_GR.ISO8859-7/expected/test-gr-varchar.sql.out
src/test/locale/gr_GR.ISO8859-7/runall
src/test/locale/gr_GR.ISO8859-7/test-gr-select.sql.in
src/test/locale/gr_GR.ISO8859-7/test-gr-sort.in
src/test/locale/gr_GR.ISO8859-7/test-gr.sql.in
src/test/locale/koi8-r/Makefile
src/test/locale/koi8-r/expected/koi8-ctype.out
src/test/locale/koi8-r/expected/test-koi8-char.sql.out
src/test/locale/koi8-r/expected/test-koi8-select.sql.out
src/test/locale/koi8-r/expected/test-koi8-sort.out
src/test/locale/koi8-r/expected/test-koi8-text.sql.out
src/test/locale/koi8-r/expected/test-koi8-varchar.sql.out
src/test/locale/koi8-r/runall
src/test/locale/koi8-r/test-koi8-select.sql.in
src/test/locale/koi8-r/test-koi8-sort.in
src/test/locale/koi8-r/test-koi8.sql.in
src/test/locale/koi8-to-win1251/Makefile
src/test/locale/koi8-to-win1251/README
src/test/locale/koi8-to-win1251/expected/test-koi8-char.sql.out
src/test/locale/koi8-to-win1251/expected/test-koi8-select.sql.out
src/test/locale/koi8-to-win1251/expected/test-koi8-sort.out
src/test/locale/koi8-to-win1251/expected/test-koi8-text.sql.out
src/test/locale/koi8-to-win1251/expected/test-koi8-varchar.sql.out
src/test/locale/koi8-to-win1251/runall
src/test/locale/koi8-to-win1251/test-koi8-select.sql.in
src/test/locale/koi8-to-win1251/test-koi8-sort.in
src/test/locale/koi8-to-win1251/test-koi8.sql.in
src/test/locale/sort-test.pl
src/test/locale/sort-test.py
src/test/locale/test-ctype.c
src/test/locale/test-pgsql-locale.c
src/test/mb/README
src/test/mb/expected/big5.out
src/test/mb/expected/euc_cn.out
src/test/mb/expected/euc_jp.out
src/test/mb/expected/euc_kr.out
src/test/mb/expected/euc_tw.out
src/test/mb/expected/mule_internal.out
src/test/mb/expected/sjis.out
src/test/mb/expected/unicode.out
src/test/mb/mbregress.sh
src/test/mb/sql/big5.sql
src/test/mb/sql/euc_cn.sql
src/test/mb/sql/euc_jp.sql
src/test/mb/sql/euc_kr.sql
src/test/mb/sql/euc_tw.sql
src/test/mb/sql/mule_internal.sql
src/test/mb/sql/sjis.sql
src/test/mb/sql/unicode.sql
src/test/performance/results/PgSQL.970926
src/test/performance/runtests.pl
src/test/performance/sqls/connection
src/test/performance/sqls/crtsimple
src/test/performance/sqls/crtsimpleidx
src/test/performance/sqls/drpsimple
src/test/performance/sqls/inssimple
src/test/performance/sqls/inssimple.data
src/test/performance/sqls/orbsimple
src/test/performance/sqls/slcsimple
src/test/performance/sqls/slcsimple.data
src/test/performance/sqls/vacuum
src/test/performance/start-pgsql.sh
src/test/regress/GNUmakefile
src/test/regress/Makefile
src/test/regress/README
src/test/regress/data/agg.data
src/test/regress/data/constrf.data
src/test/regress/data/constro.data
src/test/regress/data/dept.data
src/test/regress/data/desc.data
src/test/regress/data/emp.data
src/test/regress/data/hash.data
src/test/regress/data/onek.data
src/test/regress/data/person.data
src/test/regress/data/real_city.data
src/test/regress/data/rect.data
src/test/regress/data/streets.data
src/test/regress/data/stud_emp.data
src/test/regress/data/student.data
src/test/regress/data/tenk.data
src/test/regress/expected/abstime-solaris-1947.out
src/test/regress/expected/abstime.out
src/test/regress/expected/aggregates.out
src/test/regress/expected/alter_table.out
src/test/regress/expected/arrays.out
src/test/regress/expected/bit.out
src/test/regress/expected/boolean.out
src/test/regress/expected/box.out
src/test/regress/expected/btree_index.out
src/test/regress/expected/case.out
src/test/regress/expected/char.out
src/test/regress/expected/char_1.out
src/test/regress/expected/circle.out
src/test/regress/expected/comments.out
src/test/regress/expected/create_aggregate.out
src/test/regress/expected/create_index.out
src/test/regress/expected/create_misc.out
src/test/regress/expected/create_operator.out
src/test/regress/expected/create_table.out
src/test/regress/expected/create_type.out
src/test/regress/expected/create_view.out
src/test/regress/expected/date.out
src/test/regress/expected/domain.out
src/test/regress/expected/errors.out
src/test/regress/expected/euc_cn.out
src/test/regress/expected/euc_jp.out
src/test/regress/expected/euc_kr.out
src/test/regress/expected/euc_tw.out
src/test/regress/expected/float4-exp-three-digits.out
src/test/regress/expected/float4.out
src/test/regress/expected/float8-exp-three-digits.out
src/test/regress/expected/float8-fp-exception.out
src/test/regress/expected/float8-small-is-zero.out
src/test/regress/expected/float8.out
src/test/regress/expected/foreign_key.out
src/test/regress/expected/geometry-alpha-precision.out
src/test/regress/expected/geometry-bsdi-precision.out
src/test/regress/expected/geometry-i86-gnulibc.out
src/test/regress/expected/geometry-intel-beos.out
src/test/regress/expected/geometry-irix.out
src/test/regress/expected/geometry-positive-zeros-bsd.out
src/test/regress/expected/geometry-positive-zeros.out
src/test/regress/expected/geometry-powerpc-aix4.out
src/test/regress/expected/geometry-powerpc-darwin.out
src/test/regress/expected/geometry-powerpc-linux-gnulibc1.out
src/test/regress/expected/geometry-solaris-i386-pc.out
src/test/regress/expected/geometry-solaris-precision.out
src/test/regress/expected/geometry-uw7-cc.out
src/test/regress/expected/geometry-uw7-gcc.out
src/test/regress/expected/geometry.out
src/test/regress/expected/hash_index.out
src/test/regress/expected/horology-no-DST-before-1970.out
src/test/regress/expected/horology-solaris-1947.out
src/test/regress/expected/horology.out
src/test/regress/expected/inet.out
src/test/regress/expected/inherit.out
src/test/regress/expected/insert.out
src/test/regress/expected/int2.out
src/test/regress/expected/int4.out
src/test/regress/expected/int8-exp-three-digits.out
src/test/regress/expected/int8.out
src/test/regress/expected/interval.out
src/test/regress/expected/join.out
src/test/regress/expected/limit.out
src/test/regress/expected/lseg.out
src/test/regress/expected/mule_internal.out
src/test/regress/expected/name.out
src/test/regress/expected/numeric.out
src/test/regress/expected/numeric_big.out
src/test/regress/expected/numerology.out
src/test/regress/expected/oid.out
src/test/regress/expected/oidjoins.out
src/test/regress/expected/opr_sanity.out
src/test/regress/expected/path.out
src/test/regress/expected/plpgsql.out
src/test/regress/expected/point.out
src/test/regress/expected/polygon.out
src/test/regress/expected/portals.out
src/test/regress/expected/portals_p2.out
src/test/regress/expected/privileges.out
src/test/regress/expected/random.out
src/test/regress/expected/reltime.out
src/test/regress/expected/rules.out
src/test/regress/expected/sanity_check.out
src/test/regress/expected/select.out
src/test/regress/expected/select_distinct.out
src/test/regress/expected/select_distinct_on.out
src/test/regress/expected/select_having.out
src/test/regress/expected/select_having_1.out
src/test/regress/expected/select_implicit.out
src/test/regress/expected/select_implicit_1.out
src/test/regress/expected/select_into.out
src/test/regress/expected/select_views.out
src/test/regress/expected/select_views_1.out
src/test/regress/expected/sql_ascii.out
src/test/regress/expected/strings.out
src/test/regress/expected/subselect.out
src/test/regress/expected/temp.out
src/test/regress/expected/text.out
src/test/regress/expected/time.out
src/test/regress/expected/timestamp.out
src/test/regress/expected/timestamptz.out
src/test/regress/expected/timetz.out
src/test/regress/expected/tinterval-solaris-1947.out
src/test/regress/expected/tinterval.out
src/test/regress/expected/transactions.out
src/test/regress/expected/triggers.out
src/test/regress/expected/type_sanity.out
src/test/regress/expected/union.out
src/test/regress/expected/varchar.out
src/test/regress/expected/varchar_1.out
src/test/regress/input/constraints.source
src/test/regress/input/copy.source
src/test/regress/input/create_function_1.source
src/test/regress/input/create_function_2.source
src/test/regress/input/misc.source
src/test/regress/output/constraints.source
src/test/regress/output/copy.source
src/test/regress/output/create_function_1.source
src/test/regress/output/create_function_2.source
src/test/regress/output/misc.source
src/test/regress/parallel_schedule
src/test/regress/pg_regress.sh
src/test/regress/regress.c
src/test/regress/regressplans.sh
src/test/regress/resultmap
src/test/regress/serial_schedule
src/test/regress/sql/abstime.sql
src/test/regress/sql/aggregates.sql
src/test/regress/sql/alter_table.sql
src/test/regress/sql/arrays.sql
src/test/regress/sql/bit.sql
src/test/regress/sql/boolean.sql
src/test/regress/sql/box.sql
src/test/regress/sql/btree_index.sql
src/test/regress/sql/case.sql
src/test/regress/sql/char.sql
src/test/regress/sql/circle.sql
src/test/regress/sql/comments.sql
src/test/regress/sql/create_aggregate.sql
src/test/regress/sql/create_index.sql
src/test/regress/sql/create_misc.sql
src/test/regress/sql/create_operator.sql
src/test/regress/sql/create_table.sql
src/test/regress/sql/create_type.sql
src/test/regress/sql/create_view.sql
src/test/regress/sql/date.sql
src/test/regress/sql/domain.sql
src/test/regress/sql/drop.sql
src/test/regress/sql/errors.sql
src/test/regress/sql/euc_cn.sql
src/test/regress/sql/euc_jp.sql
src/test/regress/sql/euc_kr.sql
src/test/regress/sql/euc_tw.sql
src/test/regress/sql/float4.sql
src/test/regress/sql/float8.sql
src/test/regress/sql/foreign_key.sql
src/test/regress/sql/geometry.sql
src/test/regress/sql/hash_index.sql
src/test/regress/sql/horology.sql
src/test/regress/sql/inet.sql
src/test/regress/sql/inherit.sql
src/test/regress/sql/insert.sql
src/test/regress/sql/int2.sql
src/test/regress/sql/int4.sql
src/test/regress/sql/int8.sql
src/test/regress/sql/interval.sql
src/test/regress/sql/join.sql
src/test/regress/sql/limit.sql
src/test/regress/sql/lseg.sql
src/test/regress/sql/mule_internal.sql
src/test/regress/sql/name.sql
src/test/regress/sql/numeric.sql
src/test/regress/sql/numeric_big.sql
src/test/regress/sql/numerology.sql
src/test/regress/sql/oid.sql
src/test/regress/sql/oidjoins.sql
src/test/regress/sql/opr_sanity.sql
src/test/regress/sql/path.sql
src/test/regress/sql/plpgsql.sql
src/test/regress/sql/point.sql
src/test/regress/sql/polygon.sql
src/test/regress/sql/portals.sql
src/test/regress/sql/portals_p2.sql
src/test/regress/sql/privileges.sql
src/test/regress/sql/random.sql
src/test/regress/sql/reltime.sql
src/test/regress/sql/rules.sql
src/test/regress/sql/sanity_check.sql
src/test/regress/sql/select.sql
src/test/regress/sql/select_distinct.sql
src/test/regress/sql/select_distinct_on.sql
src/test/regress/sql/select_having.sql
src/test/regress/sql/select_implicit.sql
src/test/regress/sql/select_into.sql
src/test/regress/sql/select_views.sql
src/test/regress/sql/sql_ascii.sql
src/test/regress/sql/strings.sql
src/test/regress/sql/subselect.sql
src/test/regress/sql/temp.sql
src/test/regress/sql/text.sql
src/test/regress/sql/time.sql
src/test/regress/sql/timestamp.sql
src/test/regress/sql/timestamptz.sql
src/test/regress/sql/timetz.sql
src/test/regress/sql/tinterval.sql
src/test/regress/sql/transactions.sql
src/test/regress/sql/triggers.sql
src/test/regress/sql/type_sanity.sql
src/test/regress/sql/union.sql
src/test/regress/sql/varchar.sql
src/tools/RELEASE_CHANGES
src/tools/backend/README
src/tools/backend/backend_dirs.html
src/tools/backend/flow.fig
src/tools/backend/flow.gif
src/tools/backend/index.html
src/tools/ccsym
src/tools/copyright
src/tools/entab/Makefile
src/tools/entab/entab.c
src/tools/entab/entab.man
src/tools/entab/halt.c
src/tools/find_badmacros
src/tools/find_static
src/tools/find_typedef
src/tools/make_ctags
src/tools/make_diff/README
src/tools/make_diff/cporig
src/tools/make_diff/difforig
src/tools/make_diff/rmorig
src/tools/make_etags
src/tools/make_keywords
src/tools/make_mkid
src/tools/pgcvslog
src/tools/pginclude/README
src/tools/pginclude/pgcompinclude
src/tools/pginclude/pgdefine
src/tools/pginclude/pgfixinclude
src/tools/pginclude/pgrminclude
src/tools/pgindent/README
src/tools/pgindent/indent.bsd.patch
src/tools/pgindent/pgcppindent
src/tools/pgindent/pgindent
src/tools/pgindent/pgjindent
src/tutorial/Makefile
src/tutorial/README
src/tutorial/advanced.source
src/tutorial/basics.source
src/tutorial/beard.c
src/tutorial/complex.c
src/tutorial/complex.source
src/tutorial/funcs.c
src/tutorial/funcs.source
src/tutorial/funcs_new.c
src/tutorial/syscat.source
src/utils/Makefile
src/utils/README
src/utils/dllinit.c
src/utils/getopt.c
src/utils/strdup.c
src/win32.mak
Diffstat (limited to 'src/interfaces/python')
-rw-r--r-- | src/interfaces/python/Announce | 158 | ||||
-rw-r--r-- | src/interfaces/python/ChangeLog | 125 | ||||
-rw-r--r-- | src/interfaces/python/GNUmakefile | 59 | ||||
-rw-r--r-- | src/interfaces/python/PyGreSQL.spec | 57 | ||||
-rw-r--r-- | src/interfaces/python/README | 1100 | ||||
-rw-r--r-- | src/interfaces/python/README.linux | 46 | ||||
-rw-r--r-- | src/interfaces/python/Setup.in.raw | 3 | ||||
-rw-r--r-- | src/interfaces/python/pg.py | 277 | ||||
-rw-r--r-- | src/interfaces/python/pgdb.py | 446 | ||||
-rw-r--r-- | src/interfaces/python/pgmodule.c | 3218 | ||||
-rwxr-xr-x | src/interfaces/python/setup.py | 56 | ||||
-rwxr-xr-x | src/interfaces/python/tutorial/advanced.py | 178 | ||||
-rwxr-xr-x | src/interfaces/python/tutorial/basics.py | 296 | ||||
-rwxr-xr-x | src/interfaces/python/tutorial/func.py | 205 | ||||
-rwxr-xr-x | src/interfaces/python/tutorial/syscat.py | 148 |
15 files changed, 0 insertions, 6372 deletions
diff --git a/src/interfaces/python/Announce b/src/interfaces/python/Announce deleted file mode 100644 index 45270cf1042..00000000000 --- a/src/interfaces/python/Announce +++ /dev/null @@ -1,158 +0,0 @@ - -Announce: Release of PyGreSQL version 3.3 -========================================= - -PyGreSQL v3.3 has been released. -It is available at: ftp://ftp.druid.net/pub/distrib/PyGreSQL.tgz. If -you are running NetBSD, look in the packages directory under databases. -There is also a package in the FreeBSD ports collection. - -From March 1 2001 the PyGreSQL development has moved into the PostgreSQL -development tree. - -PostgreSQL is a database system derived from Postgres4.2. It conforms -to (most of) ANSI SQL and offers many interesting capabilities (C -dynamic linking for functions or type definition, etc.). This package -is copyright by the Regents of the University of California, and is -freely distributable. - -Python is an interpreted programming language. It is object oriented, -simple to use (light syntax, simple and straightforward statements), and -has many extensions for building GUIs, interfacing with WWW, etc. An -intelligent web browser (HotJava like) is currently under development -(November 1995), and this should open programmers many doors. Python is -copyrighted by Stichting S Mathematisch Centrum, Amsterdam, The -Netherlands, and is freely distributable. - -PyGreSQL is a python module that interfaces to a PostgreSQL database. It -embeds the PostgreSQL query library to allow easy use of the powerful -PostgreSQL features from a Python script. - -This release fixes a few bugs, adds a few minor features and makes a -few speedups in the code. - -The next release (unless serious bugs are found) will be to match PyGreSQL -to version 2.0 of Python. - -See the other changes below or in the Changelog file. - -PyGreSQL 2.0 was developed and tested on a NetBSD 1.3_BETA system. It -is based on the PyGres95 code written by Pascal Andre, -andre@chimay.via.ecp.fr. I changed the version to 2.0 and updated the -code for Python 1.5 and PostgreSQL 6.2.1. While I was at it I upgraded -the code to use full ANSI style prototypes and changed the order of -arguments to connect. Later versions are fixes and enhancements to that. -The latest version of PyGreSQL works with Python 1.5.2 and PostgreSQL 7.0.x - -Important changes from PyGreSQL 3.2 to PyGreSQL 3.3 - - Added NUMERICOID to list of returned types. This fixes a bug when - returning aggregates in the latest version of PostgreSQL. - -Important changes from PyGreSQL 3.1 to PyGreSQL 3.2 - Note that there are very few changes to PostgreSQL between 3.1 and - 3.2. The main reason for the release is the move into the PostgreSQL - development tree. Even the WIN32 changes are pretty minor. - - Add WIN32 support (gerhard@bigfoot.de) - - Fix some DB-API quoting problems (niall.smart@ebeon.com) - - Moved development into PostgreSQL development tree. - -Important changes from PyGreSQL 3.0 to PyGreSQL 3.1 - - Fix some quoting functions. In particular handle NULLs better. - - Use a method to add primary key information rather than direct - manipulation of the class structures. - - Break decimal out in _quote (in pg.py) and treat it as float. - - Treat timestamp like date for quoting purposes. - - Remove a redundant SELECT from the get method speeding it, and insert - since it calls get, up a little. - - Add test for BOOL type in typecast method to pgdbTypeCache class. - (tv@beamnet.de) - - Fix pgdb.py to send port as integer to lower level function - (dildog@l0pht.com) - - Change pg.py to speed up some operations - - Allow updates on tables with no primary keys. - -Important changes from PyGreSQL 2.4 to PyGreSQL 3.0: - - Remove strlen() call from pglarge_write() and get size from object. - (Richard@Bouska.cz) - - Add a little more error checking to the quote function in the wrapper - - Add extra checking in _quote function - - Wrap query in pg.py for debugging - - Add DB-API 2.0 support to pgmodule.c (andre@via.ecp.fr) - - Add DB-API 2.0 wrapper pgdb.py (andre@via.ecp.fr) - - Correct keyword clash (temp) in tutorial - - Clean up layout of tutorial - - Return NULL values as None (rlawrence@lastfoot.com) (WARNING: This - will cause backwards compatibility issues.) - - Change None to NULL in insert and update - - Change hash-bang lines to use /usr/bin/env - - Clearing date should be blank (NULL) not TODAY - - Quote backslashes in strings in _quote (brian@CSUA.Berkeley.EDU) - - Expanded and clarified build instructions (tbryan@starship.python.net) - - Make code thread safe (Jerome.Alet@unice.fr) - - Add README.distutils (mwa@gate.net & jeremy@cnri.reston.va.us) - - Many fixes and increased DB-API compliance by chifungfan@yahoo.com, - tony@printra.net, jeremy@alum.mit.edu and others to get the final - version ready to release. - -Important changes from PyGreSQL 2.3 to PyGreSQL 2.4: - - Insert returns None if the user doesn't have select permissions - on the table. It can (and does) happen that one has insert but - not select permissions on a table. - - Added ntuples() method to query object (brit@druid.net) - - Corrected a bug related to getresult() and the money type - - Corrected a bug related to negative money amounts - - Allow update based on primary key if munged oid not available and - table has a primary key - - Add many __doc__ strings. (andre@via.ecp.fr) - - Get method works with views if key specified - -Important changes from PyGreSQL 2.2 to PyGreSQL 2.3: - - connect.host returns "localhost" when connected to Unix socket - (torppa@tuhnu.cutery.fi) - - Use PyArg_ParseTupleAndKeywords in connect() (torppa@tuhnu.cutery.fi) - - fixes and cleanups (torppa@tuhnu.cutery.fi) - - Fixed memory leak in dictresult() (terekhov@emc.com) - - Deprecated pgext.py - functionality now in pg.py - - More cleanups to the tutorial - - Added fileno() method - terekhov@emc.com (Mikhail Terekhov) - - added money type to quoting function - - Compiles cleanly with more warnings turned on - - Returns PostgreSQL error message on error - - Init accepts keywords (Jarkko Torppa) - - Convenience functions can be overridden (Jarkko Torppa) - - added close() method - -Important changes from PyGreSQL 2.1 to PyGreSQL 2.2: - - Added user and password support thanks to Ng Pheng Siong <ngps@post1.com> - - Insert queries return the inserted oid - - Add new pg wrapper (C module renamed to _pg) - - Wrapped database connection in a class. - - Cleaned up some of the tutorial. (More work needed.) - - Added version and __version__. Thanks to thilo@eevolute.com for - the suggestion. - -Important changes from PyGreSQL 2.0 to PyGreSQL 2.1: - - return fields as proper Python objects for field type - - Cleaned up pgext.py - - Added dictresult method - -Important changes from Pygres95 1.0b to PyGreSQL 2.0: - - Updated code for PostgreSQL 6.2.1 and Python 1.5. - - Reformatted code and converted to ANSI . - - Changed name to PyGreSQL (from PyGres95.) - - Changed order of arguments to connect function. - - Created new type pgqueryobject and moved certain methods to it. - - Added a print function for pgqueryobject - - Various code changes - mostly stylistic. - -For more information about each package, please have a look to their -web pages: - - Python : http://www.python.org/ - - PostgreSQL : http://www.PostgreSQL.org/ - - PyGreSQL : http://www.druid.net/pygresql/ - - -D'Arcy J.M. Cain -darcy@druid.net - - diff --git a/src/interfaces/python/ChangeLog b/src/interfaces/python/ChangeLog deleted file mode 100644 index 5685a3cb644..00000000000 --- a/src/interfaces/python/ChangeLog +++ /dev/null @@ -1,125 +0,0 @@ -PyGreSQL changelog. -=================== - -This software is copyright (c) 1995, Pascal Andre (andre@via.ecp.fr) -Further copyright 1997, 1998 and 1999 by D'Arcy J.M. Cain (darcy@druid.net) -See file README for copyright information. - -Version 3.3 - A few cleanups. Mostly there was some confusion about the latest version - and so I am bumping the number to keep it straight. - - Added NUMERICOID to list of returned types. This fixes a bug when - returning aggregates. - -Version 3.2 - - Add WIN32 support (gerhard@bigfoot.de) - - Fix some DB-API quoting problems (niall.smart@ebeon.com) - - Moved development into PostgreSQL development tree. - -Version 3.1 - - Fix some quoting functions. In particular handle NULLs better. - - Use a method to add primary key information rather than direct - manipulation of the class structures. - - Break decimal out in _quote (in pg.py) and treat it as float. - - Treat timestamp like date for quoting purposes. - - Remove a redundant SELECT from the get method speeding it, and insert - since it calls get, up a little. - - Add test for BOOL type in typecast method to pgdbTypeCache class. - (tv@beamnet.de) - - Fix pgdb.py to send port as integer to lower level function - (dildog@l0pht.com) - - Change pg.py to speed up some operations - - Allow updates on tables with no primary keys. - -Version 3.0 - - Remove strlen() call from pglarge_write() and get size from object. - (Richard@Bouska.cz) - - Add a little more error checking to the quote function in the wrapper - - Add extra checking in _quote function - - Wrap query in pg.py for debugging - - Add DB-API 2.0 support to pgmodule.c (andre@via.ecp.fr) - - Add DB-API 2.0 wrapper pgdb.py (andre@via.ecp.fr) - - Correct keyword clash (temp) in tutorial - - Clean up layout of tutorial - - Return NULL values as None (rlawrence@lastfoot.com) - - Change None to NULL in insert and update - - Change hash-bang lines to use /usr/bin/env - - Clearing date should be blank (NULL) not TODAY - - Quote backslashes in strings in _quote (brian@CSUA.Berkeley.EDU) - - Expanded and clarified build instructions (tbryan@starship.python.net) - - Make code thread safe (Jerome.Alet@unice.fr) - - Add README.distutils (mwa@gate.net & jeremy@cnri.reston.va.us) - - Many fixes and increased DB-API compliance by chifungfan@yahoo.com, - tony@printra.net, jeremy@alum.mit.edu and others to get the final - version ready to release. - -Version 2.4 - - Insert returns None if the user doesn't have select permissions - on the table. It can (and does) happen that one has insert but - not select permissions on a table. - - Added ntuples() method to query object (brit@druid.net) - - Corrected a bug related to getresult() and the money type - - Corrected a bug related to negative money amounts - - Allow update based on primary key if munged oid not available and - table has a primary key - - Add many __doc__ strings. (andre@via.ecp.fr) - - Get method works with views if key specified - -Version 2.3 - - connect.host returns "localhost" when connected to Unix socket - (torppa@tuhnu.cutery.fi) - - Use PyArg_ParseTupleAndKeywords in connect() (torppa@tuhnu.cutery.fi) - - fixes and cleanups (torppa@tuhnu.cutery.fi) - - Fixed memory leak in dictresult() (terekhov@emc.com) - - Deprecated pgext.py - functionality now in pg.py - - More cleanups to the tutorial - - Added fileno() method - terekhov@emc.com (Mikhail Terekhov) - - added money type to quoting function - - Compiles cleanly with more warnings turned on - - Returns PostgreSQL error message on error - - Init accepts keywords (Jarkko Torppa) - - Convenience functions can be overridden (Jarkko Torppa) - - added close() method - -Version 2.2 - - Added user and password support thanks to Ng Pheng Siong <ngps@post1.com> - - Insert queries return the inserted oid - - Add new pg wrapper (C modile renamed to _pg) - - Wrapped database connection in a class. - - Cleaned up some of the tutorial. (More work needed.) - - Added version and __version__. Thanks to thilo@eevolute.com for - the suggestion. - -Version 2.1 - - return fields as proper Python objects for field type - - Cleaned up pgext.py - - Added dictresult method - -Version 2.0 (23/12/1997): - - updated code for PostgreSQL 6.2.1 and Python 1.5 - - reformatted code and converted to ANSI - - Changed name to PyGreSQL (from PyGres95) - - changed order of arguments to connect function - - Created new type pgqueryobject and moved certain methods to it. - - Added a print function for pgqueryobject - -Version 1.0b (4/11/1995): - - keyword support for connect function moved from library file to C code - and taken away from library. - - rewrote documentation - - bug fix in connect function - - enhancements in large objects interface methods - -Version 1.0a (30/10/1995) (limited release): - - module adapted to standard Python syntax - - keyword support for connect function in library file - - rewrote default parameters interface (internal use of strings) - - fixed minor bugs in module interface - - redefinition of error messages - -Version 0.9b (10/10/1995) (first public release): - - large objects implementation - - many bug fixes, enhancements, ... - -Version 0.1a (7/10/1995): - - basic libpq functions (SQL access) diff --git a/src/interfaces/python/GNUmakefile b/src/interfaces/python/GNUmakefile deleted file mode 100644 index 12550424031..00000000000 --- a/src/interfaces/python/GNUmakefile +++ /dev/null @@ -1,59 +0,0 @@ -# $Header: /cvsroot/pgsql/src/interfaces/python/Attic/GNUmakefile,v 1.13 2001/12/13 18:39:04 petere Exp $ - -subdir = src/interfaces/python -top_builddir = ../../.. -include $(top_builddir)/src/Makefile.global - -NAME = _pgmodule -SO_MAJOR_VERSION = 0 -SO_MINOR_VERSION = 0 -OBJS = pgmodule.o -SHLIB_LINK = $(libpq) -ifeq ($(PORTNAME), win) -override CPPFLAGS += -DUSE_DL_IMPORT -SHLIB_LINK += $(python_libspec) -endif - - -include $(top_srcdir)/src/Makefile.shlib - -override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) $(python_includespec) - -all: all-lib - -all-lib: libpq-all - -.PHONY: libpq-all -libpq-all: - $(MAKE) -C $(libpq_builddir) all - -install-warning-msg := { \ -echo "*** Skipping the installation of the Python interface module for lack"; \ -echo "*** of permissions. To install it, change to the directory"; \ -echo "*** `pwd`,"; \ -echo "*** become the appropriate user, and do '$(MAKE) install'."; } - -install: all installdirs - @if test -w $(DESTDIR)$(python_moduleexecdir) && test -w $(DESTDIR)$(python_moduledir); then \ - echo "$(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(python_moduleexecdir)/_pgmodule$(DLSUFFIX)"; \ - $(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(python_moduleexecdir)/_pgmodule$(DLSUFFIX); \ - \ - echo "$(INSTALL_DATA) $(srcdir)/pg.py $(DESTDIR)$(python_moduledir)/pg.py"; \ - $(INSTALL_DATA) $(srcdir)/pg.py $(DESTDIR)$(python_moduledir)/pg.py; \ - \ - echo "$(INSTALL_DATA) $(srcdir)/pgdb.py $(DESTDIR)$(python_moduledir)/pgdb.py"; \ - $(INSTALL_DATA) $(srcdir)/pgdb.py $(DESTDIR)$(python_moduledir)/pgdb.py; \ - else \ - $(install-warning-msg); \ - fi - -installdirs: - $(mkinstalldirs) $(DESTDIR)$(python_moduleexecdir) $(DESTDIR)$(python_moduledir) - -uninstall: - rm -f $(DESTDIR)$(python_moduleexecdir)/_pgmodule$(DLSUFFIX) \ - $(DESTDIR)$(python_moduledir)/pg.py \ - $(DESTDIR)$(python_moduledir)/pgdb.py - -clean distclean maintainer-clean: clean-lib - rm -f $(OBJS) diff --git a/src/interfaces/python/PyGreSQL.spec b/src/interfaces/python/PyGreSQL.spec deleted file mode 100644 index 315dee3998d..00000000000 --- a/src/interfaces/python/PyGreSQL.spec +++ /dev/null @@ -1,57 +0,0 @@ -%define version 3.0 -%define release pre20000310 -%define name PyGreSQL -%define pythonversion 1.5 -Source: %{name}-%{version}-%{release}.tgz -Summary: A Python interface for PostgreSQL database. -Name: %{name} -Version: %{version} -Release: %{release} -#Patch: -Group: Applications/Databases -BuildRoot: /tmp/rpmbuild_%{name} -Copyright: GPL-like -Requires: python >= %{pythonversion}, postgresql -Packager: Hartmut Goebel <hartmut@goebel.noris.de> -Vendor: D'Arcy J.M. Cain <darcy@druid.net> -URL: http://www.druid.net/pygresql/ - -%changelog -#* Tue Oct 06 1998 Fabio Coatti <cova@felix.unife.it> -#- fixed installation directory files list - -%description -PyGreSQL is a python module that interfaces to a PostgreSQL database. It -embeds the PostgreSQL query library to allow easy use of the powerful -PostgreSQL features from a Python script. - -Version 3.0 includes DB-API 2.0 support. - -%prep -rm -rf $RPM_BUILD_ROOT - -%setup -n %{name}-%{version}-%{release} -#%patch - -%build -mkdir -p $RPM_BUILD_ROOT/usr/lib/python%{pythonversion}/lib-dynload -cc -fpic -shared -o $RPM_BUILD_ROOT/usr/lib/python%{pythonversion}/lib-dynload/_pg.so -I/usr/include/pgsql/ -I/usr/include/python1.5 pgmodule.c -lpq -## import fails, since _pg is not yet installed -python -c 'import pg' || true -python -c 'import pgdb' || true - -%install -cp *.py *.pyc $RPM_BUILD_ROOT/usr/lib/python%{pythonversion}/ - -cd $RPM_BUILD_ROOT -find . -type f | sed 's,^\.,\%attr(-\,root\,root) ,' > $RPM_BUILD_DIR/file.list.%{name} -find . -type l | sed 's,^\.,\%attr(-\,root\,root) ,' >> $RPM_BUILD_DIR/file.list.%{name} - -%files -f ../file.list.%{name} -%doc %attr(-,root,root) Announce ChangeLog README tutorial - - -%clean -rm -rf $RPM_BUILD_ROOT -cd $RPM_BUILD_DIR -rm -rf %{name}-%{version}-%{release} file.list.%{name} diff --git a/src/interfaces/python/README b/src/interfaces/python/README deleted file mode 100644 index 17fbcd1111e..00000000000 --- a/src/interfaces/python/README +++ /dev/null @@ -1,1100 +0,0 @@ - -PyGreSQL - v3.3: PostgreSQL module for Python -============================================== - -0. Copyright notice -=================== - - PyGreSQL, version 3.3 - A Python interface for PostgreSQL database. - Written by D'Arcy J.M. Cain, darcy@druid.net<BR> - Based heavily on code written by Pascal Andre, andre@chimay.via.ecp.fr. - Copyright (c) 1995, Pascal ANDRE (andre@via.ecp.fr) - - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose, without fee, and without a written agreement - is hereby granted, provided that the above copyright notice and this - paragraph and the following two paragraphs appear in all copies or in any - new file that contains a substantial portion of this file. - - IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, - SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, - ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE - AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE - AUTHOR HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, - ENHANCEMENTS, OR MODIFICATIONS. - - Further modifications copyright 1997 - 2000 by D'Arcy J.M. Cain - (darcy@druid.net) subject to the same terms and conditions as above. - - Note that as of March 1 2001 the development of PyGreSQL has been moved - directly into the PostgreSQL development tree and is subject to the - PostgreSQL copyright except where contradicted by the above copyrights - in which case the above copyrights apply. - - -1. Presentation -=============== - -1.1. Introduction ------------------ - -PostgreSQL is a database system derived from Postgres4.2. It conforms to -(most of) ANSI SQL and offers many interesting capabilities (C dynamic linking -for functions or type definition, etc.). This package is copyright by the -Regents of the University of California, and is freely distributable. - -Python is an interpreted programming language. It is object oriented, simple -to use (light syntax, simple and straightforward statements), and has many -extensions for building GUIs, interfacing with WWW, etc. An intelligent web -browser (HotJava like) is currently under development (November 1995), and -this should open programmers many doors. Python is copyrighted by Stichting S -Mathematisch Centrum, Amsterdam, The Netherlands, and is freely distributable. - -PyGreSQL is a python module that interfaces to a PostgreSQL database. It -embeds the PostgreSQL query library to allow easy use of the powerful -PostgreSQL features from a Python script. - -PyGreSQL 2.0 was developed and tested on a NetBSD 1.3_BETA system. It is -based on the PyGres95 code written by Pascal Andre, andre@chimay.via.ecp.fr. -I changed the version to 2.0 and updated the code for Python 1.5 and -PostgreSQL 6.2.1. While I was at it I upgraded the code to use full ANSI -style prototypes and changed the order of arguments to connect. The latest -version of PyGreSQL works with PostgreSQL 7.1.3 and Python 2.1. - - -1.2. Distribution files ------------------------ - - README - this file - Announce - announcement of this release - ChangeLog - changes that affected this package during its history - pgmodule.c - the C python module - pg.py - PyGreSQL DB class. - pgdb.py - DB-SIG DB-API 2.0 compliant API wrapper for PygreSQL - tutorial/ - demos directory - Content: basics.py, syscat.py, advanced.py, func.py and - pgtools.py. The samples here have been taken from the - PostgreSQL manual and were used for module testing. They - demonstrate some PostgreSQL features. Pgtools.py is an - add-in used for demonstration. - -1.3. Installation ------------------ - -* If you are building this from source on most systems you can simply add - the flag "--with-python" to the Configure command when building PostgreSQL. - This will cause PyGreSQL to be built at the same time. For this to work - you must already have built Python as well as the mxDateTime package - from http://starship.python.net/~lemburg/mxDateTime.html. - -* For Linux installation look at README.linux. If you're on an x86 system - that uses RPMs, then you can pick up an RPM at - ftp://ftp.druid.net/pub/distrib/pygresql.i386.rpm - -* Note that if you are using the DB-API module you must also install - mxDateTime from http://starship.python.net/~lemburg/mxDateTime.html. - -* Also, check out setup.py for an alternate method of installing the package. - -You have two options. You can compile PyGreSQL as a stand-alone module -or you can build it into the Python interpreter. - -GENERAL - -* You must first have installed Python and PostgreSQL on your system. - The header files and developer's libraries for both Python and PostgreSQL - must be installed on your system before you can build PyGreSQL. If you - built both Python and PostgreSQL from source, you should be fine. If your - system uses some package mechanism (such as RPMs or NetBSD packages), then - you probably need to install packages such as Python-devel in addition to - the Python package. - -* PyGreSQL is implemented as three parts, a C module labeled _pg and two - Python wrappers called pg.py and pgdb.py. This changed between 2.1 and - 2.2 and again in 3.0. These changes should not affect any existing - programs but the installation is slightly different. - -* Download and unpack the PyGreSQL tarball if you haven't already done so. - -STAND-ALONE - -* In the directory containing pgmodule.c, run the following command - cc -fpic -shared -o _pg.so -I[pyInc] -I[pgInc] -L[pgLib] -lpq pgmodule.c - where: - [pyInc] = path of the Python include (usually Python.h) - [pgInc] = path of the PostgreSQL include (usually postgres.h) - [pgLib] = path of the PostgreSQL libraries (usually libpq.so or libpq.a) - Some options may be added to this line: - -DNO_DEF_VAR - no default variables support - -DNO_DIRECT - no direct access methods - -DNO_LARGE - no large object support - -DNO_SNPRINTF - if running a system with no snprintf call - -DNO_PQSOCKET - if running an older PostgreSQL - - On some systems you may need to include -lcrypt in the list of libraries - to make it compile. - - Define NO_PQSOCKET if you are using a version of PostgreSQL before 6.4 - that does not have the PQsocket function. The other options will be - described in the next sections. - -* Test the new module. Something like the following should work. - - $ python - - >>> import _pg - >>> db = _pg.connect('thilo','localhost') - >>> db.query("INSERT INTO test VALUES ('ping','pong')") - 18304 - >>> db.query("SELECT * FROM test") - eins|zwei - ----+---- - ping|pong - (1 row) - -* Finally, move the _pg.so, pg.py, and pgdb.py to a directory in your - PYTHONPATH. A good place would be /usr/lib/python1.5/site-python if - your Python modules are in /usr/lib/python1.5. - -BUILT-IN TO PYTHON INTERPRETER - -* Find the directory where your 'Setup' file lives (usually ??/Modules) in - the Python source hierarchy and copy or symlink the 'pgmodule.c' file there. - -* Add the following line to your Setup file - _pg pgmodule.c -I[pgInc] -L[pgLib] -lpq # -lcrypt # needed on some systems - where: - [pgInc] = path of PostgreSQL include (often /usr/local/include/python1.5) - [pgLib] = path of the PostgreSQL libraries (often /usr/local/lib/python1.5) - Some options may be added to this line: - -DNO_DEF_VAR - no default variables support - -DNO_DIRECT - no direct access methods - -DNO_LARGE - no large object support - -DNO_SNPRINTF - if running a system with no snprintf call - -DNO_PQSOCKET - if running an older PostgreSQL - - Define NO_PQSOCKET if you are using a version of PostgreSQL before 6.4 - that does not have the PQsocket function. The other options will be - described in the next sections. - -* If you want a shared module, make sure that the "*shared*" keyword is - uncommented and add the above line below it. You used to need to install - your shared modules with "make sharedinstall but this no longer seems - to be true." - -* Copy pg.py to the lib directory where the rest of your modules are. For - example, that's /usr/local/lib/Python on my system. - -* Rebuild Python from the root directory of the Python source hierarchy by - running 'make -f Makefile.pre.in boot' and 'make && make install' - -* For more details read the documentation at the top of Makefile.pre.in - - -1.4. Where to get ... ? ------------------------ - -The home sites of the different packages are: - - - Python: http://www.python.org/ - - PosgreSQL: http://www.PostgreSQL.org/ - - PyGreSQL: http://www.druid.net/pygresql/ - -A Linux RPM can be picked up from -ftp://ftp.druid.net/pub/distrib/pygresql.i386.rpm. A NetBSD package thould -be in the distribution soon and is available at -ftp://ftp.druid.net/pub/distrib/pygresql.pkg.tgz. A WIN32 package is -available at http://highqualdev.com/. - -1.5. Information and support ----------------------------- - -If you need information about these packages please check their web sites: - - - Python: http://www.python.org/ - - PostgreSQL: http://www.postgresql.org/ - - PyGres95: http://www.via.ecp.fr/via/products/pygres.html - - PyGreSQL: http://www.druid.net/pygresql/ - -For support: - - - Python: newgroup comp.lang.python - - PostgreSQL: mailing list (see package documentation for information) - - PyGres95: contact me (andre@via.ecp.fr) for bug reports, ideas, - remarks I will try to answer as long as my free time allow - me to do that. - - PyGreSQL: contact me (darcy@druid.net) concerning the changes to 2.x - and up. If you would like to proposes changes please - join the PyGreSQL mailing list and send context diffs - there. See http://www.vex.net/mailman/listinfo/pygresql - to join the mailing list. - - -2. Programming information -========================== - -You may either choose to use the old, mature interface provided by the -'pg' module or else the newer 'pgdb' interface compliant with DB-API 2.0 -specification developed by the Python DB-SIG. - -The remainder of this chapter and the next chapter describe only -the older 'pg' API. As long as PyGreSQL does not contain a -description of the DB-API you should read about the API at -http://www.python.org/topics/database/DatabaseAPI-2.0.html - -A tutorial like introduction to the DB-API can be found at -http://www2.linuxjournal.com/lj-issues/issue49/2605.html - -The 'pg' module defines three objects: the pgobject that handles the connection -and all the requests to the database, the pglargeobject that handles -all the accesses to Postgres large objects and pgqueryobject that handles -query results. - -If you want to see a simple example of the use of some of these functions, -see http://www.druid.net/rides/ where I have a link at the bottom to the -actual Python code for the page. - -2.1. pg module description ----------------------------- - -The module defines only a few methods that allow to connect to a database and -to allow to define "default variables" that override the environment variables -used by PostgreSQL. - -These "default variables" were designed to allow you to handle general -connection parameters without heavy code in your programs. You can prompt the -user for a value, put it in the default variable, and forget it, without -having to modify your environment. The support for default variables can be -disabled by setting the -DNO_DEF_VAR option in the Python Setup file. Methods -relative to this are specified by te tag [DV]. - -All variables are set to None at module initialization, specifying that -standard environment variables should be used. - - 2.1.1. connect - opens a pg connection - ---------------------------------------- - - Syntax: - connect(dbname, host, port, opt, tty, user, passwd) - Parameters: - dbname - name of connected database (string/None) - host - name of the server host (string/None) - port - port used by the database server (integer/-1) - opt - connection options (string/None) - tty - debug terminal (string/None) - user - PostgreSQL user (string/None) - passwd - password for user (string/None) - Return type: - pgobject - the object handling the connection - Exceptions raised: - TypeError - bad argument type, or too many arguments - SyntaxError - duplicate argument definition - pg.error - some error occurred during pg connection definition - (+ all exceptions relative to object allocation) - Description: - This method opens a connection to a specified database on a given - PostgreSQL server. You can use keywords here, as described in the - Python tutorial; - the names of the keywords are the name of the parameters given in the - syntax line. For a precise description of the parameters, please refer to - the PostgreSQL user manual. - - 2.1.2. get_defhost, set_defhost - default server host name handling [DV] - ------------------------------------------------------------------------ - - Syntax: get_defhost() - Parameters: - none - Return type: - string, None - default host specification - Exceptions raised: - SyntaxError - too many arguments - Description: - This method returns the current default host specification, or None if the - environment variables should be used. Environment variables won't be looked - up. - - Syntax: set_defhost(host) - Parameters: - host - new default host (string/None) - Return type: - string, None - previous default host specification - Exceptions raised: - TypeError - bad argument type, or too many arguments - Description: - This methods sets the default host value for new connections. If None is - supplied as parameter, environment variables will be used in future - connections. It returns the previous setting for default host. - - 2.1.3. get_defport, set_defport - default server port handling [DV] - ------------------------------------------------------------------- - - Syntax: get_defport() - Parameters: none - Return type: - integer, None - default port specification - Exceptions raised: - SyntaxError - too many arguments - Description: - This method returns the current default port specification, or None if - the environment variables should be used. Environment variables won't - be looked up. - - Syntax: set_defport(port) - Parameters: - port - new default port (integer/-1) - Return type: - integer, None - previous default port specification - Description: - This methods sets the default port value for new connections. If -1 is - supplied as parameter, environment variables will be used in future - connections. It returns the previous setting for default port. - - 2.1.4. get_defopt, set_defopt - default connection options handling [DV] - ------------------------------------------------------------------------ - - Syntax: get_defopt() - Parameters: none - Return type: - string, None - default options specification - Exceptions raised: - SyntaxError - too many arguments - Description: - This method returns the current default connection options specification, - or None if the environment variables should be used. Environment variables - won't be looked up. - - Syntax: set_defopt(options) - Parameters: - options - new default connection options (string/None) - Return type: - string, None - previous default options specification - Exceptions raised: - TypeError - bad argument type, or too many arguments - Description: - This methods sets the default connection options value for new connections. - If None is supplied as parameter, environment variables will be used in - future connections. It returns the previous setting for default options. - - 2.1.5. get_deftty, set_deftty - default connection debug tty handling [DV] - -------------------------------------------------------------------------- - - Syntax: get_deftty() - Parameters: none - Return type: - string, None - default debug terminal specification - Exceptions raised: - SyntaxError - too many arguments - Description: - This method returns the current default debug terminal specification, or - None if the environment variables should be used. Environment variables - won't be looked up. - - Syntax: set_deftty(terminal) - Parameters: - terminal - new default debug terminal (string/None) - Return type: - string, None - previous default debug terminal specification - Exceptions raised: - TypeError - bad argument type, or too many arguments - Description: - This methods sets the default debug terminal value for new connections. If - None is supplied as parameter, environment variables will be used in future - connections. It returns the previous setting for default terminal. - - 2.1.6. get_defbase, set_defbase - default database name handling [DV] - --------------------------------------------------------------------- - - Syntax: get_defbase() - Parameters: none - Return type: - string, None - default database name specification - Exceptions raised: - SyntaxError - too many arguments - Description: - This method returns the current default database name specification, or - None if the environment variables should be used. Environment variables - won't be looked up. - - Syntax: set_defbase(base) - Parameters: - base - new default base name (string/None) - Return type: - string, None - previous default database name specification - Exceptions raised: - TypeError - bad argument type, or too many arguments - Description: - This method sets the default database name value for new connections. If - None is supplied as parameter, environment variables will be used in - future connections. It returns the previous setting for default host. - - 2.1.7. Module constants - ----------------------- - - Some constants are defined in the module dictionary. They are intended to be -used as parameters for methods calls. You should refer to PostgreSQL user -manual for more information about them. These constants are: - - - large objects access modes, used by (pgobject.)locreate and - (pglarge.)open: (pg.)INV_READ, (pg.)INV_WRITE - - positional flags, used by (pglarge.)seek: (pg.)SEEK_SET, - (pg.)SEEK_CUR, (pg.)SEEK_END. - - version and __version__ constants that give the current version. - - 2.1.9. - 2.1.10. Miscellaneous attributes - - The following methods return information about the current connection. - - - -2.2. pgobject description ---------------------------- - - This object handle a connection to a PostgreSQL database. It embeds and -hides all the parameters that define this connection, thus just leaving really -significant parameters in function calls. - Some methods give direct access to the connection socket. They are specified -by the tag [DA]. DO NOT USE THEM UNLESS YOU REALLY KNOW WHAT YOU ARE DOING. If -you prefer disabling them, set the -DNO_DIRECT option in the Python Setup file. - Some other methods give access to large objects (refer to PostgreSQL user -manual for more information about these). if you want to forbid access to these -from the module, set the -DNO_LARGE option in the Python Setup file. These -methods are specified by the tag [LO]. - - 2.2.1. query - executes a SQL command string - -------------------------------------------- - - Syntax: query(command) - Parameters: - command - SQL command (string) - Return type: - pgqueryobject, None - result values - Exceptions raised: - TypeError - bad argument type, or too many arguments. - ValueError - empty SQL query - pg.error - error during query processing, or invalid connection - Description: - This method simply sends a SQL query to the database. If the query is - an insert statement, the return value is the OID of the newly - inserted row. If it is otherwise a query that does not return a result - (ie. is not a some kind of SELECT statement), it returns None. - Otherwise, it returns a pgqueryobject that can be accessed via the - getresult or dictresult method or simply printed. - - pgqueryobject methods - --------------------- - - 2.2.1.1. getresult - gets the values returned by the query - ------------------------------------------------------------- - - Syntax: getresult() - Parameters: none - Return type: - list - result values - Exceptions raised: - SyntaxError - too many parameters - pg.error - invalid previous result - Description: - This method returns the list of the values returned by the query. - More information about this result may be accessed using listfields, - fieldname and fieldnum methods. - - 2.2.1.2. dictresult - like getresult but returns list of dictionaries - --------------------------------------------------------------------- - - Syntax: dictresult() - Parameters: none - Return type: - list - result values as a dictionary - Exceptions raised: - SyntaxError - too many parameters - pg.error - invalid previous result - Description: - This method returns the list of the values returned by the query - with each tuple returned as a dictionary with the field names - used as the dictionary index. - - - 2.2.1.3. listfields - lists the fields names of the previous query result - ----------------------------------------------------------------------- - - Syntax: listfields() - Parameters: none - Return type: - list - fields names - Exceptions raised: - SyntaxError - too many parameters - pg.error - invalid previous result, or invalid connection - Description: - This method returns the list of names of the fields defined for the - query result. The fields are in the same order as the result values. - - 2.2.1.4. fieldname, fieldnum - field name-number conversion - --------------------------------------------------------- - - Syntax: fieldname(i) - Parameters: - i - field number (integer) - Return type: - string - field name - Exceptions raised: - TypeError - bad parameter type, or too many parameters - ValueError - invalid field number - pg.error - invalid previous result, or invalid connection - Description: - This method allows to find a field name from its rank number. It can be - useful for displaying a result. The fields are in the same order as the - result values. - - Syntax: fieldnum(name) - Parameters: - name - field name (string) - Return type: - integer - field number - Exceptions raised: - TypeError - bad parameter type, or too many parameters - ValueError - unknown field name - pg.error - invalid previous result, or invalid connection - Description: - This method returns a field number from its name. It can be used to - build a function that converts result list strings to their correct - type, using a hardcoded table definition. The number returned is the - field rank in the result values list. - - 2.2.1.5 ntuples - return number of tuples in query object - --------------------------------------------------------- - - Syntax: ntuples() - Parameters: None - Return type: integer - Description: - This method returns the number of tuples found in a query. - - - 2.2.2. reset - resets the connection - ------------------------------------ - - Syntax: reset() - Parameters: None - Return type: None - Exceptions raised: - TypeError - too many (any) arguments - Description: - This method resets the current database. - - - 2.2.3. close - close the database connection - -------------------------------------------- - - Syntax: close() - Parameters: none - Return type: None - Exceptions raised: - TypeError - too many (any) arguments - Description: - This method closes the database connection. The connection will - be closed in any case when the connection is deleted but this - allows you to explicitly close it. It is mainly here to allow - the DB-SIG API wrapper to implement a close function. - - - 2.2.4. fileno - returns the socket used to connect to the database - ------------------------------------------------------------------ - - Syntax: fileno() - Parameters: none - Exceptions raised: - TypeError - too many (any) arguments - Description: - This method returns the underlying socket id used to connect - to the database. This is useful for use in select calls, etc. - Note: This function depends on having a recent version of the - database. See "-DNO_PQSOCKET" described above. - - - 2.2.5. getnotify - gets the last notify from the server - ------------------------------------------------------- - - Syntax: getnotify() - Parameters: none - Return type: - tuple, None - last notify from server - Exceptions raised: - SyntaxError - too many parameters - pg.error - invalid connection - Description: - This methods try to get a notify from the server (from the SQL statement - NOTIFY). If the server returns no notify, the methods returns None. - Otherwise, it returns a tuple (couple) (relname, pid), where relname is the - name of the notify and pid the process id of the connection that triggered - the notify. Remember to do a listen query first otherwise getnotify - will always return None. - - 2.2.6. inserttable - insert a list into a table - ----------------------------------------------- - - Syntax: inserttable(table, values) - Parameters: - table - the table name (string) - values - list of rows values (list) - Return type: - None - Exception raised: - pg.error - invalid connection - TypeError - bad argument type, or too many arguments - Description: - This method allow to quickly insert large blocks of data in a table: it - inserts the whole values list into the given table. The list is a list of - tuples/lists that define the values for each inserted row. The rows values - may contain string, integer, long or double (real) values. - BE VERY CAREFUL: this method doesn't typecheck the fields according to the - table definition; it just look whether or not it knows how to handle such - types. - - 2.2.7. putline - writes a line to the server socket [DA] - -------------------------------------------------------- - - Syntax: putline(line) - Parameters: - line - line to be written (string) - Return type: - None - Exceptions raised: - pg.error - invalid connection - TypeError - bad parameter type, or too many parameters - Description: - This method allows to directly write a string to the server socket. - - 2.2.8. getline - gets a line from server socket [DA] - ---------------------------------------------------- - - Syntax: getline() - Parameters: none - Return type: - string - the line read - Exceptions raised: - pg.error - invalid connection - SyntaxError - too many parameters - Description: - This method allows to directly read a string from the server socket. - - 2.2.9. endcopy - synchronizes client and server [DA] - ---------------------------------------------------- - - Syntax: endcopy() - Parameters: none - Return type: - None - Exceptions raised: - pg.error - invalid connection - SyntaxError - too many parameters - Description: - The use of direct access methods may desynchonize client and server. This - method ensure that client and server will be synchronized. - - 2.2.10. locreate - creates of large object in the database [LO] - --------------------------------------------------------------- - - Syntax: locreate(mode) - Parameters: - mode - large object create mode - Return type: - pglarge - object handling the postgres large object - Exceptions raised: - pg.error - invalid connection, or creation error - TypeError - bad parameter type, or too many parameters - Description: - This method creates a large object in the database. The mode can be defined - by OR-ing the constants defined in the pg module (INV_READ, INV_WRITE and - INV_ARCHIVE). Please refer to PostgreSQL user manual for a description of - the mode values. - - 2.2.11. getlo - builds a large object from given oid [LO] - --------------------------------------------------------- - - Syntax: getlo(oid) - Parameters: - oid - oid of the existing large object (integer) - Return type: - pglarge - object handling the postgres large object - Exceptions raised: - pg.error - invalid connection - TypeError - bad parameter type, or too many parameters - ValueError - bad oid value (0 is invalid_oid) - Description: - This method allows to reuse a formerly created large object through the - pglarge interface, providing the user have its oid. - - 2.2.12. loimport - import a file to a postgres large object [LO] - ---------------------------------------------------------------- - - Syntax: loimport(name) - Parameters: - name - the name of the file to be imported (string) - Return type: - pglarge - object handling the postgres large object - Exceptions raised: - pg.error - invalid connection, or error during file import - TypeError - bad argument type, or too many arguments - Description: - This methods allows to create large objects in a very simple way. You just - give the name of a file containing the data to be use. - - 2.2.13. pgobject attributes - ----------------------------- - - Every pgobject defines a set of read-only attributes that describe the -connection and its status. These attributes are: - host - the hostname of the server (string) - port - the port of the server (integer) - db - the selected database (string) - options - the connection options (string) - tty - the connection debug terminal (string) - user - the username on the database system (string) - status - the status of the connection (integer: 1 - OK, 0 - BAD) - error - the last warning/error message from the server (string) - -2.3. pglarge description --------------------------- - - This object handles all the request concerning a postgres large object. It -embeds and hides all the 'recurrent' variables (object oid and connection), -exactly in the same way pgobjects do, thus only keeping significant -parameters in function calls. It keeps a reference to the pgobject used for -its creation, sending requests though with its parameters. Any modification but -dereferencing the pgobject will thus affect the pglarge object. -Dereferencing the initial pgobject is not a problem since Python won't -deallocate it before the large object dereference it. - All functions return a generic error message on call error, whatever the -exact error was. The 'error' attribute of the object allow to get the exact -error message. - - 2.3.1. open - opens a large object - ---------------------------------- - - Syntax: open(mode) - Parameters: - mode - open mode definition (integer) - Return type: - None - Exceptions raised: - pg.error - invalid connection - TypeError - bad parameter type, or too many parameters - IOError - already opened object, or open error - Description: - This method opens a large object for reading/writing, in the same way than - the UNIX open() function. The mode value can be obtained by OR-ing the - constants defined in the pgmodule (INV_READ, INV_WRITE). - - 2.3.2. close - closes a large object - ------------------------------------ - - Syntax: close() - Parameters: none - Return type: - None - Exceptions raised: - pg.error - invalid connection - SyntaxError - too many parameters - IOError - object is not opened, or close error - Description: - This method closes a previously opened large object, in the same way than - the UNIX close() function. - - 2.3.4. read, write, tell, seek, unlink - file like large object handling - ------------------------------------------------------------------------ - - Syntax: read(size) - Parameters: - size - maximal size of the buffer to be read - Return type: - sized string - the read buffer - Exceptions raised: - pg.error - invalid connection or invalid object - TypeError - bad parameter type, or too many parameters - IOError - object is not opened, or read error - Description: - This function allows to read data from a large object, starting at current - position. - - Syntax: write(string) - Parameters: - (sized) string - buffer to be written - Return type: - None - Exceptions raised: - pg.error - invalid connection or invalid object - TypeError - bad parameter type, or too many parameters - IOError - object is not opened, or write error - Description: - This function allows to write data to a large object, starting at current - position. - - Syntax: seek(offset, whence) - Parameters: - offset - position offset - whence - positional parameter - Return type: - integer - new position in object - Exception raised: - pg.error - invalid connection or invalid object - TypeError - bad parameter type, or too many parameters - IOError - object is not opened, or seek error - Description: - This method allows to move the position cursor in the large object. The - whence parameter can be obtained by OR-ing the constants defined in the - pg module (SEEK_SET, SEEK_CUR, SEEK_END). - - Syntax: tell() - Parameters: none - Return type: - integer - current position in large object - Exception raised: - pg.error - invalid connection or invalid object - SyntaxError - too many parameters - IOError - object is not opened, or seek error - Description: - This method allows to get the current position in the large object. - - Syntax: unlink() - Parameter: none - Return type: - None - Exception raised: - pg.error - invalid connection or invalid object - SyntaxError - too many parameters - IOError - object is not closed, or unlink error - Description: - This methods unlinks (deletes) the postgres large object. - - 2.3.5. size - gives the large object size - ----------------------------------------- - - Syntax: size() - Parameters: none - Return type: - integer - large object size - Exceptions raised: - pg.error - invalid connection or invalid object - SyntaxError - too many parameters - IOError - object is not opened, or seek/tell error - Description: - This (composite) method allows to get the size of a large object. Currently - the large object needs to be opened. It was implemented because this - function is very useful for a WWW interfaced database. - - 2.3.6. export - saves a large object to a file - ---------------------------------------------- - - Syntax: export(name) - Parameters: - name - file to be created - Return type: - None - Exception raised: - pg.error - invalid connection or invalid object - TypeError - bad parameter type, or too many parameters - IOError - object is not closed, or export error - Description: - This methods allows to dump the content of a large object in a very simple - way. The exported file is created on the host of the program, not the - server host. - - 2.3.7. Object attributes - ------------------------ - - pglarge objects define a read-only set of attributes that allow to get some -information about it. These attributes are: - oid - the oid associated with the object - pgcnx - the pgobject associated with the object - error - the last warning/error message of the connection -BE CAREFUL: in multithreaded environments, 'error' may be modified by another -thread using the same pgobject. Remember these object are shared, not -duplicated. You should provide some locking to be able if you want to check -this. - The oid attribute is very interesting because it allow you reuse the oid -later, creating the pglarge object with a pgobject getlo() method call. - - -3. The pg wrapper -================ - -The previous functions are wrapped in a module called pg. The module -has a class called DB. The above functions are also included in the -name space so it isn't necessary to import both modules. The preferred -way to use this module is as follows. - -import pg -db = pg.DB(...) # See description of the initialization method below. - -The following describes the methods and variables of this class. - - - 3.1. Initialization - ------------------- - The DB class is initialized with the same arguments as the connect - method described in section 2. It also initializes a few internal - variables. The statement 'db = DB()' will open the local database - with the name of the user just like connect() does. - - 3.2. pkey - --------- - Syntax: - pkey(table) - Parameters: - table - name of table - Returns: - Name of field which is the primary key of the table. - Description: - This method returns the primary key of a table. Note that this raises - an exception if the table doesn't have a primary key. - - 3.3. get_databases - get list of databases in the system - -------------------------------------------------------- - Syntax: get_databases() - Parameters: none - Returns: list of databases in the system - Description: - Although you can do this with a simple select, it is added here for - convenience - - 3.4. get_tables - get list of tables in connected database - ---------------------------------------------------------- - Syntax: get_tables() - Parameters: none - Returns: list of tables in connected database - - 3.5. get_attnames - ----------------- - Syntax: - get_attnames(table) - Parameters: - table - name of table - Returns: - Dictionary of attribute names (the names are the keys, the values - are the names of the attributes' types) - Description: - Given the name of a table, digs out the set of attribute names. - - 3.6. get - get a tuple from a database table - -------------------------------------------- - Syntax: - get(table, arg, [keyname]) - Parameters: - table - name of table - arg - either a dictionary or the value to be looked up - keyname - name of field to use as key (optional) - Returns: - A dictionary mapping attribute names to row values. - Description: - This method is the basic mechanism to get a single row. It assumes - that the key specifies a unique row. If keyname is not specified - then the primary key for the table is used. If arg is a dictionary - then the value for the key is taken from it and it is modified to - include the new values, replacing existing values where necessary. - The oid is also put into the dictionary but in order to allow the - caller to work with multiple tables, the attribute name is munged - to make it unique. It consists of the string "oid_" followed by - the name of the table. - - - 3.7. insert - insert a tuple into a database table - -------------------------------------------------- - Syntax: - insert(table, a) - Parameters: - table - name of table - a - a dictionary of values - Returns: - The OID of the newly inserted row. - Description: - This method inserts values into the table specified filling in the - values from the dictionary. It then reloads the dictionary with the - values from the database. This causes the dictionary to be updated - with values that are modified by rules, triggers, etc. - - Due to the way that this function works you will find inserts taking - longer and longer as your table gets bigger. To overcome this problem - simply add an index onto the OID of any table that you think may get - large over time. - - - 3.8. update - ----------- - Syntax: - update(table, a) - Parameters: - table - name of table - a - a dictionary of values - Returns: - A dictionary with the new row - Description: - Similar to insert but updates an existing row. The update is based - on the OID value as munged by get. The array returned is the - one sent modified to reflect any changes caused by the update due - to triggers, rules, defaults, etc. - - 3.9. clear - ---------- - Syntax: - clear(table, [a]) - Parameters: - table - name of table - a - a dictionary of values - Returns: - A dictionary with an empty row - Description: - This method clears all the attributes to values determined by the types. - Numeric types are set to 0, dates are set to 'TODAY' and everything - else is set to the empty string. If the array argument is present, - it is used as the array and any entries matching attribute names - are cleared with everything else left unchanged. - - 3.8. delete - ----------- - Syntax: - delete(table, a) - Parameters: - table - name of table - a - a dictionary of values - Returns: - None - Description: - This method deletes the row from a table. It deletes based on the OID - as munged as described above. - - -4. DB-API reference -=================== - - This section needs to be written. - - -5. Todo -======= - -The large object and direct access functions need much more attention. - -An update query should return the number of rows affected. - -The C module needs to be cleaned up and redundant code merged. - -The DB-API module needs to be documented. - -The fetch method should use real cursors. - - -6. Future directions -==================== - -Users should be able to register their own types with _pg. - -I would like a new method that returns a dictionary of dictionaries from -a SELECT. - - diff --git a/src/interfaces/python/README.linux b/src/interfaces/python/README.linux deleted file mode 100644 index 66b0346c826..00000000000 --- a/src/interfaces/python/README.linux +++ /dev/null @@ -1,46 +0,0 @@ -Thanks to thilo@eevolute.com and others for this README and the RPM - -Note: The precompiled RPM package is not available at www.eevolute.com. - You may use the spec file provided with PyGreSQL to build your - own package. - Hartmut Goebel <hartmut@goebel.noris.de> - - -INSTALLING PyGreSQL on Redhat Linux 5.1 or 5.2 -============================================== - -Things are pretty easy on Redhat Linux. You can either get a precompiled -RPM package from - - ftp://www.eevolute.com/pub/python/ - -or try in compile and install it yourself: - -bash$ make redhat # this just compiles the module as a shared object -cc -fpic -shared -o _pg.so -I/usr/include/python1.5 pgmodule.c -lpq -bash$ python # you can test it from your local directory -Python 1.5.1 (#1, May 6 1998, 01:48:27) [GCC 2.7.2.3] on linux-i386 -Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam ->>> import _pg ->>> db = _pg.connect('thilo', 'localhost') ->>> db.query("INSERT INTO test VALUES ('ping', 'pong')") -18304 ->>> db.query("SELECT * FROM test") -eins|zwei -----+---- -ping|pong -(1 row) - -bash$ su # Yow! Seems to work - now install it properly -bash# cp _pg.so /usr/lib/python1.5/lib-dynload - -done! - -Oliver White (ojw@muzak.iinet.net.au) sent me the following information -about installing on Debian. - -Hi, I thought you might want to upgrade your documentation for PyGreSQL -to let people know they can get it by simply typing 'apt-get install -python-pygresql', on debian (duh). This would have saved me a lot of -trouble. - diff --git a/src/interfaces/python/Setup.in.raw b/src/interfaces/python/Setup.in.raw deleted file mode 100644 index e52c2a4a280..00000000000 --- a/src/interfaces/python/Setup.in.raw +++ /dev/null @@ -1,3 +0,0 @@ -*shared* - -_pg pgmodule.c -I@libpq_srcdir@ @INCLUDES@ -L@libpq_builddir@ -lpq @EXTRA_LIBS@ diff --git a/src/interfaces/python/pg.py b/src/interfaces/python/pg.py deleted file mode 100644 index d9d34d872c8..00000000000 --- a/src/interfaces/python/pg.py +++ /dev/null @@ -1,277 +0,0 @@ -# pg.py -# Written by D'Arcy J.M. Cain - -# This library implements some basic database management stuff. It -# includes the pg module and builds on it. This is known as the -# "Classic" interface. For DB-API compliance use the pgdb module. - -from _pg import * -import string, re, sys - -# utility function -# We expect int, seq, decimal, text or date (more later) -def _quote(d, t): - if d == None: - return "NULL" - - if t in ['int', 'seq']: - if d == "": return "NULL" - return "%d" % int(d) - - if t == 'decimal': - if d == "": return "NULL" - return "%f" % float(d) - - if t == 'money': - if d == "": return "NULL" - return "'%.2f'" % float(d) - - if t == 'bool': - # Can't run upper() on these - if d in (0, 1): return ('f', 't')[d] - - if string.upper(d) in ['T', 'TRUE', 'Y', 'YES', '1', 'ON']: - return "'t'" - else: - return "'f'" - - if t == 'date' and d == '': return "NULL" - if t in ('inet', 'cidr') and d == '': return "NULL" - - return "'%s'" % string.strip(re.sub("'", "''", \ - re.sub("\\\\", "\\\\\\\\", "%s" % d))) - -class DB: - """This class wraps the pg connection type""" - - def __init__(self, *args, **kw): - self.db = apply(connect, args, kw) - - # Create convience methods, in a way that is still overridable. - for e in ( 'query', 'reset', 'close', 'getnotify', 'inserttable', - 'putline', 'getline', 'endcopy', - 'host', 'port', 'db', 'options', - 'tty', 'error', 'status', 'user', - 'locreate', 'getlo', 'loimport' ): - if not hasattr(self,e) and hasattr(self.db,e): - exec 'self.%s = self.db.%s' % ( e, e ) - - self.__attnames__ = {} - self.__pkeys__ = {} - self.debug = None # For debugging scripts, set to output format - # that takes a single string arg. For example - # in a CGI set to "%s<BR>" - - # Get all the primary keys at once - for rel, att in self.db.query("""SELECT - pg_class.relname, pg_attribute.attname - FROM pg_class, pg_attribute, pg_index - WHERE pg_class.oid = pg_attribute.attrelid AND - pg_class.oid = pg_index.indrelid AND - pg_index.indkey[0] = pg_attribute.attnum AND - pg_index.indisprimary = 't'""").getresult(): - self.__pkeys__[rel] = att - - # wrap query for debugging - def query(self, qstr): - if self.debug != None: - print self.debug % qstr - return self.db.query(qstr) - - # If third arg supplied set primary key to it - def pkey(self, cl, newpkey = None): - if newpkey: - self.__pkeys__[cl] = newpkey - - # will raise an exception if primary key doesn't exist - return self.__pkeys__[cl] - - def get_databases(self): - l = [] - for n in self.db.query("SELECT datname FROM pg_database").getresult(): - l.append(n[0]) - return l - - def get_tables(self): - l = [] - for n in self.db.query("""SELECT relname FROM pg_class - WHERE relkind = 'r' AND - relname !~ '^Inv' AND - relname !~ '^pg_'""").getresult(): - l.append(n[0]) - return l - - def get_attnames(self, cl): - # May as well cache them - if self.__attnames__.has_key(cl): - return self.__attnames__[cl] - - query = """SELECT pg_attribute.attname, pg_type.typname - FROM pg_class, pg_attribute, pg_type - WHERE pg_class.relname = '%s' AND - pg_attribute.attnum > 0 AND - pg_attribute.attrelid = pg_class.oid AND - pg_attribute.atttypid = pg_type.oid""" - - l = {} - for attname, typname in self.db.query(query % cl).getresult(): - if re.match("^int", typname): - l[attname] = 'int' - elif re.match("^oid", typname): - l[attname] = 'int' - elif re.match("^text", typname): - l[attname] = 'text' - elif re.match("^char", typname): - l[attname] = 'text' - elif re.match("^name", typname): - l[attname] = 'text' - elif re.match("^abstime", typname): - l[attname] = 'date' - elif re.match("^date", typname): - l[attname] = 'date' - elif re.match("^timestamp", typname): - l[attname] = 'date' - elif re.match("^bool", typname): - l[attname] = 'bool' - elif re.match("^float", typname): - l[attname] = 'decimal' - elif re.match("^money", typname): - l[attname] = 'money' - else: - l[attname] = 'text' - - l['oid'] = 'int' # every table has this - self.__attnames__[cl] = l # cache it - return self.__attnames__[cl] - - # return a tuple from a database - def get(self, cl, arg, keyname = None, view = 0): - if cl[-1] == '*': # need parent table name - xcl = cl[:-1] - else: - xcl = cl - - if keyname == None: # use the primary key by default - keyname = self.__pkeys__[xcl] - - fnames = self.get_attnames(xcl) - - if type(arg) == type({}): - # To allow users to work with multiple tables we munge the - # name when the key is "oid" - if keyname == 'oid': k = arg['oid_%s' % xcl] - else: k = arg[keyname] - else: - k = arg - arg = {} - - # We want the oid for later updates if that isn't the key - if keyname == 'oid': - q = "SELECT * FROM %s WHERE oid = %s" % (cl, k) - elif view: - q = "SELECT * FROM %s WHERE %s = %s" % \ - (cl, keyname, _quote(k, fnames[keyname])) - else: - q = "SELECT oid AS oid_%s, %s FROM %s WHERE %s = %s" % \ - (xcl, string.join(fnames.keys(), ','),\ - cl, keyname, _quote(k, fnames[keyname])) - - if self.debug != None: print self.debug % q - res = self.db.query(q).dictresult() - if res == []: - raise error, \ - "No such record in %s where %s is %s" % \ - (cl, keyname, _quote(k, fnames[keyname])) - return None - - for k in res[0].keys(): - arg[k] = res[0][k] - - return arg - - # Inserts a new tuple into a table - # We currently don't support insert into views although PostgreSQL does - def insert(self, cl, a): - fnames = self.get_attnames(cl) - l = [] - n = [] - for f in fnames.keys(): - if f != 'oid' and a.has_key(f): - l.append(_quote(a[f], fnames[f])) - n.append(f) - - try: - q = "INSERT INTO %s (%s) VALUES (%s)" % \ - (cl, string.join(n, ','), string.join(l, ',')) - if self.debug != None: print self.debug % q - a['oid_%s' % cl] = self.db.query(q) - except: - raise error, "Error inserting into %s: %s" % (cl, sys.exc_value) - - # reload the dictionary to catch things modified by engine - # note that get() changes 'oid' below to oid_table - # if no read perms (it can and does happen) return None - try: return self.get(cl, a, 'oid') - except: return None - - # Update always works on the oid which get returns if available - # otherwise use the primary key. Fail if neither. - def update(self, cl, a): - foid = 'oid_%s' % cl - if a.has_key(foid): - where = "oid = %s" % a[foid] - elif self.__pkeys__.has_key(cl) and a.has_key(self.__pkeys__[cl]): - where = "%s = '%s'" % (self.__pkeys__[cl], a[self.__pkeys__[cl]]) - else: - raise error, "Update needs primary key or oid as %s" % foid - - v = [] - k = 0 - fnames = self.get_attnames(cl) - - for ff in fnames.keys(): - if ff != 'oid' and a.has_key(ff): - v.append("%s = %s" % (ff, _quote(a[ff], fnames[ff]))) - - if v == []: - return None - - try: - q = "UPDATE %s SET %s WHERE %s" % \ - (cl, string.join(v, ','), where) - if self.debug != None: print self.debug % q - self.db.query(q) - except: - raise error, "Can't update %s: %s" % (cl, sys.exc_value) - - # reload the dictionary to catch things modified by engine - if a.has_key(foid): - return self.get(cl, a, 'oid') - else: - return self.get(cl, a) - - # At some point we will need a way to get defaults from a table - def clear(self, cl, a = {}): - fnames = self.get_attnames(cl) - for ff in fnames.keys(): - if fnames[ff] in ['int', 'decimal', 'seq', 'money']: - a[ff] = 0 - else: - a[ff] = "" - - a['oid'] = 0 - return a - - # Like update, delete works on the oid - # one day we will be testing that the record to be deleted - # isn't referenced somewhere (or else PostgreSQL will) - def delete(self, cl, a): - try: - q = "DELETE FROM %s WHERE oid = %s" % (cl, a['oid_%s' % cl]) - if self.debug != None: print self.debug % q - self.db.query(q) - except: - raise error, "Can't delete %s: %s" % (cl, sys.exc_value) - - return None - diff --git a/src/interfaces/python/pgdb.py b/src/interfaces/python/pgdb.py deleted file mode 100644 index 6ae63b9b681..00000000000 --- a/src/interfaces/python/pgdb.py +++ /dev/null @@ -1,446 +0,0 @@ -""" pgdb - DB-SIG compliant module for PygreSQL. - - (c) 1999, Pascal Andre <andre@via.ecp.fr>. - See package documentation for further information on copyright. - - Inline documentation is sparse. See DB-SIG 2.0 specification for - usage information. - - basic usage: - - pgdb.connect(connect_string) -> connection - connect_string = 'host:database:user:password:opt:tty' - All parts are optional. You may also pass host through - password as keyword arguments. To pass a port, pass it in - the host keyword parameter: - pgdb.connect(host='localhost:5432') - - connection.cursor() -> cursor - - connection.commit() - - connection.close() - - connection.rollback() - - cursor.execute(query[, params]) - execute a query, binding params (a dictionary) if it is - passed. The binding syntax is the same as the % operator - for dictionaries, and no quoting is done. - - cursor.executemany(query, list of params) - execute a query many times, binding each param dictionary - from the list. - - cursor.fetchone() -> [value, value, ...] - - cursor.fetchall() -> [[value, value, ...], ...] - - cursor.fetchmany([size]) -> [[value, value, ...], ...] - returns size or cursor.arraysize number of rows from result - set. Default cursor.arraysize is 1. - - cursor.description -> [(column_name, type_name, display_size, - internal_size, precision, scale, null_ok), ...] - - Note that precision, scale and null_ok are not implemented. - - cursor.rowcount - number of rows available in the result set. Available after - a call to execute. - - cursor.close() - -""" - -import _pg -import string -import exceptions -import types -import time -import types - -# Marc-Andre is changing where DateTime goes. This handles it either way. -try: from mx import DateTime -except ImportError: import DateTime - -### module constants - -# compliant with DB SIG 2.0 -apilevel = '2.0' - -# module may be shared, but not connections -threadsafety = 1 - -# this module use extended python format codes -paramstyle = 'pyformat' - -### exception hierarchy - -class Warning(StandardError): - pass - -class Error(StandardError): - pass - -class InterfaceError(Error): - pass - -class DatabaseError(Error): - pass - -class DataError(DatabaseError): - pass - -class OperationalError(DatabaseError): - pass - -class IntegrityError(DatabaseError): - pass - -class InternalError(DatabaseError): - pass - -class ProgrammingError(DatabaseError): - pass - -class NotSupportedError(DatabaseError): - pass - -### internal type handling class -class pgdbTypeCache: - - def __init__(self, cnx): - self.__source = cnx.source() - self.__type_cache = {} - - def typecast(self, typ, value): - # for NULL values, no typecast is necessary - if value == None: - return value - - if typ == STRING: - pass - elif typ == BINARY: - pass - elif typ == BOOL: - value = (value[:1] in ['t','T']) - elif typ == INTEGER: - value = int(value) - elif typ == LONG: - value = long(value) - elif typ == FLOAT: - value = float(value) - elif typ == MONEY: - value = string.replace(value, "$", "") - value = string.replace(value, ",", "") - value = float(value) - elif typ == DATETIME: - # format may differ ... we'll give string - pass - elif typ == ROWID: - value = long(value) - return value - - def getdescr(self, oid): - try: - return self.__type_cache[oid] - except: - self.__source.execute( - "SELECT typname, typprtlen, typlen " - "FROM pg_type WHERE oid = %s" % oid - ) - res = self.__source.fetch(1)[0] - # column name is omitted from the return value. It will - # have to be prepended by the caller. - res = ( - res[0], - string.atoi(res[1]), string.atoi(res[2]), - None, None, None - ) - self.__type_cache[oid] = res - return res - -### cursor object - -class pgdbCursor: - - def __init__(self, src, cache): - self.__cache = cache - self.__source = src - self.description = None - self.rowcount = -1 - self.arraysize = 1 - - def close(self): - self.__source.close() - self.description = None - self.rowcount = -1 - - def execute(self, operation, params = None): - # "The parameters may also be specified as list of - # tuples to e.g. insert multiple rows in a single - # operation, but this kind of usage is depreciated: - if params and type(params) == types.ListType and \ - type(params[0]) == types.TupleType: - self.executemany(operation, params) - else: - # not a list of tuples - self.executemany(operation, (params,)) - - def executemany(self, operation, param_seq): - self.description = None - self.rowcount = -1 - - # first try to execute all queries - totrows = 0 - sql = "INIT" - try: - for params in param_seq: - if params != None: - sql = _quoteparams(operation, params) - else: - sql = operation - rows = self.__source.execute(sql) - if rows != None: # true is __source is NOT a DQL - totrows = totrows + rows - except _pg.error, msg: - raise DatabaseError, "error '%s' in '%s'" % ( msg, sql ) - except: - raise OperationalError, "internal error in '%s'" % sql - - # then initialize result raw count and description - if self.__source.resulttype == _pg.RESULT_DQL: - self.rowcount = self.__source.ntuples - d = [] - for typ in self.__source.listinfo(): - # listinfo is a sequence of - # (index, column_name, type_oid) - # getdescr returns all items needed for a - # description tuple except the column_name. - desc = typ[1:2]+self.__cache.getdescr(typ[2]) - d.append(desc) - self.description = d - else: - self.rowcount = totrows - self.description = None - - def fetchone(self): - res = self.fetchmany(1, 0) - try: - return res[0] - except: - return None - - def fetchall(self): - return self.fetchmany(-1, 0) - - def fetchmany(self, size = None, keep = 1): - if size == None: - size = self.arraysize - if keep == 1: - self.arraysize = size - res = self.__source.fetch(size) - result = [] - for r in res: - row = [] - for i in range(len(r)): - row.append(self.__cache.typecast( - self.description[i][1], - r[i] - ) - ) - result.append(row) - return result - - def setinputsizes(self, sizes): - pass - - def setoutputsize(self, size, col = 0): - pass - - -try: - _quote = _pg.quote_fast - _quoteparams = _pg.quoteparams_fast -except (NameError, AttributeError): - def _quote(x): - if type(x) == DateTime.DateTimeType: - x = str(x) - if type(x) == types.StringType: - x = "'" + string.replace( - string.replace(str(x), '\\', '\\\\'), "'", "''") + "'" - - elif type(x) in (types.IntType, types.LongType, types.FloatType): - pass - elif x is None: - x = 'NULL' - elif type(x) in (types.ListType, types.TupleType): - x = '(%s)' % string.join(map(lambda x: str(_quote(x)), x), ',') - elif hasattr(x, '__pg_repr__'): - x = x.__pg_repr__() - else: - raise InterfaceError, 'do not know how to handle type %s' % type(x) - - return x - - def _quoteparams(s, params): - if hasattr(params, 'has_key'): - x = {} - for k, v in params.items(): - x[k] = _quote(v) - params = x - else: - params = tuple(map(_quote, params)) - - return s % params - -### connection object - -class pgdbCnx: - - def __init__(self, cnx): - self.__cnx = cnx - self.__cache = pgdbTypeCache(cnx) - try: - src = self.__cnx.source() - src.execute("BEGIN") - except: - raise OperationalError, "invalid connection." - - def close(self): - self.__cnx.close() - - def commit(self): - try: - src = self.__cnx.source() - src.execute("COMMIT") - src.execute("BEGIN") - except: - raise OperationalError, "can't commit." - - def rollback(self): - try: - src = self.__cnx.source() - src.execute("ROLLBACK") - src.execute("BEGIN") - except: - raise OperationalError, "can't rollback." - - def cursor(self): - try: - src = self.__cnx.source() - return pgdbCursor(src, self.__cache) - except: - raise pgOperationalError, "invalid connection." - -### module interface - -# connects to a database -def connect(dsn = None, user = None, password = None, host = None, database = None): - # first get params from DSN - dbport = -1 - dbhost = "" - dbbase = "" - dbuser = "" - dbpasswd = "" - dbopt = "" - dbtty = "" - try: - params = string.split(dsn, ":") - dbhost = params[0] - dbbase = params[1] - dbuser = params[2] - dbpasswd = params[3] - dbopt = params[4] - dbtty = params[5] - except: - pass - - # override if necessary - if user != None: - dbuser = user - if password != None: - dbpasswd = password - if database != None: - dbbase = database - if host != None: - try: - params = string.split(host, ":") - dbhost = params[0] - dbport = int(params[1]) - except: - pass - - # empty host is localhost - if dbhost == "": - dbhost = None - if dbuser == "": - dbuser = None - - # open the connection - cnx = _pg.connect(dbbase, dbhost, dbport, dbopt, - dbtty, dbuser, dbpasswd) - return pgdbCnx(cnx) - -### types handling - -# PostgreSQL is object-oriented: types are dynamic. We must thus use type names -# as internal type codes. - -class pgdbType: - - def __init__(self, *values): - self.values= values - - def __cmp__(self, other): - if other in self.values: - return 0 - if other < self.values: - return 1 - else: - return -1 - -STRING = pgdbType( - 'char', 'bpchar', 'name', 'text', 'varchar' -) - -# BLOB support is pg specific -BINARY = pgdbType() -INTEGER = pgdbType('int2', 'int4', 'serial') -LONG = pgdbType('int8') -FLOAT = pgdbType('float4', 'float8', 'numeric') -BOOL = pgdbType('bool') -MONEY = pgdbType('money') - -# this may be problematic as type are quite different ... I hope it won't hurt -DATETIME = pgdbType( - 'abstime', 'reltime', 'tinterval', 'date', 'time', 'timespan', 'timestamp', 'timestamptz', 'interval' -) - -# OIDs are used for everything (types, tables, BLOBs, rows, ...). This may cause -# confusion, but we are unable to find out what exactly is behind the OID (at -# least not easily enough). Should this be undefined as BLOBs ? -ROWID = pgdbType( - 'oid', 'oid8' -) - -# mandatory type helpers -def Date(year, month, day): - return DateTime.DateTime(year, month, day) - -def Time(hour, minute, second): - return DateTime.TimeDelta(hour, minute, second) - -def Timestamp(year, month, day, hour, minute, second): - return DateTime.DateTime(year, month, day, hour, minute, second) - -def DateFromTicks(ticks): - return apply(Date, time.localtime(ticks)[:3]) - -def TimeFromTicks(ticks): - return apply(Time, time.localtime(ticks)[3:6]) - -def TimestampFromTicks(ticks): - return apply(Timestamp, time.localtime(ticks)[:6]) - diff --git a/src/interfaces/python/pgmodule.c b/src/interfaces/python/pgmodule.c deleted file mode 100644 index df685902531..00000000000 --- a/src/interfaces/python/pgmodule.c +++ /dev/null @@ -1,3218 +0,0 @@ -/* - * PyGres, version 2.2 A Python interface for PostgreSQL database. Written by - * D'Arcy J.M. Cain, (darcy@druid.net). Based heavily on code written by - * Pascal Andre, andre@chimay.via.ecp.fr. Copyright (c) 1995, Pascal Andre - * (andre@via.ecp.fr). - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without a written - * agreement is hereby granted, provided that the above copyright notice and - * this paragraph and the following two paragraphs appear in all copies or in - * any new file that contains a substantial portion of this file. - * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, - * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE - * AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE - * AUTHOR HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, - * ENHANCEMENTS, OR MODIFICATIONS. - * - * Further modifications copyright 1997, 1998, 1999 by D'Arcy J.M. Cain - * (darcy@druid.net) subject to the same terms and conditions as above. - * - */ - -#include <Python.h> -#include "postgres.h" -#include "libpq-fe.h" -#include "libpq/libpq-fs.h" -#include "catalog/pg_type.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -/* PyObject_Del does not exist in older versions of Python. */ -#if PY_VERSION_HEX < 0x01060000 -#define PyObject_Del(op) PyMem_DEL((op)) -#endif - -static PyObject *PGError; -static const char *PyPgVersion = "3.4 (beta)"; - -/* taken from fileobject.c */ -#define BUF(v) PyString_AS_STRING((PyStringObject *)(v)) - -/* default values */ -#define MODULE_NAME "pgsql" -#define ARRAYSIZE 1 - -/* flags for object validity checks */ -#define CHECK_OPEN 1 -#define CHECK_CLOSE 2 -#define CHECK_CNX 4 -#define CHECK_RESULT 8 -#define CHECK_DQL 16 - -/* query result types */ -#define RESULT_EMPTY 1 -#define RESULT_DML 2 -#define RESULT_DDL 3 -#define RESULT_DQL 4 - -/* flags for move methods */ -#define QUERY_MOVEFIRST 1 -#define QUERY_MOVELAST 2 -#define QUERY_MOVENEXT 3 -#define QUERY_MOVEPREV 4 - -/* moves names for errors */ -const char *__movename[5] = -{"", "movefirst", "movelast", "movenext", "moveprev"}; - -#define MAX_BUFFER_SIZE 8192 /* maximum transaction size */ - -#ifndef NO_DIRECT -#define DIRECT_ACCESS 1 /* enables direct access functions */ -#endif /* NO_DIRECT */ - -#ifndef NO_LARGE -#define LARGE_OBJECTS 1 /* enables large objects support */ -#endif /* NO_LARGE */ - -#ifndef NO_DEF_VAR -#define DEFAULT_VARS 1 /* enables default variables use */ -#endif /* NO_DEF_VAR */ - -#ifdef MS_WIN32 -#define NO_SNPRINTF 1 -#endif - -/* --------------------------------------------------------------------- */ - -/* MODULE GLOBAL VARIABLES */ - -#ifdef DEFAULT_VARS - -static PyObject *pg_default_host; /* default database host */ -static PyObject *pg_default_base; /* default database name */ -static PyObject *pg_default_opt; /* default connection options */ -static PyObject *pg_default_tty; /* default debug tty */ -static PyObject *pg_default_port; /* default connection port */ -static PyObject *pg_default_user; /* default username */ -static PyObject *pg_default_passwd; /* default password */ -#endif /* DEFAULT_VARS */ - -DL_EXPORT(void) init_pg(void); -int *get_type_array(PGresult *result, int nfields); - -/* --------------------------------------------------------------------- */ -/* OBJECTS DECLARATION */ - -/* pg connection object */ - -typedef struct -{ - PyObject_HEAD - int valid; /* validity flag */ - PGconn *cnx; /* PostGres connection handle */ - PGresult *last_result; /* last result content */ -} pgobject; - -staticforward PyTypeObject PgType; - -#define is_pgobject(v) ((v)->ob_type == &PgType) - -static PyObject * -pgobject_New(void) -{ - pgobject *pgobj; - - if ((pgobj = PyObject_NEW(pgobject, &PgType)) == NULL) - return NULL; - - pgobj->valid = 1; - pgobj->last_result = NULL; - pgobj->cnx = NULL; - return (PyObject *) pgobj; -} - -/* pg query object */ - -typedef struct -{ - PyObject_HEAD - PGresult *last_result; /* last result content */ - int result_type; /* type of previous result */ - long current_pos; /* current position in last result */ - long num_rows; /* number of (affected) rows */ -} pgqueryobject; - -staticforward PyTypeObject PgQueryType; - -#define is_pgqueryobject(v) ((v)->ob_type == &PgQueryType) - -/* pg source object */ - -typedef struct -{ - PyObject_HEAD - int valid; /* validity flag */ - pgobject *pgcnx; /* parent connection object */ - PGresult *last_result; /* last result content */ - int result_type; /* result type (DDL/DML/DQL) */ - long arraysize; /* array size for fetch method */ - int current_row; /* current selected row */ - int max_row; /* number of rows in the result */ - int num_fields; /* number of fields in each row */ -} pgsourceobject; - -staticforward PyTypeObject PgSourceType; - -#define is_pgsourceobject(v) ((v)->ob_type == &PgSourceType) - - -#ifdef LARGE_OBJECTS -/* pg large object */ - -typedef struct -{ - PyObject_HEAD - pgobject * pgcnx; /* parent connection object */ - Oid lo_oid; /* large object oid */ - int lo_fd; /* large object fd */ -} pglargeobject; - -staticforward PyTypeObject PglargeType; - -#define is_pglargeobject(v) ((v)->ob_type == &PglargeType) -#endif /* LARGE_OBJECTS */ - -/* --------------------------------------------------------------------- */ -/* INTERNAL FUNCTIONS */ - -/* checks connection validity */ -static int -check_cnx_obj(pgobject * self) -{ - if (!self->valid) - { - PyErr_SetString(PGError, "connection has been closed"); - return 0; - } - return 1; -} - -#ifdef LARGE_OBJECTS -/* checks large object validity */ -static int -check_lo_obj(pglargeobject * self, int level) -{ - if (!check_cnx_obj(self->pgcnx)) - return 0; - - if (!self->lo_oid) - { - PyErr_SetString(PGError, "object is not valid (null oid)."); - return 0; - } - - if (level & CHECK_OPEN) - { - if (self->lo_fd < 0) - { - PyErr_SetString(PyExc_IOError, "object is not opened."); - return 0; - } - } - - if (level & CHECK_CLOSE) - { - if (self->lo_fd >= 0) - { - PyErr_SetString(PyExc_IOError, "object is already opened."); - return 0; - } - } - - return 1; -} -#endif /* LARGE_OBJECTS */ - -/* checks source object validity */ -static int -check_source_obj(pgsourceobject * self, int level) -{ - if (!self->valid) - { - PyErr_SetString(PGError, "object has been closed"); - return 0; - } - - if ((level & CHECK_RESULT) && self->last_result == NULL) - { - PyErr_SetString(PGError, "no result."); - return 0; - } - - if ((level & CHECK_DQL) && self->result_type != RESULT_DQL) - { - PyErr_SetString(PGError, "last query did not return tuples."); - return 0; - } - - if ((level & CHECK_CNX) && !check_cnx_obj(self->pgcnx)) - return 0; - - return 1; -} - -/* shared functions for converting PG types to Python types */ -int * -get_type_array(PGresult *result, int nfields) -{ - int *typ; - int j; - - if ((typ = malloc(sizeof(int) * nfields)) == NULL) - { - PyErr_SetString(PyExc_SyntaxError, "memory error in getresult()."); - return NULL; - } - - for (j = 0; j < nfields; j++) - { - switch (PQftype(result, j)) - { - case INT2OID: - case INT4OID: - case INT8OID: - case OIDOID: - typ[j] = 1; - break; - - case FLOAT4OID: - case FLOAT8OID: - case NUMERICOID: - typ[j] = 2; - break; - - case CASHOID: - typ[j] = 3; - break; - - default: - typ[j] = 4; - break; - } - } - - return typ; -} - - -/* prototypes for constructors */ -static pgsourceobject *pgsource_new(pgobject * pgcnx); - -/* --------------------------------------------------------------------- */ -/* PG SOURCE OBJECT IMPLEMENTATION */ - -/* constructor (internal use only) */ -static pgsourceobject * -pgsource_new(pgobject * pgcnx) -{ - pgsourceobject *npgobj; - - /* allocates new query object */ - if ((npgobj = PyObject_NEW(pgsourceobject, &PgSourceType)) == NULL) - return NULL; - - /* initializes internal parameters */ - Py_XINCREF(pgcnx); - npgobj->pgcnx = pgcnx; - npgobj->last_result = NULL; - npgobj->valid = 1; - npgobj->arraysize = ARRAYSIZE; - - return npgobj; -} - -/* destructor */ -static void -pgsource_dealloc(pgsourceobject * self) -{ - if (self->last_result) - PQclear(self->last_result); - - Py_XDECREF(self->pgcnx); - PyObject_Del(self); -} - -/* closes object */ -static char pgsource_close__doc__[] = -"close() -- close query object without deleting it. " -"All instances of the query object can no longer be used after this call."; - -static PyObject * -pgsource_close(pgsourceobject * self, PyObject * args) -{ - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_TypeError, "method close() takes no parameter."); - return NULL; - } - - /* frees result if necessary and invalidates object */ - if (self->last_result) - { - PQclear(self->last_result); - self->result_type = RESULT_EMPTY; - self->last_result = NULL; - } - - self->valid = 0; - - /* return None */ - Py_INCREF(Py_None); - return Py_None; -} - -/* database query */ -static char pgsource_execute__doc__[] = -"execute(sql) -- execute a SQL statement (string).\n " -"On success, this call returns the number of affected rows, " -"or None for DQL (SELECT, ...) statements.\n" -"The fetch (fetch(), fetchone() and fetchall()) methods can be used " -"to get result rows."; - -static PyObject * -pgsource_execute(pgsourceobject * self, PyObject * args) -{ - char *query; - const char *temp; - long num_rows; - - /* checks validity */ - if (!check_source_obj(self, CHECK_CNX)) - return NULL; - - /* get query args */ - if (!PyArg_ParseTuple(args, "s", &query)) - { - PyErr_SetString(PyExc_TypeError, "execute(sql), with sql (string)."); - return NULL; - } - - /* frees previous result */ - if (self->last_result) - { - PQclear(self->last_result); - self->last_result = NULL; - } - self->max_row = 0; - self->current_row = 0; - self->num_fields = 0; - - /* gets result */ - Py_BEGIN_ALLOW_THREADS - self->last_result = PQexec(self->pgcnx->cnx, query); - Py_END_ALLOW_THREADS - - /* checks result validity */ - if (!self->last_result) - { - PyErr_SetString(PyExc_ValueError, PQerrorMessage(self->pgcnx->cnx)); - return NULL; - } - - /* checks result status */ - switch (PQresultStatus(self->last_result)) - { - - /* query succeeded */ - case PGRES_TUPLES_OK: /* DQL: returns None (DB-SIG compliant) */ - self->result_type = RESULT_DQL; - self->max_row = PQntuples(self->last_result); - self->num_fields = PQnfields(self->last_result); - Py_INCREF(Py_None); - return Py_None; - case PGRES_COMMAND_OK: /* other requests */ - case PGRES_COPY_OUT: - case PGRES_COPY_IN: - self->result_type = RESULT_DDL; - temp = PQcmdTuples(self->last_result); - num_rows = 1; - if (temp[0] != 0) - { - self->result_type = RESULT_DML; - num_rows = atol(temp); - } - return PyInt_FromLong(num_rows); - - /* query failed */ - case PGRES_EMPTY_QUERY: - PyErr_SetString(PyExc_ValueError, "empty query."); - break; - case PGRES_BAD_RESPONSE: - case PGRES_FATAL_ERROR: - case PGRES_NONFATAL_ERROR: - PyErr_SetString(PGError, PQerrorMessage(self->pgcnx->cnx)); - break; - default: - PyErr_SetString(PGError, "internal error: " - "unknown result status."); - break; - } - - /* frees result and returns error */ - PQclear(self->last_result); - self->last_result = NULL; - self->result_type = RESULT_EMPTY; - return NULL; -} - -/* gets oid status for last query (valid for INSERTs, 0 for other) */ -static char pgsource_oidstatus__doc__[] = -"oidstatus() -- return oid of last inserted row (if available)."; - -static PyObject * -pgsource_oidstatus(pgsourceobject * self, PyObject * args) -{ - long oid; - - /* checks validity */ - if (!check_source_obj(self, CHECK_RESULT)) - return NULL; - - /* checks args */ - if ((args != NULL) && (!PyArg_ParseTuple(args, ""))) - { - PyErr_SetString(PyExc_SyntaxError, - "method oidstatus() takes no parameters."); - return NULL; - } - - /* retrieves oid status */ - if ((oid = PQoidValue(self->last_result)) == InvalidOid) - oid = 0; - - return PyInt_FromLong(oid); -} - -/* fetches rows from last result */ -static char pgsource_fetch__doc__[] = -"fetch(num) -- return the next num rows from the last result in a list. " -"If num parameter is omitted arraysize attribute value is used. " -"If size equals -1, all rows are fetched."; - -static PyObject * -pgsource_fetch(pgsourceobject * self, PyObject * args) -{ - PyObject *rowtuple, - *reslist, - *str; - int i, - j; - long size; - - /* checks validity */ - if (!check_source_obj(self, CHECK_RESULT | CHECK_DQL)) - return NULL; - - /* checks args */ - size = self->arraysize; - if (!PyArg_ParseTuple(args, "|l", &size)) - { - PyErr_SetString(PyExc_SyntaxError, - "fetch(num), with num (integer, optional)."); - return NULL; - } - - /* seeks last line */ - /* limit size to be within the amount of data we actually have */ - if (size == -1 || (self->max_row - self->current_row) < size) - size = self->max_row - self->current_row; - - /* allocate list for result */ - if ((reslist = PyList_New(0)) == NULL) - return NULL; - - /* builds result */ - for (i = 0; i < size; ++i) - { - if ((rowtuple = PyTuple_New(self->num_fields)) == NULL) - { - Py_DECREF(reslist); - return NULL; - } - - for (j = 0; j < self->num_fields; j++) - { - if (PQgetisnull(self->last_result, self->current_row, j)) - { - Py_INCREF(Py_None); - str = Py_None; - } - else - str = PyString_FromString(PQgetvalue(self->last_result, self->current_row, j)); - - PyTuple_SET_ITEM(rowtuple, j, str); - } - - PyList_Append(reslist, rowtuple); - Py_DECREF(rowtuple); - self->current_row++; - } - - return reslist; -} - -/* changes current row (internal wrapper for all "move" methods) */ -static PyObject * -pgsource_move(pgsourceobject * self, PyObject * args, int move) -{ - /* checks validity */ - if (!check_source_obj(self, CHECK_RESULT | CHECK_DQL)) - return NULL; - - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - char errbuf[256]; - -#ifdef NO_SNPRINTF - sprintf(errbuf, "method %s() takes no parameter.", __movename[move]); -#else - snprintf(errbuf, sizeof(errbuf), - "method %s() takes no parameter.", __movename[move]); -#endif - - PyErr_SetString(PyExc_SyntaxError, errbuf); - return NULL; - } - - /* changes the current row */ - switch (move) - { - case QUERY_MOVEFIRST: - self->current_row = 0; - break; - case QUERY_MOVELAST: - self->current_row = self->max_row - 1; - break; - case QUERY_MOVENEXT: - if (self->current_row != self->max_row) - self->current_row++; - break; - case QUERY_MOVEPREV: - if (self->current_row > 0) - self->current_row--; - break; - } - - Py_INCREF(Py_None); - return Py_None; -} - -/* move to first result row */ -static char pgsource_movefirst__doc__[] = -"movefirst() -- move to first result row."; - -static PyObject * -pgsource_movefirst(pgsourceobject * self, PyObject * args) -{ - return pgsource_move(self, args, QUERY_MOVEFIRST); -} - -/* move to last result row */ -static char pgsource_movelast__doc__[] = -"movelast() -- move to last valid result row."; - -static PyObject * -pgsource_movelast(pgsourceobject * self, PyObject * args) -{ - return pgsource_move(self, args, QUERY_MOVELAST); -} - -/* move to next result row */ -static char pgsource_movenext__doc__[] = -"movenext() -- move to next result row."; - -static PyObject * -pgsource_movenext(pgsourceobject * self, PyObject * args) -{ - return pgsource_move(self, args, QUERY_MOVENEXT); -} - -/* move to previous result row */ -static char pgsource_moveprev__doc__[] = -"moveprev() -- move to previous result row."; - -static PyObject * -pgsource_moveprev(pgsourceobject * self, PyObject * args) -{ - return pgsource_move(self, args, QUERY_MOVEPREV); -} - -/* finds field number from string/integer (internal use only) */ -static int -pgsource_fieldindex(pgsourceobject * self, PyObject * param, const char *usage) -{ - int num; - - /* checks validity */ - if (!check_source_obj(self, CHECK_RESULT | CHECK_DQL)) - return -1; - - /* gets field number */ - if (PyString_Check(param)) - num = PQfnumber(self->last_result, PyString_AsString(param)); - else if (PyInt_Check(param)) - num = PyInt_AsLong(param); - else - { - PyErr_SetString(PyExc_TypeError, usage); - return -1; - } - - /* checks field validity */ - if (num < 0 || num >= self->num_fields) - { - PyErr_SetString(PyExc_ValueError, "Unknown field."); - return -1; - } - - return num; -} - -/* builds field information from position (internal use only) */ -static PyObject * -pgsource_buildinfo(pgsourceobject * self, int num) -{ - PyObject *result; - - /* allocates tuple */ - result = PyTuple_New(3); - if (!result) - return NULL; - - /* affects field information */ - PyTuple_SET_ITEM(result, 0, PyInt_FromLong(num)); - PyTuple_SET_ITEM(result, 1, - PyString_FromString(PQfname(self->last_result, num))); - PyTuple_SET_ITEM(result, 2, - PyInt_FromLong(PQftype(self->last_result, num))); - - return result; -} - -/* lists fields info */ -static char pgsource_listinfo__doc__[] = -"listinfo() -- return information for all fields " -"(position, name, type oid)."; - -static PyObject * -pgsource_listinfo(pgsourceobject * self, PyObject * args) -{ - int i; - PyObject *result, - *info; - - /* checks validity */ - if (!check_source_obj(self, CHECK_RESULT | CHECK_DQL)) - return NULL; - - /* gets args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_TypeError, - "method listinfo() takes no parameter."); - return NULL; - } - - /* builds result */ - if ((result = PyTuple_New(self->num_fields)) == NULL) - return NULL; - - for (i = 0; i < self->num_fields; i++) - { - info = pgsource_buildinfo(self, i); - if (!info) - { - Py_DECREF(result); - return NULL; - } - PyTuple_SET_ITEM(result, i, info); - } - - /* returns result */ - return result; -}; - -/* list fields information for last result */ -static char pgsource_fieldinfo__doc__[] = -"fieldinfo(string|integer) -- return specified field information " -"(position, name, type oid)."; - -static PyObject * -pgsource_fieldinfo(pgsourceobject * self, PyObject * args) -{ - static const char short_usage[] = - "fieldinfo(desc), with desc (string|integer)."; - int num; - PyObject *param; - - /* gets args */ - if (!PyArg_ParseTuple(args, "O", ¶m)) - { - PyErr_SetString(PyExc_TypeError, short_usage); - return NULL; - } - - /* checks args and validity */ - if ((num = pgsource_fieldindex(self, param, short_usage)) == -1) - return NULL; - - /* returns result */ - return pgsource_buildinfo(self, num); -}; - -/* retrieve field value */ -static char pgsource_field__doc__[] = -"field(string|integer) -- return specified field value."; - -static PyObject * -pgsource_field(pgsourceobject * self, PyObject * args) -{ - static const char short_usage[] = - "field(desc), with desc (string|integer)."; - int num; - PyObject *param; - - /* gets args */ - if (!PyArg_ParseTuple(args, "O", ¶m)) - { - PyErr_SetString(PyExc_TypeError, short_usage); - return NULL; - } - - /* checks args and validity */ - if ((num = pgsource_fieldindex(self, param, short_usage)) == -1) - return NULL; - - return PyString_FromString(PQgetvalue(self->last_result, - self->current_row, num)); -} - -/* query object methods */ -static PyMethodDef pgsource_methods[] = { - {"close", (PyCFunction) pgsource_close, 1, - pgsource_close__doc__}, - {"execute", (PyCFunction) pgsource_execute, 1, - pgsource_execute__doc__}, - {"oidstatus", (PyCFunction) pgsource_oidstatus, 1, - pgsource_oidstatus__doc__}, - {"fetch", (PyCFunction) pgsource_fetch, 1, - pgsource_fetch__doc__}, - {"movefirst", (PyCFunction) pgsource_movefirst, 1, - pgsource_movefirst__doc__}, - {"movelast", (PyCFunction) pgsource_movelast, 1, - pgsource_movelast__doc__}, - {"movenext", (PyCFunction) pgsource_movenext, 1, - pgsource_movenext__doc__}, - {"moveprev", (PyCFunction) pgsource_moveprev, 1, - pgsource_moveprev__doc__}, - {"field", (PyCFunction) pgsource_field, 1, - pgsource_field__doc__}, - {"fieldinfo", (PyCFunction) pgsource_fieldinfo, 1, - pgsource_fieldinfo__doc__}, - {"listinfo", (PyCFunction) pgsource_listinfo, 1, - pgsource_listinfo__doc__}, - {NULL, NULL} -}; - -/* gets query object attributes */ -static PyObject * -pgsource_getattr(pgsourceobject * self, char *name) -{ - /* pg connection object */ - if (!strcmp(name, "pgcnx")) - { - if (check_source_obj(self, 0)) - { - Py_INCREF(self->pgcnx); - return (PyObject *) (self->pgcnx); - } - Py_INCREF(Py_None); - return Py_None; - } - - /* arraysize */ - if (!strcmp(name, "arraysize")) - return PyInt_FromLong(self->arraysize); - - /* resulttype */ - if (!strcmp(name, "resulttype")) - return PyInt_FromLong(self->result_type); - - /* ntuples */ - if (!strcmp(name, "ntuples")) - return PyInt_FromLong(self->max_row); - - /* nfields */ - if (!strcmp(name, "nfields")) - return PyInt_FromLong(self->num_fields); - - /* attributes list */ - if (!strcmp(name, "__members__")) - { - PyObject *list = PyList_New(5); - - PyList_SET_ITEM(list, 0, PyString_FromString("pgcnx")); - PyList_SET_ITEM(list, 1, PyString_FromString("arraysize")); - PyList_SET_ITEM(list, 2, PyString_FromString("resulttype")); - PyList_SET_ITEM(list, 3, PyString_FromString("ntuples")); - PyList_SET_ITEM(list, 4, PyString_FromString("nfields")); - - return list; - } - - /* module name */ - if (!strcmp(name, "__module__")) - return PyString_FromString(MODULE_NAME); - - /* class name */ - if (!strcmp(name, "__class__")) - return PyString_FromString("pgsource"); - - /* seeks name in methods (fallback) */ - return Py_FindMethod(pgsource_methods, (PyObject *) self, name); -} - -/* sets query object attributes */ -static int -pgsource_setattr(pgsourceobject * self, char *name, PyObject * v) -{ - /* arraysize */ - if (!strcmp(name, "arraysize")) - { - if (!PyInt_Check(v)) - { - PyErr_SetString(PyExc_TypeError, "arraysize must be integer."); - return -1; - } - - self->arraysize = PyInt_AsLong(v); - return 0; - } - - /* unknown attribute */ - PyErr_SetString(PyExc_TypeError, "not a writable attribute."); - return -1; -} - -/* prints query object in human readable format */ -static int -pgsource_print(pgsourceobject * self, FILE *fp, int flags) -{ - PQprintOpt op; - - switch (self->result_type) - { - case RESULT_DQL: - memset(&op, 0, sizeof(op)); - op.align = 1; - op.header = 1; - op.fieldSep = "|"; - op.pager = 1; - PQprint(fp, self->last_result, &op); - break; - case RESULT_DDL: - case RESULT_DML: - fputs(PQcmdStatus(self->last_result), fp); - break; - case RESULT_EMPTY: - default: - fputs("Empty PostgreSQL source object.", fp); - break; - } - - return 0; -} - -/* query type definition */ -staticforward PyTypeObject PgSourceType = { - PyObject_HEAD_INIT(NULL) - - 0, /* ob_size */ - "pgsourceobject", /* tp_name */ - sizeof(pgsourceobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor) pgsource_dealloc, /* tp_dealloc */ - (printfunc) pgsource_print, /* tp_print */ - (getattrfunc) pgsource_getattr, /* tp_getattr */ - (setattrfunc) pgsource_setattr, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ -}; - -/* --------------------------------------------------------------------- */ -/* PG "LARGE" OBJECT IMPLEMENTATION */ - -#ifdef LARGE_OBJECTS - -/* constructor (internal use only) */ -static pglargeobject * -pglarge_new(pgobject * pgcnx, Oid oid) -{ - pglargeobject *npglo; - - if ((npglo = PyObject_NEW(pglargeobject, &PglargeType)) == NULL) - return NULL; - - Py_XINCREF(pgcnx); - npglo->pgcnx = pgcnx; - npglo->lo_fd = -1; - npglo->lo_oid = oid; - - return npglo; -} - -/* destructor */ -static void -pglarge_dealloc(pglargeobject * self) -{ - if (self->lo_fd >= 0 && check_cnx_obj(self->pgcnx)) - lo_close(self->pgcnx->cnx, self->lo_fd); - - Py_XDECREF(self->pgcnx); - PyObject_Del(self); -} - -/* opens large object */ -static char pglarge_open__doc__[] = -"open(mode) -- open access to large object with specified mode " -"(INV_READ, INV_WRITE constants defined by module)."; - -static PyObject * -pglarge_open(pglargeobject * self, PyObject * args) -{ - int mode, - fd; - - /* check validity */ - if (!check_lo_obj(self, CHECK_CLOSE)) - return NULL; - - /* gets arguments */ - if (!PyArg_ParseTuple(args, "i", &mode)) - { - PyErr_SetString(PyExc_TypeError, "open(mode), with mode(integer)."); - return NULL; - } - - /* opens large object */ - if ((fd = lo_open(self->pgcnx->cnx, self->lo_oid, mode)) < 0) - { - PyErr_SetString(PyExc_IOError, "can't open large object."); - return NULL; - } - self->lo_fd = fd; - - /* no error : returns Py_None */ - Py_INCREF(Py_None); - return Py_None; -} - -/* close large object */ -static char pglarge_close__doc__[] = -"close() -- close access to large object data."; - -static PyObject * -pglarge_close(pglargeobject * self, PyObject * args) -{ - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method close() takes no parameters."); - return NULL; - } - - /* checks validity */ - if (!check_lo_obj(self, CHECK_OPEN)) - return NULL; - - /* closes large object */ - if (lo_close(self->pgcnx->cnx, self->lo_fd)) - { - PyErr_SetString(PyExc_IOError, "error while closing large object fd."); - return NULL; - } - self->lo_fd = -1; - - /* no error : returns Py_None */ - Py_INCREF(Py_None); - return Py_None; -} - -/* reads from large object */ -static char pglarge_read__doc__[] = -"read(integer) -- read from large object to sized string. " -"Object must be opened in read mode before calling this method."; - -static PyObject * -pglarge_read(pglargeobject * self, PyObject * args) -{ - int size; - PyObject *buffer; - - /* checks validity */ - if (!check_lo_obj(self, CHECK_OPEN)) - return NULL; - - /* gets arguments */ - if (!PyArg_ParseTuple(args, "i", &size)) - { - PyErr_SetString(PyExc_TypeError, "read(size), wih size (integer)."); - return NULL; - } - - if (size <= 0) - { - PyErr_SetString(PyExc_ValueError, "size must be positive."); - return NULL; - } - - /* allocate buffer and runs read */ - buffer = PyString_FromStringAndSize((char *) NULL, size); - - if ((size = lo_read(self->pgcnx->cnx, self->lo_fd, BUF(buffer), size)) < 0) - { - PyErr_SetString(PyExc_IOError, "error while reading."); - Py_XDECREF(buffer); - return NULL; - } - - /* resize buffer and returns it */ - _PyString_Resize(&buffer, size); - return buffer; -} - -/* write to large object */ -static char pglarge_write__doc__[] = -"write(string) -- write sized string to large object. " -"Object must be opened in read mode before calling this method."; - -static PyObject * -pglarge_write(pglargeobject * self, PyObject * args) -{ - char *buffer; - int size, - bufsize; - - /* checks validity */ - if (!check_lo_obj(self, CHECK_OPEN)) - return NULL; - - /* gets arguments */ - if (!PyArg_ParseTuple(args, "s#", &buffer, &bufsize)) - { - PyErr_SetString(PyExc_TypeError, - "write(buffer), with buffer (sized string)."); - return NULL; - } - - /* sends query */ - if ((size = lo_write(self->pgcnx->cnx, self->lo_fd, buffer, - bufsize)) < bufsize) - { - PyErr_SetString(PyExc_IOError, "buffer truncated during write."); - return NULL; - } - - /* no error : returns Py_None */ - Py_INCREF(Py_None); - return Py_None; -} - -/* go to position in large object */ -static char pglarge_seek__doc__[] = -"seek(off, whence) -- move to specified position. Object must be opened " -"before calling this method. whence can be SEEK_SET, SEEK_CUR or SEEK_END, " -"constants defined by module."; - -static PyObject * -pglarge_lseek(pglargeobject * self, PyObject * args) -{ - /* offset and whence are initialized to keep compiler happy */ - int ret, - offset = 0, - whence = 0; - - /* checks validity */ - if (!check_lo_obj(self, CHECK_OPEN)) - return NULL; - - /* gets arguments */ - if (!PyArg_ParseTuple(args, "ii", &offset, &whence)) - { - PyErr_SetString(PyExc_TypeError, - "lseek(offset, whence), with offset and whence (integers)."); - return NULL; - } - - /* sends query */ - if ((ret = lo_lseek(self->pgcnx->cnx, self->lo_fd, offset, whence)) == -1) - { - PyErr_SetString(PyExc_IOError, "error while moving cursor."); - return NULL; - } - - /* returns position */ - return PyInt_FromLong(ret); -} - -/* gets large object size */ -static char pglarge_size__doc__[] = -"size() -- return large object size. " -"Object must be opened before calling this method."; - -static PyObject * -pglarge_size(pglargeobject * self, PyObject * args) -{ - int start, - end; - - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method size() takes no parameters."); - return NULL; - } - - /* checks validity */ - if (!check_lo_obj(self, CHECK_OPEN)) - return NULL; - - /* gets current position */ - if ((start = lo_tell(self->pgcnx->cnx, self->lo_fd)) == -1) - { - PyErr_SetString(PyExc_IOError, "error while getting current position."); - return NULL; - } - - /* gets end position */ - if ((end = lo_lseek(self->pgcnx->cnx, self->lo_fd, 0, SEEK_END)) == -1) - { - PyErr_SetString(PyExc_IOError, "error while getting end position."); - return NULL; - } - - /* move back to start position */ - if ((start = lo_lseek(self->pgcnx->cnx, self->lo_fd, start, SEEK_SET)) == -1) - { - PyErr_SetString(PyExc_IOError, - "error while moving back to first position."); - return NULL; - } - - /* returns size */ - return PyInt_FromLong(end); -} - -/* gets large object cursor position */ -static char pglarge_tell__doc__[] = -"tell() -- give current position in large object. " -"Object must be opened before calling this method."; - -static PyObject * -pglarge_tell(pglargeobject * self, PyObject * args) -{ - int start; - - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method tell() takes no parameters."); - return NULL; - } - - /* checks validity */ - if (!check_lo_obj(self, CHECK_OPEN)) - return NULL; - - /* gets current position */ - if ((start = lo_tell(self->pgcnx->cnx, self->lo_fd)) == -1) - { - PyErr_SetString(PyExc_IOError, "error while getting position."); - return NULL; - } - - /* returns size */ - return PyInt_FromLong(start); -} - -/* exports large object as unix file */ -static char pglarge_export__doc__[] = -"export(string) -- export large object data to specified file. " -"Object must be closed when calling this method."; - -static PyObject * -pglarge_export(pglargeobject * self, PyObject * args) -{ - char *name; - - /* checks validity */ - if (!check_lo_obj(self, CHECK_CLOSE)) - return NULL; - - /* gets arguments */ - if (!PyArg_ParseTuple(args, "s", &name)) - { - PyErr_SetString(PyExc_TypeError, - "export(filename), with filename (string)."); - return NULL; - } - - /* runs command */ - if (!lo_export(self->pgcnx->cnx, self->lo_oid, name)) - { - PyErr_SetString(PyExc_IOError, "error while exporting large object."); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -/* deletes a large object */ -static char pglarge_unlink__doc__[] = -"unlink() -- destroy large object. " -"Object must be closed when calling this method."; - -static PyObject * -pglarge_unlink(pglargeobject * self, PyObject * args) -{ - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method unlink() takes no parameters."); - return NULL; - } - - /* checks validity */ - if (!check_lo_obj(self, CHECK_CLOSE)) - return NULL; - - /* deletes the object, invalidate it on success */ - if (!lo_unlink(self->pgcnx->cnx, self->lo_oid)) - { - PyErr_SetString(PyExc_IOError, "error while unlinking large object"); - return NULL; - } - self->lo_oid = 0; - - Py_INCREF(Py_None); - return Py_None; -} - -/* large object methods */ -static struct PyMethodDef pglarge_methods[] = { - {"open", (PyCFunction) pglarge_open, 1, pglarge_open__doc__}, - {"close", (PyCFunction) pglarge_close, 1, pglarge_close__doc__}, - {"read", (PyCFunction) pglarge_read, 1, pglarge_read__doc__}, - {"write", (PyCFunction) pglarge_write, 1, pglarge_write__doc__}, - {"seek", (PyCFunction) pglarge_lseek, 1, pglarge_seek__doc__}, - {"size", (PyCFunction) pglarge_size, 1, pglarge_size__doc__}, - {"tell", (PyCFunction) pglarge_tell, 1, pglarge_tell__doc__}, - {"export", (PyCFunction) pglarge_export, 1, pglarge_export__doc__}, - {"unlink", (PyCFunction) pglarge_unlink, 1, pglarge_unlink__doc__}, - {NULL, NULL} -}; - -/* get attribute */ -static PyObject * -pglarge_getattr(pglargeobject * self, char *name) -{ - /* list postgreSQL large object fields */ - - /* associated pg connection object */ - if (!strcmp(name, "pgcnx")) - { - if (check_lo_obj(self, 0)) - { - Py_INCREF(self->pgcnx); - return (PyObject *) (self->pgcnx); - } - - Py_INCREF(Py_None); - return Py_None; - } - - /* large object oid */ - if (!strcmp(name, "oid")) - { - if (check_lo_obj(self, 0)) - return PyInt_FromLong(self->lo_oid); - - Py_INCREF(Py_None); - return Py_None; - } - - /* error (status) message */ - if (!strcmp(name, "error")) - return PyString_FromString(PQerrorMessage(self->pgcnx->cnx)); - - /* attributes list */ - if (!strcmp(name, "__members__")) - { - PyObject *list = PyList_New(3); - - if (list) - { - PyList_SET_ITEM(list, 0, PyString_FromString("oid")); - PyList_SET_ITEM(list, 1, PyString_FromString("pgcnx")); - PyList_SET_ITEM(list, 2, PyString_FromString("error")); - } - - return list; - } - - /* module name */ - if (!strcmp(name, "__module__")) - return PyString_FromString(MODULE_NAME); - - /* class name */ - if (!strcmp(name, "__class__")) - return PyString_FromString("pglarge"); - - /* seeks name in methods (fallback) */ - return Py_FindMethod(pglarge_methods, (PyObject *) self, name); -} - -/* prints query object in human readable format */ -static int -pglarge_print(pglargeobject * self, FILE *fp, int flags) -{ - char print_buffer[128]; - - if (self->lo_fd >= 0) - { -#ifdef NO_SNPRINTF - sprintf(print_buffer, - "Opened large object, oid %ld", (long) self->lo_oid); -#else - snprintf(print_buffer, sizeof(print_buffer), - "Opened large object, oid %ld", (long) self->lo_oid); -#endif - fputs(print_buffer, fp); - } - else - { -#ifdef NO_SNPRINTF - sprintf(print_buffer, - "Closed large object, oid %ld", (long) self->lo_oid); -#else - snprintf(print_buffer, sizeof(print_buffer), - "Closed large object, oid %ld", (long) self->lo_oid); -#endif - fputs(print_buffer, fp); - } - - return 0; -} - -/* object type definition */ -staticforward PyTypeObject PglargeType = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "pglarge", /* tp_name */ - sizeof(pglargeobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - - /* methods */ - (destructor) pglarge_dealloc, /* tp_dealloc */ - (printfunc) pglarge_print, /* tp_print */ - (getattrfunc) pglarge_getattr, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ -}; -#endif /* LARGE_OBJECTS */ - - -/* --------------------------------------------------------------------- */ -/* PG QUERY OBJECT IMPLEMENTATION */ - -/* connects to a database */ -static char connect__doc__[] = -"connect(dbname, host, port, opt, tty) -- connect to a PostgreSQL database " -"using specified parameters (optionals, keywords aware)."; - -static PyObject * -pgconnect(pgobject * self, PyObject * args, PyObject * dict) -{ - static const char *kwlist[] = {"dbname", "host", "port", "opt", - "tty", "user", "passwd", NULL}; - char *pghost, - *pgopt, - *pgtty, - *pgdbname, - *pguser, - *pgpasswd; - int pgport; - char port_buffer[20]; - pgobject *npgobj; - - pghost = pgopt = pgtty = pgdbname = pguser = pgpasswd = NULL; - pgport = -1; - - /* - * parses standard arguments With the right compiler warnings, this - * will issue a diagnostic. There is really no way around it. If I - * don't declare kwlist as const char *kwlist[] then it complains when - * I try to assign all those constant strings to it. - */ - if (!PyArg_ParseTupleAndKeywords(args, dict, "|zzizzzz", (char **) kwlist, - &pgdbname, &pghost, &pgport, &pgopt, &pgtty, &pguser, &pgpasswd)) - return NULL; - -#ifdef DEFAULT_VARS - /* handles defaults variables (for unintialised vars) */ - if ((!pghost) && (pg_default_host != Py_None)) - pghost = PyString_AsString(pg_default_host); - - if ((pgport == -1) && (pg_default_port != Py_None)) - pgport = PyInt_AsLong(pg_default_port); - - if ((!pgopt) && (pg_default_opt != Py_None)) - pgopt = PyString_AsString(pg_default_opt); - - if ((!pgtty) && (pg_default_tty != Py_None)) - pgtty = PyString_AsString(pg_default_tty); - - if ((!pgdbname) && (pg_default_base != Py_None)) - pgdbname = PyString_AsString(pg_default_base); - - if ((!pguser) && (pg_default_user != Py_None)) - pguser = PyString_AsString(pg_default_user); - - if ((!pgpasswd) && (pg_default_passwd != Py_None)) - pgpasswd = PyString_AsString(pg_default_passwd); -#endif /* DEFAULT_VARS */ - - if ((npgobj = (pgobject *) pgobject_New()) == NULL) - return NULL; - - if (pgport != -1) - { - memset(port_buffer, 0, sizeof(port_buffer)); - sprintf(port_buffer, "%d", pgport); - npgobj->cnx = PQsetdbLogin(pghost, port_buffer, pgopt, pgtty, pgdbname, - pguser, pgpasswd); - } - else - npgobj->cnx = PQsetdbLogin(pghost, NULL, pgopt, pgtty, pgdbname, - pguser, pgpasswd); - - if (PQstatus(npgobj->cnx) == CONNECTION_BAD) - { - PyErr_SetString(PGError, PQerrorMessage(npgobj->cnx)); - Py_XDECREF(npgobj); - return NULL; - } - - return (PyObject *) npgobj; -} - -/* pgobject methods */ - -/* destructor */ -static void -pg_dealloc(pgobject * self) -{ - if (self->cnx) - PQfinish(self->cnx); - - PyObject_Del(self); -} - -/* close without deleting */ -static char pg_close__doc__[] = -"close() -- close connection. All instances of the connection object and " -"derived objects (queries and large objects) can no longer be used after " -"this call."; - -static PyObject * -pg_close(pgobject * self, PyObject * args) -{ - /* gets args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_TypeError, "close()."); - return NULL; - } - - if (self->cnx) - PQfinish(self->cnx); - - self->cnx = NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static void -pgquery_dealloc(pgqueryobject * self) -{ - if (self->last_result) - PQclear(self->last_result); - - PyObject_Del(self); -} - -/* resets connection */ -static char pg_reset__doc__[] = -"reset() -- reset connection with current parameters. All derived queries " -"and large objects derived from this connection will not be usable after " -"this call."; - -static PyObject * -pg_reset(pgobject * self, PyObject * args) -{ - if (!self->cnx) - { - PyErr_SetString(PyExc_TypeError, "Connection is not valid"); - return NULL; - } - - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method reset() takes no parameters."); - return NULL; - } - - /* resets the connection */ - PQreset(self->cnx); - Py_INCREF(Py_None); - return Py_None; -} - -/* get connection socket */ -static char pg_fileno__doc__[] = -"fileno() -- return database connection socket file handle."; - -static PyObject * -pg_fileno(pgobject * self, PyObject * args) -{ - if (!self->cnx) - { - PyErr_SetString(PyExc_TypeError, "Connection is not valid"); - return NULL; - } - - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method fileno() takes no parameters."); - return NULL; - } - -#ifdef NO_PQSOCKET - return PyInt_FromLong((long) self->cnx->sock); -#else - return PyInt_FromLong((long) PQsocket(self->cnx)); -#endif -} - -/* get number of rows */ -static char pgquery_ntuples__doc__[] = -"ntuples() -- returns number of tuples returned by query."; - -static PyObject * -pgquery_ntuples(pgqueryobject * self, PyObject * args) -{ - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method ntuples() takes no parameters."); - return NULL; - } - - return PyInt_FromLong((long) PQntuples(self->last_result)); -} - -/* list fields names from query result */ -static char pgquery_listfields__doc__[] = -"listfields() -- Lists field names from result."; - -static PyObject * -pgquery_listfields(pgqueryobject * self, PyObject * args) -{ - int i, - n; - char *name; - PyObject *fieldstuple, - *str; - - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method listfields() takes no parameters."); - return NULL; - } - - /* builds tuple */ - n = PQnfields(self->last_result); - fieldstuple = PyTuple_New(n); - - for (i = 0; i < n; i++) - { - name = PQfname(self->last_result, i); - str = PyString_FromString(name); - PyTuple_SET_ITEM(fieldstuple, i, str); - } - - return fieldstuple; -} - -/* get field name from last result */ -static char pgquery_fieldname__doc__[] = -"fieldname() -- returns name of field from result from its position."; - -static PyObject * -pgquery_fieldname(pgqueryobject * self, PyObject * args) -{ - int i; - char *name; - - /* gets args */ - if (!PyArg_ParseTuple(args, "i", &i)) - { - PyErr_SetString(PyExc_TypeError, - "fieldname(number), with number(integer)."); - return NULL; - } - - /* checks number validity */ - if (i >= PQnfields(self->last_result)) - { - PyErr_SetString(PyExc_ValueError, "invalid field number."); - return NULL; - } - - /* gets fields name and builds object */ - name = PQfname(self->last_result, i); - return PyString_FromString(name); -} - -/* gets fields number from name in last result */ -static char pgquery_fieldnum__doc__[] = -"fieldnum() -- returns position in query for field from its name."; - -static PyObject * -pgquery_fieldnum(pgqueryobject * self, PyObject * args) -{ - char *name; - int num; - - /* gets args */ - if (!PyArg_ParseTuple(args, "s", &name)) - { - PyErr_SetString(PyExc_TypeError, "fieldnum(name), with name (string)."); - return NULL; - } - - /* gets field number */ - if ((num = PQfnumber(self->last_result, name)) == -1) - { - PyErr_SetString(PyExc_ValueError, "Unknown field."); - return NULL; - } - - return PyInt_FromLong(num); -} - -/* retrieves last result */ -static char pgquery_getresult__doc__[] = -"getresult() -- Gets the result of a query. The result is returned " -"as a list of rows, each one a list of fields in the order returned " -"by the server."; - -static PyObject * -pgquery_getresult(pgqueryobject * self, PyObject * args) -{ - PyObject *rowtuple, - *reslist, - *val; - int i, - j, - m, - n, - *typ; - - /* checks args (args == NULL for an internal call) */ - if ((args != NULL) && (!PyArg_ParseTuple(args, ""))) - { - PyErr_SetString(PyExc_SyntaxError, - "method getresult() takes no parameters."); - return NULL; - } - - /* stores result in tuple */ - m = PQntuples(self->last_result); - n = PQnfields(self->last_result); - reslist = PyList_New(m); - - if ((typ = malloc(sizeof(int) * n)) == NULL) - { - PyErr_SetString(PyExc_SyntaxError, "memory error in getresult()."); - return NULL; - } - - for (j = 0; j < n; j++) - { - switch (PQftype(self->last_result, j)) - { - case INT2OID: - case INT4OID: - case INT8OID: - case OIDOID: - typ[j] = 1; - break; - - case FLOAT4OID: - case FLOAT8OID: - case NUMERICOID: - typ[j] = 2; - break; - - case CASHOID: - typ[j] = 3; - break; - - default: - typ[j] = 4; - break; - } - } - - for (i = 0; i < m; i++) - { - if ((rowtuple = PyTuple_New(n)) == NULL) - { - Py_DECREF(reslist); - reslist = NULL; - goto exit; - } - - for (j = 0; j < n; j++) - { - int k; - char *s = PQgetvalue(self->last_result, i, j); - char cashbuf[64]; - - if (PQgetisnull(self->last_result, i, j)) - { - Py_INCREF(Py_None); - val = Py_None; - } - else - switch (typ[j]) - { - case 1: - val = PyInt_FromLong(strtol(s, NULL, 10)); - break; - - case 2: - val = PyFloat_FromDouble(strtod(s, NULL)); - break; - - case 3: - { - int mult = 1; - - if (*s == '$') /* there's talk of getting - * rid of it */ - s++; - - if (*s == '-' || *s == '(') - { - s++; - mult = -1; - } - - /* get rid of the '$' and commas */ - if (*s == '$') /* Just in case we exposed - * one */ - s++; - - for (k = 0; *s; s++) - if (*s != ',') - cashbuf[k++] = *s; - - cashbuf[k] = 0; - val = PyFloat_FromDouble(strtod(cashbuf, NULL) * mult); - break; - } - - default: - val = PyString_FromString(s); - break; - } - - if (val == NULL) - { - Py_DECREF(reslist); - Py_DECREF(rowtuple); - reslist = NULL; - goto exit; - } - - PyTuple_SET_ITEM(rowtuple, j, val); - } - - PyList_SET_ITEM(reslist, i, rowtuple); - } - -exit: - free(typ); - - /* returns list */ - return reslist; -} - -/* retrieves last result as a list of dictionaries*/ -static char pgquery_dictresult__doc__[] = -"dictresult() -- Gets the result of a query. The result is returned " -"as a list of rows, each one a dictionary with the field names used " -"as the labels."; - -static PyObject * -pgquery_dictresult(pgqueryobject * self, PyObject * args) -{ - PyObject *dict, - *reslist, - *val; - int i, - j, - m, - n, - *typ; - - /* checks args (args == NULL for an internal call) */ - if ((args != NULL) && (!PyArg_ParseTuple(args, ""))) - { - PyErr_SetString(PyExc_SyntaxError, - "method getresult() takes no parameters."); - return NULL; - } - - /* stores result in list */ - m = PQntuples(self->last_result); - n = PQnfields(self->last_result); - reslist = PyList_New(m); - - if ((typ = malloc(sizeof(int) * n)) == NULL) - { - PyErr_SetString(PyExc_SyntaxError, "memory error in dictresult()."); - return NULL; - } - - for (j = 0; j < n; j++) - { - switch (PQftype(self->last_result, j)) - { - case INT2OID: - case INT4OID: - case INT8OID: - case OIDOID: - typ[j] = 1; - break; - - case FLOAT4OID: - case FLOAT8OID: - case NUMERICOID: - typ[j] = 2; - break; - - case CASHOID: - typ[j] = 3; - break; - - default: - typ[j] = 4; - break; - } - } - - for (i = 0; i < m; i++) - { - if ((dict = PyDict_New()) == NULL) - { - Py_DECREF(reslist); - reslist = NULL; - goto exit; - } - - for (j = 0; j < n; j++) - { - int k; - char *s = PQgetvalue(self->last_result, i, j); - char cashbuf[64]; - - if (PQgetisnull(self->last_result, i, j)) - { - Py_INCREF(Py_None); - val = Py_None; - } - else - switch (typ[j]) - { - case 1: - val = PyInt_FromLong(strtol(s, NULL, 10)); - break; - - case 2: - val = PyFloat_FromDouble(strtod(s, NULL)); - break; - - case 3: - { - int mult = 1; - - if (*s == '$') /* there's talk of getting - * rid of it */ - s++; - - if (*s == '-' || *s == '(') - { - s++; - mult = -1; - } - - /* get rid of the '$' and commas */ - if (*s == '$') /* Just in case we exposed - * one */ - s++; - - for (k = 0; *s; s++) - if (*s != ',') - cashbuf[k++] = *s; - - cashbuf[k] = 0; - val = PyFloat_FromDouble(strtod(cashbuf, NULL) * mult); - break; - } - - default: - val = PyString_FromString(s); - break; - } - - if (val == NULL) - { - Py_DECREF(dict); - Py_DECREF(reslist); - reslist = NULL; - goto exit; - } - - PyDict_SetItemString(dict, PQfname(self->last_result, j), val); - Py_DECREF(val); - } - - PyList_SET_ITEM(reslist, i, dict); - } - -exit: - free(typ); - - /* returns list */ - return reslist; -} - -/* gets asynchronous notify */ -static char pg_getnotify__doc__[] = -"getnotify() -- get database notify for this connection."; - -static PyObject * -pg_getnotify(pgobject * self, PyObject * args) -{ - PGnotify *notify; - PGresult *result; - PyObject *notify_result, - *temp; - - if (!self->cnx) - { - PyErr_SetString(PyExc_TypeError, "Connection is not valid"); - return NULL; - } - - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method getnotify() takes no parameters."); - return NULL; - } - - /* gets notify and builds result */ - - /* - * notifies only come back as result of a query, so I send an empty - * query - */ - Py_BEGIN_ALLOW_THREADS - result = PQexec(self->cnx, " "); - Py_END_ALLOW_THREADS - - if ((notify = PQnotifies(self->cnx)) != NULL) - { - if ((notify_result = PyTuple_New(2)) == NULL) - { - PQclear(result); - return NULL; - } - - if ((temp = PyString_FromString(notify->relname)) == NULL) - { - PQclear(result); - return NULL; - } - - PyTuple_SET_ITEM(notify_result, 0, temp); - - if ((temp = PyInt_FromLong(notify->be_pid)) == NULL) - { - PQclear(result); - Py_DECREF(notify_result); - return NULL; - } - - PyTuple_SET_ITEM(notify_result, 1, temp); - free(notify); - } - else - { - Py_INCREF(Py_None); - notify_result = Py_None; - } - - PQclear(result); - - /* returns result */ - return notify_result; -} - -/* source creation */ -static char pg_source__doc__[] = -"source() -- creates a new source object for this connection"; - -static PyObject * -pg_source(pgobject * self, PyObject * args) -{ - /* checks validity */ - if (!check_cnx_obj(self)) - return NULL; - - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_TypeError, "method source() takes no parameter."); - return NULL; - } - - /* allocate new pg query object */ - return (PyObject *) pgsource_new(self); -} - -/* database query */ -static char pg_query__doc__[] = -"query(sql) -- creates a new query object for this connection," -" using sql (string) request."; - -static PyObject * -pg_query(pgobject * self, PyObject * args) -{ - char *query; - PGresult *result; - pgqueryobject *npgobj; - int status; - - if (!self->cnx) - { - PyErr_SetString(PyExc_TypeError, "Connection is not valid"); - return NULL; - } - - /* get query args */ - if (!PyArg_ParseTuple(args, "s", &query)) - { - PyErr_SetString(PyExc_TypeError, "query(sql), with sql (string)."); - return NULL; - } - - /* frees previous result */ - if (self->last_result) - { - PQclear(self->last_result); - self->last_result = NULL; - } - - /* gets result */ - Py_BEGIN_ALLOW_THREADS - result = PQexec(self->cnx, query); - Py_END_ALLOW_THREADS - - /* checks result validity */ - if (!result) - { - PyErr_SetString(PyExc_ValueError, PQerrorMessage(self->cnx)); - return NULL; - } - - /* checks result status */ - if ((status = PQresultStatus(result)) != PGRES_TUPLES_OK) - { - Oid oid; - - PQclear(result); - - switch (status) - { - case PGRES_EMPTY_QUERY: - PyErr_SetString(PyExc_ValueError, "empty query."); - break; - case PGRES_BAD_RESPONSE: - case PGRES_FATAL_ERROR: - case PGRES_NONFATAL_ERROR: - PyErr_SetString(PGError, PQerrorMessage(self->cnx)); - break; - case PGRES_COMMAND_OK: /* could be an INSERT */ - if ((oid = PQoidValue(result)) == InvalidOid) /* nope */ - { - Py_INCREF(Py_None); - return Py_None; - } - - /* otherwise, return the oid */ - return PyInt_FromLong(oid); - - case PGRES_COPY_OUT: /* no data will be received */ - case PGRES_COPY_IN: - Py_INCREF(Py_None); - return Py_None; - default: - PyErr_SetString(PGError, "internal error: " - "unknown result status."); - break; - } - - return NULL; /* error detected on query */ - } - - if ((npgobj = PyObject_NEW(pgqueryobject, &PgQueryType)) == NULL) - return NULL; - - /* stores result and returns object */ - npgobj->last_result = result; - return (PyObject *) npgobj; -} - -#ifdef DIRECT_ACCESS -static char pg_putline__doc__[] = -"putline() -- sends a line directly to the backend"; - -/* direct acces function : putline */ -static PyObject * -pg_putline(pgobject * self, PyObject * args) -{ - char *line; - - if (!self->cnx) - { - PyErr_SetString(PyExc_TypeError, "Connection is not valid"); - return NULL; - } - - /* reads args */ - if (!PyArg_ParseTuple(args, "s", &line)) - { - PyErr_SetString(PyExc_TypeError, "putline(line), with line (string)."); - return NULL; - } - - /* sends line to backend */ - PQputline(self->cnx, line); - Py_INCREF(Py_None); - return Py_None; -} - -/* direct access function : getline */ -static char pg_getline__doc__[] = -"getline() -- gets a line directly from the backend."; - -static PyObject * -pg_getline(pgobject * self, PyObject * args) -{ - char line[MAX_BUFFER_SIZE]; - PyObject *str = NULL; /* GCC */ - - if (!self->cnx) - { - PyErr_SetString(PyExc_TypeError, "Connection is not valid"); - return NULL; - } - - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method getline() takes no parameters."); - return NULL; - } - - /* gets line */ - switch (PQgetline(self->cnx, line, MAX_BUFFER_SIZE)) - { - case 0: - str = PyString_FromString(line); - break; - case 1: - PyErr_SetString(PyExc_MemoryError, "buffer overflow"); - str = NULL; - break; - case EOF: - Py_INCREF(Py_None); - str = Py_None; - break; - } - - return str; -} - -/* direct access function : end copy */ -static char pg_endcopy__doc__[] = -"endcopy() -- synchronizes client and server"; - -static PyObject * -pg_endcopy(pgobject * self, PyObject * args) -{ - if (!self->cnx) - { - PyErr_SetString(PyExc_TypeError, "Connection is not valid"); - return NULL; - } - - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method endcopy() takes no parameters."); - return NULL; - } - - /* ends direct copy */ - PQendcopy(self->cnx); - Py_INCREF(Py_None); - return Py_None; -} -#endif /* DIRECT_ACCESS */ - - -static PyObject * -pgquery_print(pgqueryobject * self, FILE *fp, int flags) -{ - PQprintOpt op; - - memset(&op, 0, sizeof(op)); - op.align = 1; - op.header = 1; - op.fieldSep = "|"; - op.pager = 1; - PQprint(fp, self->last_result, &op); - return 0; -} - -static PyObject * -pgquery_repr(pgqueryobject * self) -{ - return PyString_FromString("<pg query result>"); -} - -/* insert table */ -static char pg_inserttable__doc__[] = -"inserttable(string, list) -- insert list in table. The fields in the " -"list must be in the same order as in the table."; - -static PyObject * -pg_inserttable(pgobject * self, PyObject * args) -{ - PGresult *result; - char *table, - *buffer, - *temp; - char temp_buffer[256]; - PyObject *list, - *sublist, - *item; - PyObject *(*getitem) (PyObject *, int); - PyObject *(*getsubitem) (PyObject *, int); - int i, - j; - - if (!self->cnx) - { - PyErr_SetString(PyExc_TypeError, "Connection is not valid"); - return NULL; - } - - /* gets arguments */ - if (!PyArg_ParseTuple(args, "sO:filter", &table, &list)) - { - PyErr_SetString(PyExc_TypeError, - "tableinsert(table, content), with table (string) " - "and content (list)."); - return NULL; - } - - /* checks list type */ - if (PyTuple_Check(list)) - getitem = PyTuple_GetItem; - else if (PyList_Check(list)) - getitem = PyList_GetItem; - else - { - PyErr_SetString(PyExc_TypeError, - "second arg must be some kind of array."); - return NULL; - } - - /* checks sublists type */ - for (i = 0; (sublist = getitem(list, i)) != NULL; i++) - { - if (!PyTuple_Check(sublist) && !PyList_Check(sublist)) - { - PyErr_SetString(PyExc_TypeError, - "second arg must contain some kind of arrays."); - return NULL; - } - } - - /* allocate buffer */ - if (!(buffer = malloc(MAX_BUFFER_SIZE))) - { - PyErr_SetString(PyExc_MemoryError, "can't allocate insert buffer."); - return NULL; - } - - /* starts query */ - sprintf(buffer, "copy %s from stdin", table); - - Py_BEGIN_ALLOW_THREADS - result = PQexec(self->cnx, buffer); - Py_END_ALLOW_THREADS - - if (!result) - { - free(buffer); - PyErr_SetString(PyExc_ValueError, PQerrorMessage(self->cnx)); - return NULL; - } - - PQclear(result); - - /* feeds table */ - for (i = 0; (sublist = getitem(list, i)) != NULL; i++) - { - if (PyTuple_Check(sublist)) - getsubitem = PyTuple_GetItem; - else - getsubitem = PyList_GetItem; - - /* builds insert line */ - buffer[0] = 0; - - for (j = 0; (item = getsubitem(sublist, j)) != NULL; j++) - { - /* converts item to string */ - if (PyString_Check(item)) - temp = PyString_AS_STRING(item); - else if (PyInt_Check(item)) - { - long k; - - k = PyInt_AsLong(item); - sprintf(temp_buffer, "%ld", k); - temp = temp_buffer; - } - else if (PyLong_Check(item)) - { - long k; - - k = PyLong_AsLong(item); - sprintf(temp_buffer, "%ld", k); - temp = temp_buffer; - } - else if (PyFloat_Check(item)) - { - double k; - - k = PyFloat_AS_DOUBLE(item); - sprintf(temp_buffer, "%g", k); - temp = temp_buffer; - } - else - { - free(buffer); - PyErr_SetString(PyExc_ValueError, - "items must be strings, integers, " - "longs or double (real)."); - return NULL; - } - - /* concats buffer */ - if (strlen(buffer)) - strncat(buffer, "\t", MAX_BUFFER_SIZE - strlen(buffer)); - - strncat(buffer, temp, MAX_BUFFER_SIZE - strlen(buffer)); - } - - strncat(buffer, "\n", MAX_BUFFER_SIZE - strlen(buffer)); - - /* sends data */ - PQputline(self->cnx, buffer); - } - - /* ends query */ - PQputline(self->cnx, "\\.\n"); - PQendcopy(self->cnx); - free(buffer); - - /* no error : returns nothing */ - Py_INCREF(Py_None); - return Py_None; -} - - -/* creates large object */ -static char pg_locreate__doc__[] = -"locreate() -- creates a new large object in the database."; - -static PyObject * -pg_locreate(pgobject * self, PyObject * args) -{ - int mode; - Oid lo_oid; - - /* checks validity */ - if (!check_cnx_obj(self)) - return NULL; - - /* gets arguments */ - if (!PyArg_ParseTuple(args, "i", &mode)) - { - PyErr_SetString(PyExc_TypeError, - "locreate(mode), with mode (integer)."); - return NULL; - } - - /* creates large object */ - lo_oid = lo_creat(self->cnx, mode); - if (lo_oid == 0) - { - PyErr_SetString(PGError, "can't create large object."); - return NULL; - } - - return (PyObject *) pglarge_new(self, lo_oid); -} - -/* init from already known oid */ -static char pg_getlo__doc__[] = -"getlo(long) -- create a large object instance for the specified oid."; - -static PyObject * -pg_getlo(pgobject * self, PyObject * args) -{ - int lo_oid; - - /* checks validity */ - if (!check_cnx_obj(self)) - return NULL; - - /* gets arguments */ - if (!PyArg_ParseTuple(args, "i", &lo_oid)) - { - PyErr_SetString(PyExc_TypeError, "getlo(oid), with oid (integer)."); - return NULL; - } - - if (!lo_oid) - { - PyErr_SetString(PyExc_ValueError, "the object oid can't be null."); - return NULL; - } - - /* creates object */ - return (PyObject *) pglarge_new(self, lo_oid); -} - -/* import unix file */ -static char pg_loimport__doc__[] = -"loimport(string) -- create a new large object from specified file."; - -static PyObject * -pg_loimport(pgobject * self, PyObject * args) -{ - char *name; - Oid lo_oid; - - /* checks validity */ - if (!check_cnx_obj(self)) - return NULL; - - /* gets arguments */ - if (!PyArg_ParseTuple(args, "s", &name)) - { - PyErr_SetString(PyExc_TypeError, "loimport(name), with name (string)."); - return NULL; - } - - /* imports file and checks result */ - lo_oid = lo_import(self->cnx, name); - if (lo_oid == 0) - { - PyErr_SetString(PGError, "can't create large object."); - return NULL; - } - - return (PyObject *) pglarge_new(self, lo_oid); -} - - -/* connection object methods */ -static struct PyMethodDef pgobj_methods[] = { - {"source", (PyCFunction) pg_source, 1, pg_source__doc__}, - {"query", (PyCFunction) pg_query, 1, pg_query__doc__}, - {"reset", (PyCFunction) pg_reset, 1, pg_reset__doc__}, - {"close", (PyCFunction) pg_close, 1, pg_close__doc__}, - {"fileno", (PyCFunction) pg_fileno, 1, pg_fileno__doc__}, - {"getnotify", (PyCFunction) pg_getnotify, 1, pg_getnotify__doc__}, - {"inserttable", (PyCFunction) pg_inserttable, 1, pg_inserttable__doc__}, - -#ifdef DIRECT_ACCESS - {"putline", (PyCFunction) pg_putline, 1, pg_putline__doc__}, - {"getline", (PyCFunction) pg_getline, 1, pg_getline__doc__}, - {"endcopy", (PyCFunction) pg_endcopy, 1, pg_endcopy__doc__}, -#endif /* DIRECT_ACCESS */ - -#ifdef LARGE_OBJECTS - {"locreate", (PyCFunction) pg_locreate, 1, pg_locreate__doc__}, - {"getlo", (PyCFunction) pg_getlo, 1, pg_getlo__doc__}, - {"loimport", (PyCFunction) pg_loimport, 1, pg_loimport__doc__}, -#endif /* LARGE_OBJECTS */ - - {NULL, NULL} /* sentinel */ -}; - -/* get attribute */ -static PyObject * -pg_getattr(pgobject * self, char *name) -{ - /* - * Although we could check individually, there are only a few - * attributes that don't require a live connection and unless someone - * has an urgent need, this will have to do - */ - if (!self->cnx) - { - PyErr_SetString(PyExc_TypeError, "Connection is not valid"); - return NULL; - } - - /* list postgreSQL connection fields */ - - /* postmaster host */ - if (!strcmp(name, "host")) - { - char *r = PQhost(self->cnx); - - return r ? PyString_FromString(r) : PyString_FromString("localhost"); - } - - /* postmaster port */ - if (!strcmp(name, "port")) - return PyInt_FromLong(atol(PQport(self->cnx))); - - /* selected database */ - if (!strcmp(name, "db")) - return PyString_FromString(PQdb(self->cnx)); - - /* selected options */ - if (!strcmp(name, "options")) - return PyString_FromString(PQoptions(self->cnx)); - - /* selected postgres tty */ - if (!strcmp(name, "tty")) - return PyString_FromString(PQtty(self->cnx)); - - /* error (status) message */ - if (!strcmp(name, "error")) - return PyString_FromString(PQerrorMessage(self->cnx)); - - /* connection status : 1 - OK, 0 - BAD */ - if (!strcmp(name, "status")) - return PyInt_FromLong(PQstatus(self->cnx) == CONNECTION_OK ? 1 : 0); - - /* provided user name */ - if (!strcmp(name, "user")) - return PyString_FromString("Deprecated facility"); - /* return PyString_FromString(fe_getauthname("<unknown user>")); */ - - /* attributes list */ - if (!strcmp(name, "__members__")) - { - PyObject *list = PyList_New(8); - - if (list) - { - PyList_SET_ITEM(list, 0, PyString_FromString("host")); - PyList_SET_ITEM(list, 1, PyString_FromString("port")); - PyList_SET_ITEM(list, 2, PyString_FromString("db")); - PyList_SET_ITEM(list, 3, PyString_FromString("options")); - PyList_SET_ITEM(list, 4, PyString_FromString("tty")); - PyList_SET_ITEM(list, 5, PyString_FromString("error")); - PyList_SET_ITEM(list, 6, PyString_FromString("status")); - PyList_SET_ITEM(list, 7, PyString_FromString("user")); - } - - return list; - } - - return Py_FindMethod(pgobj_methods, (PyObject *) self, name); -} - -/* object type definition */ -staticforward PyTypeObject PgType = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "pgobject", /* tp_name */ - sizeof(pgobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor) pg_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - (getattrfunc) pg_getattr, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ -}; - - -/* query object methods */ -static struct PyMethodDef pgquery_methods[] = { - {"getresult", (PyCFunction) pgquery_getresult, 1, pgquery_getresult__doc__}, - {"dictresult", (PyCFunction) pgquery_dictresult, 1, pgquery_dictresult__doc__}, - {"fieldname", (PyCFunction) pgquery_fieldname, 1, pgquery_fieldname__doc__}, - {"fieldnum", (PyCFunction) pgquery_fieldnum, 1, pgquery_fieldnum__doc__}, - {"listfields", (PyCFunction) pgquery_listfields, 1, pgquery_listfields__doc__}, - {"ntuples", (PyCFunction) pgquery_ntuples, 1, pgquery_ntuples__doc__}, - {NULL, NULL} -}; - -/* gets query object attributes */ -static PyObject * -pgquery_getattr(pgqueryobject * self, char *name) -{ - /* list postgreSQL connection fields */ - return Py_FindMethod(pgquery_methods, (PyObject *) self, name); -} - -/* query type definition */ -staticforward PyTypeObject PgQueryType = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "pgqueryobject", /* tp_name */ - sizeof(pgqueryobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor) pgquery_dealloc, /* tp_dealloc */ - (printfunc) pgquery_print, /* tp_print */ - (getattrfunc) pgquery_getattr, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc) pgquery_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ -}; - - - -/* --------------------------------------------------------------------- */ - -/* MODULE FUNCTIONS */ - -#ifdef DEFAULT_VARS - -/* gets default host */ -static char getdefhost__doc__[] = -"get_defhost() -- return default database host."; - -static PyObject * -pggetdefhost(PyObject * self, PyObject * args) -{ - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method get_defhost() takes no parameter."); - return NULL; - } - - Py_XINCREF(pg_default_host); - return pg_default_host; -} - -/* sets default host */ -static char setdefhost__doc__[] = -"set_defhost(string) -- set default database host. Return previous value."; - -static PyObject * -pgsetdefhost(PyObject * self, PyObject * args) -{ - char *temp = NULL; - PyObject *old; - - /* gets arguments */ - if (!PyArg_ParseTuple(args, "z", &temp)) - { - PyErr_SetString(PyExc_TypeError, - "set_defhost(name), with name (string/None)."); - return NULL; - } - - /* adjusts value */ - old = pg_default_host; - - if (temp) - pg_default_host = PyString_FromString(temp); - else - { - Py_INCREF(Py_None); - pg_default_host = Py_None; - } - - return old; -} - -/* gets default base */ -static char getdefbase__doc__[] = -"get_defbase() -- return default database name."; - -static PyObject * -pggetdefbase(PyObject * self, PyObject * args) -{ - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method get_defbase() takes no parameter."); - return NULL; - } - - Py_XINCREF(pg_default_base); - return pg_default_base; -} - -/* sets default base */ -static char setdefbase__doc__[] = -"set_defbase(string) -- set default database name. Return previous value"; - -static PyObject * -pgsetdefbase(PyObject * self, PyObject * args) -{ - char *temp = NULL; - PyObject *old; - - /* gets arguments */ - if (!PyArg_ParseTuple(args, "z", &temp)) - { - PyErr_SetString(PyExc_TypeError, - "set_defbase(name), with name (string/None)."); - return NULL; - } - - /* adjusts value */ - old = pg_default_base; - - if (temp) - pg_default_base = PyString_FromString(temp); - else - { - Py_INCREF(Py_None); - pg_default_base = Py_None; - } - - return old; -} - -/* gets default options */ -static char getdefopt__doc__[] = -"get_defopt() -- return default database options."; - -static PyObject * -pggetdefopt(PyObject * self, PyObject * args) -{ - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method get_defopt() takes no parameter."); - return NULL; - } - - Py_XINCREF(pg_default_opt); - return pg_default_opt; -} - -/* sets default opt */ -static char setdefopt__doc__[] = -"set_defopt(string) -- set default database options. Return previous value."; - -static PyObject * -pgsetdefopt(PyObject * self, PyObject * args) -{ - char *temp = NULL; - PyObject *old; - - /* gets arguments */ - if (!PyArg_ParseTuple(args, "z", &temp)) - { - PyErr_SetString(PyExc_TypeError, - "set_defopt(name), with name (string/None)."); - return NULL; - } - - /* adjusts value */ - old = pg_default_opt; - - if (temp) - pg_default_opt = PyString_FromString(temp); - else - { - Py_INCREF(Py_None); - pg_default_opt = Py_None; - } - - return old; -} - -/* gets default tty */ -static char getdeftty__doc__[] = -"get_deftty() -- return default database debug terminal."; - -static PyObject * -pggetdeftty(PyObject * self, PyObject * args) -{ - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method get_deftty() takes no parameter."); - return NULL; - } - - Py_XINCREF(pg_default_tty); - return pg_default_tty; -} - -/* sets default tty */ -static char setdeftty__doc__[] = -"set_deftty(string) -- set default database debug terminal. " -"Return previous value."; - -static PyObject * -pgsetdeftty(PyObject * self, PyObject * args) -{ - char *temp = NULL; - PyObject *old; - - /* gets arguments */ - if (!PyArg_ParseTuple(args, "z", &temp)) - { - PyErr_SetString(PyExc_TypeError, - "set_deftty(name), with name (string/None)."); - return NULL; - } - - /* adjusts value */ - old = pg_default_tty; - - if (temp) - pg_default_tty = PyString_FromString(temp); - else - { - Py_INCREF(Py_None); - pg_default_tty = Py_None; - } - - return old; -} - -/* gets default username */ -static char getdefuser__doc__[] = -"get_defuser() -- return default database username."; - -static PyObject * -pggetdefuser(PyObject * self, PyObject * args) -{ - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method get_defuser() takes no parameter."); - - return NULL; - } - - Py_XINCREF(pg_default_user); - return pg_default_user; -} - -/* sets default username */ -static char setdefuser__doc__[] = -"set_defuser() -- set default database username. Return previous value."; - -static PyObject * -pgsetdefuser(PyObject * self, PyObject * args) -{ - char *temp = NULL; - PyObject *old; - - /* gets arguments */ - if (!PyArg_ParseTuple(args, "z", &temp)) - { - PyErr_SetString(PyExc_TypeError, - "set_defuser(name), with name (string/None)."); - return NULL; - } - - /* adjusts value */ - old = pg_default_user; - - if (temp) - pg_default_user = PyString_FromString(temp); - else - { - Py_INCREF(Py_None); - pg_default_user = Py_None; - } - - return old; -} - -/* sets default password */ -static char setdefpasswd__doc__[] = -"set_defpasswd() -- set default database password."; - -static PyObject * -pgsetdefpasswd(PyObject * self, PyObject * args) -{ - char *temp = NULL; - PyObject *old; - - /* gets arguments */ - if (!PyArg_ParseTuple(args, "z", &temp)) - { - PyErr_SetString(PyExc_TypeError, - "set_defpasswd(password), with password (string/None)."); - return NULL; - } - - /* adjusts value */ - old = pg_default_passwd; - - if (temp) - pg_default_passwd = PyString_FromString(temp); - else - { - Py_INCREF(Py_None); - pg_default_passwd = Py_None; - } - - Py_INCREF(Py_None); - return Py_None; -} - -/* gets default port */ -static char getdefport__doc__[] = -"get_defport() -- return default database port."; - -static PyObject * -pggetdefport(PyObject * self, PyObject * args) -{ - /* checks args */ - if (!PyArg_ParseTuple(args, "")) - { - PyErr_SetString(PyExc_SyntaxError, - "method get_defport() takes no parameter."); - return NULL; - } - - Py_XINCREF(pg_default_port); - return pg_default_port; -} - -/* sets default port */ -static char setdefport__doc__[] = -"set_defport(integer) -- set default database port. Return previous value."; - -static PyObject * -pgsetdefport(PyObject * self, PyObject * args) -{ - long int port = -2; - PyObject *old; - - /* gets arguments */ - if ((!PyArg_ParseTuple(args, "l", &port)) || (port < -1)) - { - PyErr_SetString(PyExc_TypeError, "set_defport(port), with port " - "(positive integer/-1)."); - return NULL; - } - - /* adjusts value */ - old = pg_default_port; - - if (port != -1) - pg_default_port = PyLong_FromLong(port); - else - { - Py_INCREF(Py_None); - pg_default_port = Py_None; - } - - return old; -} -#endif /* DEFAULT_VARS */ - -/* List of functions defined in the module */ - -static struct PyMethodDef pg_methods[] = { - {"connect", (PyCFunction) pgconnect, 3, connect__doc__}, - -#ifdef DEFAULT_VARS - {"get_defhost", pggetdefhost, 1, getdefhost__doc__}, - {"set_defhost", pgsetdefhost, 1, setdefhost__doc__}, - {"get_defbase", pggetdefbase, 1, getdefbase__doc__}, - {"set_defbase", pgsetdefbase, 1, setdefbase__doc__}, - {"get_defopt", pggetdefopt, 1, getdefopt__doc__}, - {"set_defopt", pgsetdefopt, 1, setdefopt__doc__}, - {"get_deftty", pggetdeftty, 1, getdeftty__doc__}, - {"set_deftty", pgsetdeftty, 1, setdeftty__doc__}, - {"get_defport", pggetdefport, 1, getdefport__doc__}, - {"set_defport", pgsetdefport, 1, setdefport__doc__}, - {"get_defuser", pggetdefuser, 1, getdefuser__doc__}, - {"set_defuser", pgsetdefuser, 1, setdefuser__doc__}, - {"set_defpasswd", pgsetdefpasswd, 1, setdefpasswd__doc__}, -#endif /* DEFAULT_VARS */ - {NULL, NULL} /* sentinel */ -}; - -static char pg__doc__[] = "Python interface to PostgreSQL DB"; - -/* Initialization function for the module */ -DL_EXPORT(void) -init_pg(void) -{ - PyObject *mod, - *dict, - *v; - - /* Initialize here because some WIN platforms get confused otherwise */ - PglargeType.ob_type = PgType.ob_type = PgQueryType.ob_type = - PgSourceType.ob_type = &PyType_Type; - - /* Create the module and add the functions */ - mod = Py_InitModule4("_pg", pg_methods, pg__doc__, NULL, PYTHON_API_VERSION); - dict = PyModule_GetDict(mod); - - /* Add some symbolic constants to the module */ - PGError = PyString_FromString("_pg.error"); - PyDict_SetItemString(dict, "error", PGError); - - /* Make the version available */ - v = PyString_FromString(PyPgVersion); - PyDict_SetItemString(dict, "version", v); - PyDict_SetItemString(dict, "__version__", v); - Py_DECREF(v); - - /* results type for queries */ - PyDict_SetItemString(dict, "RESULT_EMPTY", PyInt_FromLong(RESULT_EMPTY)); - PyDict_SetItemString(dict, "RESULT_DML", PyInt_FromLong(RESULT_DML)); - PyDict_SetItemString(dict, "RESULT_DDL", PyInt_FromLong(RESULT_DDL)); - PyDict_SetItemString(dict, "RESULT_DQL", PyInt_FromLong(RESULT_DQL)); - -#ifdef LARGE_OBJECTS - /* create mode for large objects */ - PyDict_SetItemString(dict, "INV_READ", PyInt_FromLong(INV_READ)); - PyDict_SetItemString(dict, "INV_WRITE", PyInt_FromLong(INV_WRITE)); - - /* position flags for lo_lseek */ - PyDict_SetItemString(dict, "SEEK_SET", PyInt_FromLong(SEEK_SET)); - PyDict_SetItemString(dict, "SEEK_CUR", PyInt_FromLong(SEEK_CUR)); - PyDict_SetItemString(dict, "SEEK_END", PyInt_FromLong(SEEK_END)); -#endif /* LARGE_OBJECTS */ - -#ifdef DEFAULT_VARS - /* prepares default values */ - Py_INCREF(Py_None); - pg_default_host = Py_None; - Py_INCREF(Py_None); - pg_default_base = Py_None; - Py_INCREF(Py_None); - pg_default_opt = Py_None; - Py_INCREF(Py_None); - pg_default_port = Py_None; - Py_INCREF(Py_None); - pg_default_tty = Py_None; - Py_INCREF(Py_None); - pg_default_user = Py_None; - Py_INCREF(Py_None); - pg_default_passwd = Py_None; -#endif /* DEFAULT_VARS */ - - /* Check for errors */ - if (PyErr_Occurred()) - Py_FatalError("can't initialize module _pg"); -} diff --git a/src/interfaces/python/setup.py b/src/interfaces/python/setup.py deleted file mode 100755 index 9405dbbab83..00000000000 --- a/src/interfaces/python/setup.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python - -# Setup script for the PyGreSQL version 3 -# created 2000/04 Mark Alexander <mwa@gate.net> -# tweaked 2000/05 Jeremy Hylton <jeremy@cnri.reston.va.us> -# win32 support 2001/01 Gerhard Haering <gerhard@bigfoot.de> - -# requires distutils; standard in Python 1.6, otherwise download from -# http://www.python.org/sigs/distutils-sig/download.html - -# You may have to change the first 3 variables (include_dirs, -# library_dirs, optional_libs) to match your postgres distribution. - -# Now, you can: -# python setup.py build # to build the module -# python setup.py install # to install it - -# See http://www.python.org/sigs/distutils-sig/doc/ for more information -# on using distutils to install Python programs. - -from distutils.core import setup -from distutils.extension import Extension -import sys - -if sys.platform == "win32": - # If you want to build from source; you must have built a win32 native libpq # before and copied libpq.dll into the PyGreSQL root directory. - win_pg_build_root = 'd:/dev/pg/postgresql-7.0.2/' - include_dirs=[ win_pg_build_root + 'src/include', win_pg_build_root + '/src/include/libpq', win_pg_build_root + 'src', win_pg_build_root + 'src/interfaces/libpq' ] - library_dirs=[ win_pg_build_root + 'src/interfaces/libpq/Release' ] - optional_libs=[ 'libpqdll', 'wsock32', 'advapi32' ] - data_files = [ 'libpq.dll' ] -else: - include_dirs=['/usr/include/pgsql'] - library_dirs=['usr/lib/pgsql'] - optional_libs=['pq'] - data_files = [] - -setup (name = "PyGreSQL", - version = "3.3", - description = "Python PostgreSQL Interfaces", - author = "D'Arcy J. M. Cain", - author_email = "darcy@druid.net", - url = "http://www.druid.net/pygresql/", - licence = "Python", - - py_modules = ['pg', 'pgdb'], - ext_modules = [ Extension( - name='_pg', - sources = ['pgmodule.c'], - include_dirs = include_dirs, - library_dirs = library_dirs, - libraries = optional_libs - )], - data_files = data_files -) - diff --git a/src/interfaces/python/tutorial/advanced.py b/src/interfaces/python/tutorial/advanced.py deleted file mode 100755 index 49e6e436e8c..00000000000 --- a/src/interfaces/python/tutorial/advanced.py +++ /dev/null @@ -1,178 +0,0 @@ -#! /usr/bin/env python -# advanced.py - demo of advanced features of PostGres. Some may not be ANSI. -# inspired from the Postgres tutorial -# adapted to Python 1995 by Pascal Andre - -print """ -__________________________________________________________________ -MODULE ADVANCED.PY : ADVANCED POSTGRES SQL COMMANDS TUTORIAL - -This module is designed for being imported from python prompt - -In order to run the samples included here, first create a connection -using : cnx = advanced.DB(...) - -The "..." should be replaced with whatever arguments you need to open an -existing database. Usually all you need is the name of the database and, -in fact, if it is the same as your login name, you can leave it empty. - -then start the demo with: advanced.demo(cnx) -__________________________________________________________________ -""" - -from pg import DB -import sys - -# waits for a key -def wait_key(): - print "Press <enter>" - sys.stdin.read(1) - -# inheritance features -def inherit_demo(pgcnx): - print "-----------------------------" - print "-- Inheritance:" - print "-- a table can inherit from zero or more tables. A query" - print "-- can reference either all rows of a table or all rows " - print "-- of a table plus all of its descendants." - print "-----------------------------" - print - print "-- For example, the capitals table inherits from cities table." - print "-- (It inherits all data fields from cities.)" - print - print "CREATE TABLE cities (" - print " name text," - print " population float8," - print " altitude int" - print ")" - print - print "CREATE TABLE capitals (" - print " state varchar(2)" - print ") INHERITS (cities)" - pgcnx.query("""CREATE TABLE cities ( - name text, - population float8, - altitude int)""") - pgcnx.query("""CREATE TABLE capitals ( - state varchar(2)) INHERITS (cities)""") - wait_key() - print - print "-- now, let's populate the tables" - print - print "INSERT INTO cities VALUES ('San Francisco', 7.24E+5, 63)" - print "INSERT INTO cities VALUES ('Las Vegas', 2.583E+5, 2174)" - print "INSERT INTO cities VALUES ('Mariposa', 1200, 1953)" - print - print "INSERT INTO capitals VALUES ('Sacramento', 3.694E+5, 30, 'CA')" - print "INSERT INTO capitals VALUES ('Madison', 1.913E+5, 845, 'WI')" - print - pgcnx.query("INSERT INTO cities VALUES ('San Francisco', 7.24E+5, 63)") - pgcnx.query("INSERT INTO cities VALUES ('Las Vegas', 2.583E+5, 2174)") - pgcnx.query("INSERT INTO cities VALUES ('Mariposa', 1200, 1953)") - pgcnx.query("INSERT INTO capitals VALUES ('Sacramento',3.694E+5,30,'CA')") - pgcnx.query("INSERT INTO capitals VALUES ('Madison', 1.913E+5, 845, 'WI')") - print - print "SELECT * FROM cities" - print pgcnx.query("SELECT * FROM cities") - print "SELECT * FROM capitals" - print pgcnx.query("SELECT * FROM capitals") - print - print "-- like before, a regular query references rows of the base" - print "-- table only" - print - print "SELECT name, altitude" - print "FROM cities" - print "WHERE altitude > 500;" - print pgcnx.query("""SELECT name, altitude - FROM cities - WHERE altitude > 500""") - print - print "-- on the other hand, you can find all cities, including " - print "-- capitals, that are located at an altitude of 500 'ft " - print "-- or higher by:" - print - print "SELECT c.name, c.altitude" - print "FROM cities* c" - print "WHERE c.altitude > 500" - print pgcnx.query("""SELECT c.name, c.altitude - FROM cities* c - WHERE c.altitude > 500""") - -# arrays attributes -def array_demo(pgcnx): - print "----------------------" - print "-- Arrays:" - print "-- attributes can be arrays of base types or user-defined " - print "-- types" - print "----------------------" - print - print "CREATE TABLE sal_emp (" - print " name text," - print " pay_by_quarter int4[]," - print " schedule text[][]" - print ")" - pgcnx.query("""CREATE TABLE sal_emp ( - name text, - pay_by_quarter int4[], - schedule text[][])""") - wait_key() - print - print "-- insert instances with array attributes. " - print " Note the use of braces" - print - print "INSERT INTO sal_emp VALUES (" - print " 'Bill'," - print " '{10000,10000,10000,10000}'," - print " '{{\"meeting\", \"lunch\"}, {}}')" - print - print "INSERT INTO sal_emp VALUES (" - print " 'Carol'," - print " '{20000,25000,25000,25000}'," - print " '{{\"talk\", \"consult\"}, {\"meeting\"}}')" - print - pgcnx.query("""INSERT INTO sal_emp VALUES ( - 'Bill', '{10000,10000,10000,10000}', - '{{\"meeting\", \"lunch\"}, {}}')""") - pgcnx.query("""INSERT INTO sal_emp VALUES ( - 'Carol', '{20000,25000,25000,25000}', - '{{\"talk\", \"consult\"}, {\"meeting\"}}')""") - wait_key() - print - print "----------------------" - print "-- queries on array attributes" - print "----------------------" - print - print "SELECT name FROM sal_emp WHERE" - print " sal_emp.pay_by_quarter[1] <> sal_emp.pay_by_quarter[2]" - print - print pgcnx.query("""SELECT name FROM sal_emp WHERE - sal_emp.pay_by_quarter[1] <> sal_emp.pay_by_quarter[2]""") - print - print "-- retrieve third quarter pay of all employees" - print - print "SELECT sal_emp.pay_by_quarter[3] FROM sal_emp" - print - print pgcnx.query("SELECT sal_emp.pay_by_quarter[3] FROM sal_emp") - print - print "-- select subarrays" - print - print "SELECT sal_emp.schedule[1:2][1:1] FROM sal_emp WHERE" - print " sal_emp.name = 'Bill'" - print pgcnx.query("SELECT sal_emp.schedule[1:2][1:1] FROM sal_emp WHERE " \ - "sal_emp.name = 'Bill'") - -# base cleanup -def demo_cleanup(pgcnx): - print "-- clean up (you must remove the children first)" - print "DROP TABLE sal_emp" - print "DROP TABLE capitals" - print "DROP TABLE cities;" - pgcnx.query("DROP TABLE sal_emp") - pgcnx.query("DROP TABLE capitals") - pgcnx.query("DROP TABLE cities") - -# main demo function -def demo(pgcnx): - inherit_demo(pgcnx) - array_demo(pgcnx) - demo_cleanup(pgcnx) diff --git a/src/interfaces/python/tutorial/basics.py b/src/interfaces/python/tutorial/basics.py deleted file mode 100755 index 98a7f86a90b..00000000000 --- a/src/interfaces/python/tutorial/basics.py +++ /dev/null @@ -1,296 +0,0 @@ -#! /usr/bin/env python -# basics.py - basic SQL commands tutorial -# inspired from the Postgres95 tutorial -# adapted to Python 1995 by Pascal ANDRE - -print """ -__________________________________________________________________ -MODULE BASICS.PY : BASIC POSTGRES SQL COMMANDS TUTORIAL - -This module is designed for being imported from python prompt - -In order to run the samples included here, first create a connection -using : cnx = basics.DB(...) - -The "..." should be replaced with whatever arguments you need to open an -existing database. Usually all you need is the name of the database and, -in fact, if it is the same as your login name, you can leave it empty. - -then start the demo with: basics.demo(cnx) -__________________________________________________________________ -""" - -from pg import DB -import sys - -# waits for a key -def wait_key(): - print "Press <enter>" - sys.stdin.read(1) - -# table creation commands -def create_table(pgcnx): - print "-----------------------------" - print "-- Creating a table:" - print "-- a CREATE TABLE is used to create base tables. POSTGRES" - print "-- SQL has its own set of built-in types. (Note that" - print "-- keywords are case-insensitive but identifiers are " - print "-- case-sensitive.)" - print "-----------------------------" - print - print "Sending query :" - print "CREATE TABLE weather (" - print " city varchar(80)," - print " temp_lo int," - print " temp_hi int," - print " prcp float8," - print " date date" - print ")" - pgcnx.query("""CREATE TABLE weather (city varchar(80), temp_lo int, - temp_hi int, prcp float8, date date)""") - print - print "Sending query :" - print "CREATE TABLE cities (" - print " name varchar(80)," - print " location point" - print ")" - pgcnx.query("""CREATE TABLE cities ( - name varchar(80), - location point)""") - -# data insertion commands -def insert_data(pgcnx): - print "-----------------------------" - print "-- Inserting data:" - print "-- an INSERT statement is used to insert a new row into" - print "-- a table. There are several ways you can specify what" - print "-- columns the data should go to." - print "-----------------------------" - print - print "-- 1. the simplest case is when the list of value correspond to" - print "-- the order of the columns specified in CREATE TABLE." - print - print "Sending query :" - print "INSERT INTO weather " - print " VALUES ('San Francisco', 46, 50, 0.25, '11/27/1994')" - pgcnx.query("""INSERT INTO weather - VALUES ('San Francisco', 46, 50, 0.25, '11/27/1994')""") - print - print "Sending query :" - print "INSERT INTO cities " - print " VALUES ('San Francisco', '(-194.0, 53.0)')" - pgcnx.query("""INSERT INTO cities - VALUES ('San Francisco', '(-194.0, 53.0)')""") - print - wait_key() - print "-- 2. you can also specify what column the values correspond " - print " to. (The columns can be specified in any order. You may " - print " also omit any number of columns. eg. unknown precipitation" - print " below)" - print "Sending query :" - print "INSERT INTO weather (city, temp_lo, temp_hi, prcp, date)" - print " VALUES ('San Francisco', 43, 57, 0.0, '11/29/1994')" - pgcnx.query("INSERT INTO weather (date, city, temp_hi, temp_lo)" \ - "VALUES ('11/29/1994', 'Hayward', 54, 37)") - -# direct selection commands -def select_data1(pgcnx): - print "-----------------------------" - print "-- Retrieving data:" - print "-- a SELECT statement is used for retrieving data. The " - print "-- basic syntax is:" - print "-- SELECT columns FROM tables WHERE predicates" - print "-----------------------------" - print - print "-- a simple one would be the query:" - print "SELECT * FROM weather" - print - print "The result is :" - q = pgcnx.query("SELECT * FROM weather") - print q - print - print "-- you may also specify expressions in the target list (the " - print "-- 'AS column' specifies the column name of the result. It is " - print "-- optional.)" - print "The query :" - print " SELECT city, (temp_hi+temp_lo)/2 AS temp_avg, date " - print " FROM weather" - print "Gives :" - print pgcnx.query("""SELECT city, (temp_hi+temp_lo)/2 - AS temp_avg, date FROM weather""") - print - print "-- if you want to retrieve rows that satisfy certain condition" - print "-- (ie. a restriction), specify the condition in WHERE. The " - print "-- following retrieves the weather of San Francisco on rainy " - print "-- days." - print "SELECT *" - print "FROM weather" - print "WHERE city = 'San Francisco' " - print " and prcp > 0.0" - print pgcnx.query("""SELECT * FROM weather WHERE city = 'San Francisco' - AND prcp > 0.0""") - print - print "-- here is a more complicated one. Duplicates are removed when " - print "-- DISTINCT is specified. ORDER BY specifies the column to sort" - print "-- on. (Just to make sure the following won't confuse you, " - print "-- DISTINCT and ORDER BY can be used separately.)" - print "SELECT DISTINCT city" - print "FROM weather" - print "ORDER BY city;" - print pgcnx.query("SELECT DISTINCT city FROM weather ORDER BY city") - -# selection to a temporary table -def select_data2(pgcnx): - print "-----------------------------" - print "-- Retrieving data into other classes:" - print "-- a SELECT ... INTO statement can be used to retrieve " - print "-- data into another class." - print "-----------------------------" - print - print "The query :" - print "SELECT * INTO TABLE temptab " - print "FROM weather" - print "WHERE city = 'San Francisco' " - print " and prcp > 0.0" - pgcnx.query("""SELECT * INTO TABLE temptab FROM weather - WHERE city = 'San Francisco' and prcp > 0.0""") - print "Fills the table temptab, that can be listed with :" - print "SELECT * from temptab" - print pgcnx.query("SELECT * from temptab") - -# aggregate creation commands -def create_aggregate(pgcnx): - print "-----------------------------" - print "-- Aggregates" - print "-----------------------------" - print - print "Let's consider the query :" - print "SELECT max(temp_lo)" - print "FROM weather;" - print pgcnx.query("SELECT max(temp_lo) FROM weather") - print - print "-- Aggregate with GROUP BY" - print "SELECT city, max(temp_lo)" - print "FROM weather " - print "GROUP BY city;" - print pgcnx.query( """SELECT city, max(temp_lo) - FROM weather GROUP BY city""") - -# table join commands -def join_table(pgcnx): - print "-----------------------------" - print "-- Joining tables:" - print "-- queries can access multiple tables at once or access" - print "-- the same table in such a way that multiple instances" - print "-- of the table are being processed at the same time." - print "-----------------------------" - print - print "-- suppose we want to find all the records that are in the " - print "-- temperature range of other records. W1 and W2 are aliases " - print "--for weather." - print - print "SELECT W1.city, W1.temp_lo, W1.temp_hi, " - print " W2.city, W2.temp_lo, W2.temp_hi" - print "FROM weather W1, weather W2" - print "WHERE W1.temp_lo < W2.temp_lo " - print " and W1.temp_hi > W2.temp_hi" - print - print pgcnx.query("""SELECT W1.city, W1.temp_lo, W1.temp_hi, - W2.city, W2.temp_lo, W2.temp_hi FROM weather W1, weather W2 - WHERE W1.temp_lo < W2.temp_lo and W1.temp_hi > W2.temp_hi""") - print - print "-- let's join two tables. The following joins the weather table" - print "-- and the cities table." - print - print "SELECT city, location, prcp, date" - print "FROM weather, cities" - print "WHERE name = city" - print - print pgcnx.query("""SELECT city, location, prcp, date FROM weather, cities - WHERE name = city""") - print - print "-- since the column names are all different, we don't have to " - print "-- specify the table name. If you want to be clear, you can do " - print "-- the following. They give identical results, of course." - print - print "SELECT w.city, c.location, w.prcp, w.date" - print "FROM weather w, cities c" - print "WHERE c.name = w.city;" - print - print pgcnx.query("""SELECT w.city, c.location, w.prcp, w.date - FROM weather w, cities c WHERE c.name = w.city""") - -# data updating commands -def update_data(pgcnx): - print "-----------------------------" - print "-- Updating data:" - print "-- an UPDATE statement is used for updating data. " - print "-----------------------------" - print - print "-- suppose you discover the temperature readings are all off by" - print "-- 2 degrees as of Nov 28, you may update the data as follow:" - print - print "UPDATE weather" - print " SET temp_hi = temp_hi - 2, temp_lo = temp_lo - 2" - print " WHERE date > '11/28/1994'" - print - pgcnx.query("""UPDATE weather - SET temp_hi = temp_hi - 2, temp_lo = temp_lo - 2 - WHERE date > '11/28/1994'""") - print - print "SELECT * from weather" - print pgcnx.query("SELECT * from weather") - -# data deletion commands -def delete_data(pgcnx): - print "-----------------------------" - print "-- Deleting data:" - print "-- a DELETE statement is used for deleting rows from a " - print "-- table." - print "-----------------------------" - print - print "-- suppose you are no longer interested in the weather of " - print "-- Hayward, you can do the following to delete those rows from" - print "-- the table" - print - print "DELETE FROM weather WHERE city = 'Hayward'" - pgcnx.query("DELETE FROM weather WHERE city = 'Hayward'") - print - print "SELECT * from weather" - print - print pgcnx.query("SELECT * from weather") - print - print "-- you can also delete all the rows in a table by doing the " - print "-- following. (This is different from DROP TABLE which removes " - print "-- the table in addition to the removing the rows.)" - print - print "DELETE FROM weather" - pgcnx.query("DELETE FROM weather") - print - print "SELECT * from weather" - print pgcnx.query("SELECT * from weather") - -# table removal commands -def remove_table(pgcnx): - print "-----------------------------" - print "-- Removing the tables:" - print "-- DROP TABLE is used to remove tables. After you have" - print "-- done this, you can no longer use those tables." - print "-----------------------------" - print - print "DROP TABLE weather, cities, temptab" - pgcnx.query("DROP TABLE weather, cities, temptab") - -# main demo function -def demo(pgcnx): - create_table(pgcnx) - wait_key() - insert_data(pgcnx) - wait_key() - select_data1(pgcnx) - select_data2(pgcnx) - create_aggregate(pgcnx) - join_table(pgcnx) - update_data(pgcnx) - delete_data(pgcnx) - remove_table(pgcnx) diff --git a/src/interfaces/python/tutorial/func.py b/src/interfaces/python/tutorial/func.py deleted file mode 100755 index 4ae1876e044..00000000000 --- a/src/interfaces/python/tutorial/func.py +++ /dev/null @@ -1,205 +0,0 @@ -# func.py - demonstrate the use of SQL functions -# inspired from the PostgreSQL tutorial -# adapted to Python 1995 by Pascal ANDRE - -print """ -__________________________________________________________________ -MODULE FUNC.PY : SQL FUNCTION DEFINITION TUTORIAL - -This module is designed for being imported from python prompt - -In order to run the samples included here, first create a connection -using : cnx = advanced.DB(...) - -The "..." should be replaced with whatever arguments you need to open an -existing database. Usually all you need is the name of the database and, -in fact, if it is the same as your login name, you can leave it empty. - -then start the demo with: func.demo(cnx) -__________________________________________________________________ -""" - -from pg import DB -import sys - -# waits for a key -def wait_key(): - print "Press <enter>" - sys.stdin.read(1) - -# basic functions declaration -def base_func(pgcnx): - print "-----------------------------" - print "-- Creating SQL Functions on Base Types" - print "-- a CREATE FUNCTION statement lets you create a new " - print "-- function that can be used in expressions (in SELECT, " - print "-- INSERT, etc.). We will start with functions that " - print "-- return values of base types." - print "-----------------------------" - print - print "--" - print "-- let's create a simple SQL function that takes no arguments" - print "-- and returns 1" - print - print "CREATE FUNCTION one() RETURNS int4" - print " AS 'SELECT 1 as ONE' LANGUAGE 'sql'" - pgcnx.query("""CREATE FUNCTION one() RETURNS int4 - AS 'SELECT 1 as ONE' LANGUAGE 'sql'""") - wait_key() - print - print "--" - print "-- functions can be used in any expressions (eg. in the target" - print "-- list or qualifications)" - print - print "SELECT one() AS answer" - print pgcnx.query("SELECT one() AS answer") - print - print "--" - print "-- here's how you create a function that takes arguments. The" - print "-- following function returns the sum of its two arguments:" - print - print "CREATE FUNCTION add_em(int4, int4) RETURNS int4" - print " AS 'SELECT $1 + $2' LANGUAGE 'sql'" - pgcnx.query("""CREATE FUNCTION add_em(int4, int4) RETURNS int4 - AS 'SELECT $1 + $2' LANGUAGE 'sql'""") - print - print "SELECT add_em(1, 2) AS answer" - print pgcnx.query("SELECT add_em(1, 2) AS answer") - -# functions on composite types -def comp_func(pgcnx): - print "-----------------------------" - print "-- Creating SQL Functions on Composite Types" - print "-- it is also possible to create functions that return" - print "-- values of composite types." - print "-----------------------------" - print - print "-- before we create more sophisticated functions, let's " - print "-- populate an EMP table" - print - print "CREATE TABLE EMP (" - print " name text," - print " salary int4," - print " age int4," - print " dept varchar(16)" - print ")" - pgcnx.query("""CREATE TABLE EMP ( - name text, - salary int4, - age int4, - dept varchar(16))""") - print - print "INSERT INTO EMP VALUES ('Sam', 1200, 16, 'toy')" - print "INSERT INTO EMP VALUES ('Claire', 5000, 32, 'shoe')" - print "INSERT INTO EMP VALUES ('Andy', -1000, 2, 'candy')" - print "INSERT INTO EMP VALUES ('Bill', 4200, 36, 'shoe')" - print "INSERT INTO EMP VALUES ('Ginger', 4800, 30, 'candy')" - pgcnx.query("INSERT INTO EMP VALUES ('Sam', 1200, 16, 'toy')") - pgcnx.query("INSERT INTO EMP VALUES ('Claire', 5000, 32, 'shoe')") - pgcnx.query("INSERT INTO EMP VALUES ('Andy', -1000, 2, 'candy')") - pgcnx.query("INSERT INTO EMP VALUES ('Bill', 4200, 36, 'shoe')") - pgcnx.query("INSERT INTO EMP VALUES ('Ginger', 4800, 30, 'candy')") - wait_key() - print - print "-- the argument of a function can also be a tuple. For " - print "-- instance, double_salary takes a tuple of the EMP table" - print - print "CREATE FUNCTION double_salary(EMP) RETURNS int4" - print " AS 'SELECT $1.salary * 2 AS salary' LANGUAGE 'sql'" - pgcnx.query("""CREATE FUNCTION double_salary(EMP) RETURNS int4 - AS 'SELECT $1.salary * 2 AS salary' LANGUAGE 'sql'""") - print - print "SELECT name, double_salary(EMP) AS dream" - print "FROM EMP" - print "WHERE EMP.dept = 'toy'" - print pgcnx.query("""SELECT name, double_salary(EMP) AS dream - FROM EMP WHERE EMP.dept = 'toy'""") - print - print "-- the return value of a function can also be a tuple. However," - print "-- make sure that the expressions in the target list is in the " - print "-- same order as the columns of EMP." - print - print "CREATE FUNCTION new_emp() RETURNS EMP" - print " AS 'SELECT \'None\'::text AS name," - print " 1000 AS salary," - print " 25 AS age," - print " \'none\'::varchar(16) AS dept'" - print " LANGUAGE 'sql'" - pgcnx.query("""CREATE FUNCTION new_emp() RETURNS EMP - AS 'SELECT \\\'None\\\'::text AS name, - 1000 AS salary, - 25 AS age, - \\\'none\\\'::varchar(16) AS dept' - LANGUAGE 'sql'""") - wait_key() - print - print "-- you can then project a column out of resulting the tuple by" - print "-- using the \"function notation\" for projection columns. " - print "-- (ie. bar(foo) is equivalent to foo.bar) Note that we don't" - print "-- support new_emp().name at this moment." - print - print "SELECT name(new_emp()) AS nobody" - print pgcnx.query("SELECT name(new_emp()) AS nobody") - print - print "-- let's try one more function that returns tuples" - print "CREATE FUNCTION high_pay() RETURNS setof EMP" - print " AS 'SELECT * FROM EMP where salary > 1500'" - print " LANGUAGE 'sql'" - pgcnx.query("""CREATE FUNCTION high_pay() RETURNS setof EMP - AS 'SELECT * FROM EMP where salary > 1500' - LANGUAGE 'sql'""") - print - print "SELECT name(high_pay()) AS overpaid" - print pgcnx.query("SELECT name(high_pay()) AS overpaid") - -# function with multiple SQL commands -def mult_func(pgcnx): - print "-----------------------------" - print "-- Creating SQL Functions with multiple SQL statements" - print "-- you can also create functions that do more than just a" - print "-- SELECT." - print "-----------------------------" - print - print "-- you may have noticed that Andy has a negative salary. We'll" - print "-- create a function that removes employees with negative " - print "-- salaries." - print - print "SELECT * FROM EMP" - print pgcnx.query("SELECT * FROM EMP") - print - print "CREATE FUNCTION clean_EMP () RETURNS int4" - print " AS 'DELETE FROM EMP WHERE EMP.salary <= 0" - print " SELECT 1 AS ignore_this'" - print " LANGUAGE 'sql'" - pgcnx.query("CREATE FUNCTION clean_EMP () RETURNS int4 AS 'DELETE FROM EMP WHERE EMP.salary <= 0; SELECT 1 AS ignore_this' LANGUAGE 'sql'") - print - print "SELECT clean_EMP()" - print pgcnx.query("SELECT clean_EMP()") - print - print "SELECT * FROM EMP" - print pgcnx.query("SELECT * FROM EMP") - -# base cleanup -def demo_cleanup(pgcnx): - print "-- remove functions that were created in this file" - print - print "DROP FUNCTION clean_EMP()" - print "DROP FUNCTION high_pay()" - print "DROP FUNCTION new_emp()" - print "DROP FUNCTION add_em(int4, int4)" - print "DROP FUNCTION one()" - print - print "DROP TABLE EMP" - pgcnx.query("DROP FUNCTION clean_EMP()") - pgcnx.query("DROP FUNCTION high_pay()") - pgcnx.query("DROP FUNCTION new_emp()") - pgcnx.query("DROP FUNCTION add_em(int4, int4)") - pgcnx.query("DROP FUNCTION one()") - pgcnx.query("DROP TABLE EMP") - -# main demo function -def demo(pgcnx): - base_func(pgcnx) - comp_func(pgcnx) - mult_func(pgcnx) - demo_cleanup(pgcnx) diff --git a/src/interfaces/python/tutorial/syscat.py b/src/interfaces/python/tutorial/syscat.py deleted file mode 100755 index f45d62470d0..00000000000 --- a/src/interfaces/python/tutorial/syscat.py +++ /dev/null @@ -1,148 +0,0 @@ -# syscat.py - parses some system catalogs -# inspired from the PostgreSQL tutorial -# adapted to Python 1995 by Pascal ANDRE - -print """ -__________________________________________________________________ -MODULE SYSCAT.PY : PARSES SOME POSTGRESQL SYSTEM CATALOGS - -This module is designed for being imported from python prompt - -In order to run the samples included here, first create a connection -using : cnx = syscat.DB(...) - -The "..." should be replaced with whatever arguments you need to open an -existing database. Usually all you need is the name of the database and, -in fact, if it is the same as your login name, you can leave it empty. - -then start the demo with: syscat.demo(cnx) - -Some results may be empty, depending on your base status." - -__________________________________________________________________ -""" - -from pg import DB -import sys - -# waits for a key -def wait_key(): - print "Press <enter>" - sys.stdin.read(1) - -# lists all simple indices -def list_simple_ind(pgcnx): - result = pgcnx.query("""SELECT bc.relname AS class_name, - ic.relname AS index_name, a.attname - FROM pg_class bc, pg_class ic, pg_index i, pg_attribute a - WHERE i.indrelid = bc.oid AND i.indexrelid = bc.oid - AND i.indkey[0] = a.attnum AND a.attrelid = bc.oid - AND i.indproc = '0'::oid - ORDER BY class_name, index_name, attname""") - return result - -# list all user defined attributes and their type in user-defined classes -def list_all_attr(pgcnx): - result = pgcnx.query("""SELECT c.relname, a.attname, t.typname - FROM pg_class c, pg_attribute a, pg_type t - WHERE c.relkind = 'r' and c.relname !~ '^pg_' - AND c.relname !~ '^Inv' and a.attnum > 0 - AND a.attrelid = c.oid and a.atttypid = t.oid - ORDER BY relname, attname""") - return result - -# list all user defined base type -def list_user_base_type(pgcnx): - result = pgcnx.query("""SELECT u.usename, t.typname - FROM pg_type t, pg_user u - WHERE u.usesysid = int2in(int4out(t.typowner)) - AND t.typrelid = '0'::oid and t.typelem = '0'::oid - AND u.usename <> 'postgres' order by usename, typname""") - return result - -# list all right-unary operators -def list_right_unary_operator(pgcnx): - result = pgcnx.query("""SELECT o.oprname AS right_unary, - lt.typname AS operand, result.typname AS return_type - FROM pg_operator o, pg_type lt, pg_type result - WHERE o.oprkind='r' and o.oprleft = lt.oid - AND o.oprresult = result.oid - ORDER BY operand""") - return result - -# list all left-unary operators -def list_left_unary_operator(pgcnx): - result = pgcnx.query("""SELECT o.oprname AS left_unary, - rt.typname AS operand, result.typname AS return_type - FROM pg_operator o, pg_type rt, pg_type result - WHERE o.oprkind='l' AND o.oprright = rt.oid - AND o.oprresult = result.oid - ORDER BY operand""") - return result - -# list all binary operators -def list_binary_operator(pgcnx): - result = pgcnx.query("""SELECT o.oprname AS binary_op, - rt.typname AS right_opr, lt.typname AS left_opr, - result.typname AS return_type - FROM pg_operator o, pg_type rt, pg_type lt, pg_type result - WHERE o.oprkind = 'b' AND o.oprright = rt.oid - AND o.oprleft = lt.oid AND o.oprresult = result.oid""") - return result - -# returns the name, args and return type from all function of lang l -def list_lang_func(pgcnx, l): - result = pgcnx.query("""SELECT p.proname, p.pronargs, t.typname - FROM pg_proc p, pg_language l, pg_type t - WHERE p.prolang = l.oid AND p.prorettype = t.oid - AND l.lanname = '%s' - ORDER BY proname""" % l) - return result - -# lists all the aggregate functions and the type to which they can be applied -def list_agg_func(pgcnx): - result = pgcnx.query("""SELECT p.proname, t.typname - FROM pg_aggregate a, pg_proc p, pg_type t - WHERE a.aggfnoid = p.oid - and p.proargtypes[0] = t.oid - ORDER BY proname, typname""") - return result - -# lists all the operator classes that can be used with each access method as -# well as the operators that can be used with the respective operator classes -def list_op_class(pgcnx): - result = pgcnx.query("""SELECT am.amname, opc.opcname, opr.oprname - FROM pg_am am, pg_amop amop, pg_opclass opc, pg_operator opr - WHERE amop.amopid = am.oid and amop.amopclaid = opc.oid - AND amop.amopopr = opr.oid order by amname, opcname, oprname""") - return result - -# demo function - runs all examples -def demo(pgcnx): - import sys, os - save_stdout = sys.stdout - sys.stdout = os.popen("more", "w") - print "Listing simple indices ..." - print list_simple_ind(pgcnx) - print "Listing all attributes ..." - print list_all_attr(pgcnx) - print "Listing all user-defined base types ..." - print list_user_base_type(pgcnx) - print "Listing all left-unary operators defined ..." - print list_left_unary_operator(pgcnx) - print "Listing all right-unary operators defined ..." - print list_right_unary_operator(pgcnx) - print "Listing all binary operators ..." - print list_binary_operator(pgcnx) - print "Listing C external function linked ..." - print list_lang_func(pgcnx, 'C') - print "Listing C internal functions ..." - print list_lang_func(pgcnx, 'internal') - print "Listing SQL functions defined ..." - print list_lang_func(pgcnx, 'sql') - print "Listing 'aggregate functions' ..." - print list_agg_func(pgcnx) - print "Listing 'operator classes' ..." - print list_op_class(pgcnx) - del sys.stdout - sys.stdout = save_stdout |