2010-01-11  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Release: 0.39 (tag v0.39)

2010-01-11  Thien-Thi Nguyen  <ttn@gnuvola.org>

	No longer accept keyword for `pg-parameter-status' PARM arg.

	* libpq.c (pg_parameter_status):
	No longer accept keyword for PARM arg.

2010-01-11  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Drop procs `pg-set-client-data!', `pg-get-client-data'.

	* libpq.c (xc_t): Delete member `client'.
	(xc_mark): Update.
	(CONN_CLIENT): Delete cpp macro.
	(pg_connectdb): Update.
	(pg_get_client_data, pg_set_client_data): Delete funcs.

2010-01-11  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Drop proc `pg-lo-get-connection'.

	* libpq.c (lob_lo_get_connection): Delete func.

2010-01-11  Thien-Thi Nguyen  <ttn@gnuvola.org>

	[C int] Add cast to silence compiler warning.

	* libpq.c (pg_mblen): Add cast in call to `PQmblen'.

2009-06-22  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Release: 0.38 (tag v0.38)

2009-06-22  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Make `pg-parameter-status' accept symbol for PARM.

	* libpq.c (pg_parameter_status): Accept symbol as PARM.

2009-06-22  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Mention imminent demise of certain procs.

	* libpq.c (lob_lo_get_connection):
	Add "will be removed" notice to docstring.
	(pg_get_client_data, pg_set_client_data): Likewise.

2009-06-21  Thien-Thi Nguyen  <ttn@gnuvola.org>

	[build] Minimize "make -C doc/" work in default case.

	* Makefile.am (schemefrags, schemestems): New vars.
	(dotdocfiles): Delete postgres-resdisp.doc, postgres-types.doc,
	postgres-col-defs.doc, postgres-resx.doc, postgres-qcons.doc,
	postgres-gxrepl.doc, postgres-table.doc, postgres-meta.doc.
	(BUILT_SOURCES): Delete $(dotdocfiles).
	(dist_d_DATA): Use $(schemestems).
	(BUILT_SOURCES) [MAINTAINER_MODE]: Append $(dotdocfiles).

2009-06-21  Thien-Thi Nguyen  <ttn@gnuvola.org>

	[config] Use CPPFLAGS, LDFLAGS directly.

	* Makefile.am (AM_CPPFLAGS): Delete var.
	(postgres_la_LDFLAGS): Remove $(LDFLAGS), $(PQ_LDFLAGS).
	(snarfcppopts): Remove $(AM_CPPFLAGS); add $(DEFAULT_INCLUDES).

2009-06-21  Thien-Thi Nguyen  <ttn@gnuvola.org>

	[C int] Update #include:d files.

	* libpq.c: #include "config.h" instead of <config.h>;
	#include <stdlib.h>.

2009-06-20  Thien-Thi Nguyen  <ttn@gnuvola.org>

	New (database postgres) proc: pg-server-version

	* libpq.c (pg_server_version): New GH_DEFPROC.

2009-06-20  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Revert: Support "E-prefixing" for `pgtable-manager' SQL quoting.

	That is the wrong approach.

	* postgres-table.scm: From module (database postgres),
	no longer select `pg-result-status'.
	(pgtable-manager): Use `sql-quote' directly.

2009-06-20  Thien-Thi Nguyen  <ttn@gnuvola.org>

	[qcons] Do single-quote escaping via doubling, per SQL standard.

	* postgres-qcons.scm (sql-quote): Escape single-quote
	by doubling, instead of inserting a backslash prior to, it.

2009-06-20  Thien-Thi Nguyen  <ttn@gnuvola.org>

	[t-mgr int] For column values, allow keywords to stand for themselves.

	* postgres-table.scm (pgtable-manager ->db-insert-string):
	Pass all keywords through, unchanged.

2009-06-19  Thien-Thi Nguyen  <ttn@gnuvola.org>

	[t-mgr] Recognize #:DEFAULT as column value.

	* postgres-table.scm (pgtable-manager ->db-insert-string):
	For #:DEFAULT, return "DEFAULT".

2009-06-18  Thien-Thi Nguyen  <ttn@gnuvola.org>

	New (database postgres) proc: pg-mblen

	* libpq.c (pg_char_to_encoding) [!HAVE_DECL_PG_CHAR_TO_ENCODING]:
	New func decl.
	(encoding_alist): New static data structure.
	(pg_mblen): New GH_DEFPROC.
	(init_module): Init `encoding_alist'.

2009-01-05  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Decruft: Use 1..7 instead of SCM_ARG1..SCM_ARG7.

	* libpq.c (pg_get_copy_data, pg_make_print_options)
	(pg_print, pg_set_notice_out_x): Use 1..7 directly.

2008-11-27  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Use `(ftell port)' instead of `(seek port 0 SEEK_CUR)'.

	* libpq.c (lob_lo_tell): Use `scm_ftell'.

2008-11-21  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Decruft: Don't (pretend) to wrap system calls.

	* libpq.c (SYSCALL): Delete macro.
	(pg_trace, pg_untrace, pg_print): Update.

2008-09-18  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Use `(string-null? foo)' instead of `(string=? "" foo)'.

	* postgres-gxrepl.scm (gxrepl -read): Use `string-null?'.
	(gxrepl -print): Likewise.
	* postgres-table.scm (pgtable-manager): Likewise.

2008-09-06  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Use `size_t' instead of `scm_sizet'.

	* libpq.c (xc_free): Change return value type to `size_t'.
	(res_free, sepo_free): Likewise.

2008-08-16  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Remove support for unused SCM_OUTPORTP.

	* gi.h (SCM_OUTPORTP) [!HAVE_SCM_OUTPORTP]:
	Delete macro and surrounding #ifndef construct.

2008-08-16  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Hone C internals: Refactor, increase/add abstraction, etc.

	* libpq.c (PROB, NOINTS, INTSOK, GIVENP): New macros.
	(EXACTLY_FALSEP, EXACTLY_TRUEP): Delete macros.
	(DEFAULT_FALSE, RETURN_FALSE, RETURN_UNSPECIFIED): New macros.
	(ASSERT, ASSERT_STRING): New macros.
	(SYSCALL): Rename macro from `SCM_SYSCALL'.
	(ROZT_X): Use `gh_str2scm'.
	(SMOBDATA, PCHAIN, ERROR): New macros.
	(MEMORY_ERROR, SYSTEM_ERROR, WBPORT): New macros.
	(xc_unbox): Use `SMOBDATA'.
	(ASSERT_CONNECTION): Use `ASSERT'.
	(CONN_CONN): New macro.
	(xc_name): New static char array (string).
	(xc_display): Rewrite.
	(VALIDATE_CONNECTION_UNBOX_DBCONN): Use `ASSERT' and `CONN_CONN'.
	(LOB_CONN): Use `CONN_CONN'.
	(LOBPORTP): Use `SCM_NIMP'.
	(lob_mklobport, lob_lo_creat, lob_lo_open, lob_lo_unlink): Update.
	(ASSERT_PORT, LOB_STREAM): New macros.
	(lob_lo_get_connection, lob_lo_get_oid, lob_lo_tell, lob_flush)
	(lob_end_input, lob_seek, lob_lo_seek, lob_fill_input, lob_write)
	(lob_lo_read, lob_close, lob_mark, lob_free, lob_lo_import)
	(lob_lo_export, lob_printpt, res_unbox, res_box): Update.
	(VALIDATE_RESULT_UNBOX): Use `ASSERT'.
	(res_name): New static cahr array (string).
	(res_display): Rewrite.
	(prep_paramspecs): Use `gh_vector_length'; update; call
	`free' unconditionally (without checking if its arg is NULL).
	(pg_protocol_version, pg_conndefaults, notice_processor)
	(pg_connectdb, pg_connection_p, pg_finish, pg_reset)
	(pg_set_client_data, pg_escape_string_conn, pg_escape_bytea_conn)
	(pg_unescape_bytea, pg_exec, pg_exec_params, pg_exec_prepared)
	(pg_result_p, pg_result_error_field, pg_error_message, pg_get_db)
	(pg_get_user, pg_get_pass, pg_get_host, pg_get_port, pg_get_tty)
	(pg_get_options, pg_backend_pid, pg_parameter_status)
	(pg_result_status, pg_ntuples, pg_nfields, pg_cmdtuples)
	(pg_oid_value, pg_fnumber): Update.
	(CHECK_TUPLE_COORDS): New macro.
	(pg_getvalue, pg_getlength, pg_getisnull, pg_binary_tuples)
	(pg_put_copy_end, pg_get_copy_data, pg_getline, pg_getlineasync)
	(pg_putline, pg_endcopy, pg_set_error_verbosity, pg_trace)
	(pg_untrace, sepo_unbox): Update.
	(sepo_name): New static byte array (string).
	(sepo_display): Rewrite.
	(pg_make_print_options, pg_print, pg_set_notice_out_x, pg_notifies)
	(pg_set_client_encoding_x, pg_set_nonblocking_x, pg_is_nonblocking_p)
	(pg_send_query, pg_send_query_params, pg_send_query_prepared)
	(pg_get_result, pg_consume_input, pg_is_busy_p, pg_request_cancel)
	(pg_flush, init_module): Update.

2008-08-15  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Omit port from connection external rep, if host is a socket dir.

	* libpq.c (xc_display): Omit port if host begins with '/'.

2008-08-13  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Make `pg-print' faster: Add fast path for file ports.

	* libpq.c (pg_print): Rework detection for redirect case
	to exclude ports w/ an underlying file descriptor (file ports);
	for those, if the current output-port's has a file descriptor
	and it is the same as stdout's, use that directly, otherwise
	`dup' and `fdopen' the current output-port's file descriptor,
	and `fclose' it afterwards.

2008-08-13  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Assume system provides tmpfile(3).

	* libpq.c [!HAVE_TMPFILE]: Don't #include "tmpfile.h";
	don't #define tmpfile to the locally-provided one.
	* Makefile.am (postgres_la_SOURCES): Remove tmpfile.c.
	* tmpfile.h: Delete file.
	* tmpfile.c: Delete file.

2008-08-13  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Consolidate Guile API specification.

	* bcruft.h: Delete file.
	* fcruft.h: Delete file.
	* gi.h: New file.
	* libpq.c: No longer #include <libguile.h> and <guile/gh.h>.
	Instead, #include "gi.h".
	* Makefile.am (postgres_la_SOURCES):
	Add gi.h; remove bcruft.h and fcruft.h.

2008-08-13  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Add infrastructure to more easily tweak GCC warnings for "make all".

	* Makefile.am (AM_CFLAGS): New var.

2008-08-13  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Tweak C code to eliminate some compiler warnings.

	* libpq.c (lob_write): Remove unnecessary cast from `void *'.
	Also, use `size_t' for vars involved in computing `remaining'.
	(pg_result_error_field): Add `default: ;' to `switch'.
	(init_module): Use `unsigned int' for iteration var.

2008-08-12  Thien-Thi Nguyen  <ttn@gnuvola.org>

	C optimization: Make `pg-lo-read' faster.

	* libpq.c (MAX_NEWSTRING_LENGTH): New macro.
	(lob_lo_read): Rewrite.

2008-08-11  Thien-Thi Nguyen  <ttn@gnuvola.org>

	GCC annotation: Add __attribute__ ((unused)) for some args.

	* libpq.c (UNUSED): New macro.
	(xc_display, lob_input_waiting_p, res_display, sepo_display): Use it.

2008-08-11  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Decruft: Delete degenerate mark functions.

	* libpq.c (res_mark, sepo_mark): Delete funcs.
	(init_module): Don't specify mark funcs for res and sepo smobs.

2008-08-11  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Increase abstraction: Use SCM_{MEMORY,MISC}_ERROR and SCM_SYSERROR.

	* libpq.c (lob_mklobport): Use `SCM_MEMORY_ERROR'.
	(lob_lo_creat, lob_lo_open): Use `SCM_MISC_ERROR'.
	(lob_flush): Use `SCM_SYSERROR'.
	(lob_end_input, lob_seek, lob_fill_input): Use `SCM_MISC_ERROR'.
	(lob_write): Use `SCM_SYSERROR'.
	(prep_paramspecs, pg_connectdb): Use `SCM_MISC_ERROR'.
	(pg_escape_string_conn): Use `SCM_SYSERROR'.
	(pg_set_error_verbosity): Use `SCM_MISC_ERROR'.
	(pg_trace, pg_untrace, pg_print): Use `SCM_SYSERROR'.

2008-08-10  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Drop support for PostgreSQL 7.3.x and earlier.

	* libpq.c: Don't bother w/ INVALIDOID_HEADER.
	Throughout, remove code that does not assume
	HAVE_PQRESULTERRORMESSAGE, HAVE_PQPASS, HAVE_PQBACKENDPID,
	HAVE_PQOIDVALUE, HAVE_PQBINARYTUPLES, HAVE_PQFMOD,
	HAVE_PQPUTNBYTES, HAVE_PQSETNONBLOCKING, HAVE_PQISNONBLOCKING,
	HAVE_PQPROTOCOLVERSION and HAVE_PQFREEMEM, as well as the
	corresponding preprocessor macros (which in some cases makes
	code that does assume those conditions unconditional).
	Remove if-lacking-feature blurb from docstrings.
	(nosupp, noparams) [!HAVE_PQPROTOCOLVERSION]: Delete strings.
	(SORRYNOSUPPORT, SORRYNOPARAMS) [!HAVE_PQPROTOCOLVERSION]: Delete macros.
	(pg_result_error_message, pg_get_pass, pg_backend_pid)
	(pg_oid_value, pg_getvalue, pg_binary_tuples, pg_fmod)
	(pg_putline, pg_set_nonblocking_x, pg_is_nonblocking_p)
	(pg_protocol_version, pg_exec_params, pg_exec_prepared)
	(pg_result_error_field, pg_transaction_status, pg_parameter_status)
	(pg_ftable, pg_ftablecol, pg_fformat, pg_put_copy_data)
	(pg_put_copy_end, pg_get_copy_data, pg_set_error_verbosity)
	(pg_notifies, pg_send_query_params, pg_send_query_prepared)
	(pg_sym_PQRESULTERRORMESSAGE, pg_sym_PQPASS, pg_sym_PQBACKENDPID)
	(pg_sym_PQOIDVALUE, pg_sym_PQBINARYTUPLES, pg_sym_PQFMOD)
	(pg_sym_PQSETNONBLOCKING, pg_sym_PQISNONBLOCKING)
	(pg_sym_PQPROTOCOLVERSION, init_module): Update.

2008-08-10  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Increase abstraction: Define C macros to specify "result format".

	* libpq.c (RESFMT_TEXT, RESFMT_BINARY): New value macros.
	(pg_exec_params, pg_exec_prepared, pg_send_query_params)
	(pg_send_query_prepared): Use `RESFMT_TEXT'.

2008-08-10  Thien-Thi Nguyen  <ttn@gnuvola.org>

	C optimization: Declare smob-predicate funcs inline.

	* libpq.c (xc_p, res_p, sepo_p): Declare `inline'.

2008-08-08  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Support "E-prefixing" for `pgtable-manager' SQL quoting.

	* postgres-table.scm: From module (database postgres),
	also select `pg-result-status'.
	(pgtable-manager): Don't use `sql-quote' directly; instead, init
	at closure-creation time the SQL-quoting procedure that wraps
	`sql-quote' to a variant that does "E-prefixing" if the supported
	by the backend.

2008-08-07  Thien-Thi Nguyen  <ttn@gnuvola.org>

	New (database postgres-resx) proc: object<-result

	* postgres-resx.scm (object<-result): New proc, exported.

2008-08-07  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Hide `compile-outspec' implementation details.

	* postgres-table.scm (compiled-outspec?): New object property.
	(compile-outspec): Replace `(cons compiled-outspec RV)'
	marking with setting of property `compile-outspec?'.
	(compiled-outspec?-extract): Rewrite.

2008-08-07  Thien-Thi Nguyen  <ttn@gnuvola.org>

	For `pgtable-manager', validate INSERT column counts.

	* postgres-table (pgtable-manager check-col-count): New proc.
	(pgtable-manager insert-values): Use `check-col-count'.
	(pgtable-manager insert-col-values): Likewise.

2008-08-07  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Make `pgtable-manager' INSERT commands faster.

	* postgres-table.scm (pgtable-manager):
	compute number of columns and type names once.
	(pgtable-manager serial?): Incorporate intneral proc into unique caller.
	(pgtable-manager qstring<-colname): Likewise.
	(pgtable-manager insert-variant): Delete internal proc.
	(pgtable-manager do-insert): New internal proc.
	(pgtable-manager insert-values): Likewise.
	(pgtable-manager insert-col-values): Likewise.
	(pgtable-manager insert-alist): Likewise.
	(pgtable-manager die!): No longer treat `insert-alist',
	`insert-col-values' and `insert-values' dynamically.

2008-08-06  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Debogify: Make `pgtable-manager' INSERTs no longer strip `serial' cols.

	* postgres-table.scm (pgtable-manager insert-variant clean-defs):
	Delete internal proc; update callers to elide its call.

2008-08-06  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Make `pgtable-manager' faster.

	* postgres-table.scm: From module (ice-9 common-list),
	select also `pick-mappings'.
	(fmt): Incorporate into `pgtable-manager'.
	(symbol->qstring, serial? col-defs, drop-proc, create-proc)
	(->db-insert-string, clean-defs, pre-insert-into, insert-values-proc)
	(insert-col-values-cmd, insert-col-values-proc, insert-alist-proc)
	(delete-rows-proc, update-col-proc, select-proc): Likewise.
	(pgtable-manager): Compute each column name's "qstring" only once.

2008-07-17  Thien-Thi Nguyen  <ttn@gnuvola.org>

	C optimization: Declare unboxing funcs inline.

	* libpq.c (xc_unbox, res_unbox, sepo_unbox): Declare `inline'.

2008-07-17  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Decruft: Remove gc- and init-debugging macros.

	* libpq.c (GC_PRINT, INIT_PRINT): Delete macros
	and surrounding pre-processor conditionals.
	(xc_mark, xc_free): Remove `GC_PRINT' call.
	(res_mark, res_free, sepo_mark, sepo_free): Likewise.
	(init_module): Remove `INIT_PRINT' call.

2008-07-16  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Increase abstraction: Use "cell word 0" for lobport access.

	* libpq.c (LOBPORT_WITH_FLAGS_P): New macro.
	(OPLOBPORTP, OPINLOBPORTP): Use `LOBPORT_WITH_FLAGS_P'.
	(lob_mklobport): Use `SCM_SET_CELL_WORD_0'.

2008-07-16  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Increase abstraction: Make `res_box' handle NULL-check.

	* libpq.c (res_box): If given NULL, return Scheme false.
	(pg_exec, pg_exec_params, pg_exec_prepared, pg_send_query): Update.

2008-07-16  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Decruft: Inline single-use *_box funcs.

	* libpq.c (xc_box, sepo_box): Delete funcs.
	(pg_connectdb): Use `SCM_RETURN_NEWSMOB' directly.
	(pg_make_print_options): Likewise.

2008-07-16  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Increase abstraction: Use C macros for smob data access.

	* libpq.c (xc_unbox): Use `SCM_SMOB_DATA'.
	(res_unbox, sepo_unbox): Likewise.
	(xc_free): Use `SCM_SET_SMOB_DATA'.
	(res_free, sepo_free): Likewise.

2008-07-16  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Decruft: Elide internal function `make_res'.

	* libpq.c (make_res): Delete func;
	convert all callers to use `res_box (result)' instead.

2008-07-16  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Use guile.m4 facilities from Guile 1.4.1.118.

	* Makefile.am (install-data-hook): Use $(mkmodcat).

2008-07-15  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Move Scheme code into src/.

	* postgres-col-defs.scm: Move from ../scm/.
	* postgres-gxrepl.scm: Likewise.
	* postgres-meta.scm: Likewise.
	* postgres-qcons.scm: Likewise.
	* postgres-resdisp.scm: Likewise.
	* postgres-resx.scm: Likewise.
	* postgres-table.scm: Likewise.
	* postgres-types.scm: Likewise.
	* Makefile.am (dotdocfiles): New var.
	(BUILT_SOURCES): Remove libpq.doc; add $(dotdocfiles).
	(dist_d_DATA): New var.
	(.scm.doc): New pattern rule.
	(.doc-index) [MAINTAINER_MODE]: New target.
	(noinst_DATA) [MAINTAINER_MODE]: New var.
	(retired): New variable.
	(install-data-hook): Add check/cleanup for $(retired) files.

2008-07-15  Thien-Thi Nguyen  <ttn@gnuvola.org>

	Move C code into src/.

	* bcruft.h: Move from parent dir.
	* fcruft.h: Likewise.
	* modsup.h.snap: Likewise.
	* tmpfile.h: Likewise.
	* tmpfile.c: Likewise.
	* libpq.c: New file, from integrating ../libpostgres.h,
	../libpostgres.c and ../libpostgres_lo.c.
	* Makefile.am: New file.
