README update

Raise error for bogus installation path for --with-pgsql
Added check for pg_escape_*
This commit is contained in:
Yasuo Ohgaki 2001-12-16 15:36:33 +00:00
parent e2a5cf3fcb
commit 13dbb1553c
2 changed files with 126 additions and 29 deletions

View File

@ -1,9 +1,25 @@
==== About This Module ===
PostgreSQL module provides access to PostgreSQL server from
PHP script. This module uses PostgreSQL C client lib called libpq.
It is important that you use libpq that is later than backend
(PostgreSQL Server) version. Otherwise, you may experience
strange problems.
Please send e-mail to yohgaki@php.net if you have comments for
pgsql module. I appreciate your feedback.
==== Note For PostgreSQL 7.2 beta ====
Current CVS version (probably 4.0.6 or later) compiles without
modefication.
==== API Change ===
Older PHP than 4.2.0, pg_loimport()/pg_loexport() connection
parameter as last parameter, not like other functions. From 4.2.0,
connection parameter became 1st parameter. Old syntax is preserved,
but it will raise NOTICE error message.
pg_connect()/pg_pconnect() has obsolete multi parameter syntax.
This will be deleted in 4.3.0 or later.
Omitting connectin parameter is NOT recommended. Connection
parameter may be required for future PHP version. Specify connection
always if you don't want to rewrite code when it is changed.
==== Function Name Change ====
Function names are going to be changed to confirm coding
@ -11,8 +27,8 @@ standard. MySQL module has been done this already. Function names will
be changed as follows.
pg_errormessage -> pg_error_message
pg_cmdtuples -> pg_affected_rows
pg_fieldnum -> pg_field_num
pg_cmdtuples -> pg_affected_rows
pg_fieldnum -> pg_field_num
and so on. Except pg_cmdtuples, under scores '_' will be added to
names.
@ -21,14 +37,23 @@ compatibility.
Manual will be updated when this change is commited to CVS source.
==== TODO ===
Add pg_result_error_message() to get error messages associated with
result resource.
Add pg_lotell(), pg_lolseek().
Add pg_escape(). This function requires PostgreSQL 7.2 or later.
Add pg_copy_to() and pg_copy_from() for easier use of copy command.
==== Configure Option Notes ====
You cannot specify PostgreSQL source directly to build PostgreSQL
module with specific version. You need to install PostgreSQL
somewhere in your system to build PHP with PostgreSQL support.
==== Note For PostgreSQL 7.2 beta ====
Current CVS version (probably 4.0.6 or later) compiles without
modefication.
==== TODO List ===
pg_convert_array() - convert array elements for SQL statement.
Support async connection create.
==== Experimental Functions =====
WARNING: API/behavior may be changed without notice.
==== Experimental Async Functions =====
Async query can improve application performance
*significantly*. Please test and report any failure to
yohgaki@php.net
@ -96,3 +121,52 @@ connection parameter. It's useful for error recovery.
--------------------------------------------------------------------
Copy functions
--------------------------------------------------------------------
mixed pg_copy_to(int connection_id, string table_name,
[, string delim [, string null_as]])
nt pg_copy_from(int connection_id, string table_name, array rows
[, string delim [, string null_as]])
--------------------------------------------------------------------
Utility functions
--------------------------------------------------------------------
string pg_escape_string(string data)
Escape string or binary for SQL statemen (7.2 or later)
string pg_escape_bytea(string data)
Escape string or binary for SQL statement (7.2 or later)
--------------------------------------------------------------------
Large Object Functions
--------------------------------------------------------------------
int pg_lo_tell(resource large_object)
Returns current position of large object
--------------------------------------------------------------------
bool pg_lo_lseek(resource large_object, int offset[, int whence])
Seeks position of large object
--------------------------------------------------------------------
Notice messge function
--------------------------------------------------------------------
string pg_last_notice(resource connection)
Returns the last notice set by the backend
Currently pg_last_notice() does not return notice message associated
with the connection.
--------------------------------------------------------------------
Again, experimental functions are subject to be changed without
notice.

View File

@ -2,45 +2,68 @@ dnl
dnl $Id$
dnl
AC_DEFUN(PGSQL_INC_CHK,[if test -r $i$1/libpq-fe.h; then PGSQL_DIR=$i; PGSQL_INCDIR=$i$1])
AC_DEFUN(PHP_PGSQL_CHECK_FUNCTIONS,[
])
PHP_ARG_WITH(pgsql,for PostgreSQL support,
[ --with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQL
base install directory, defaults to /usr/local/pgsql.])
if test "$PHP_PGSQL" != "no"; then
PHP_EXPAND_PATH($PHP_PGSQL, PHP_PGSQL)
for i in /usr /usr/local /usr/local/pgsql $PHP_PGSQL; do
PGSQL_INC_CHK(/include)
el[]PGSQL_INC_CHK(/include/pgsql)
el[]PGSQL_INC_CHK(/include/postgresql)
fi
done
PHP_EXPAND_PATH($PGSQL_INCLUDE, PGSQL_INCLUDE)
if test "$PHP_PGSQL" = "yes"; then
PGSQL_SEARCH_PATHS="/usr /usr/local /usr/local/pgsql"
else
PGSQL_SEARCH_PATHS=$PHP_PGSQL
fi
if test -z "$PGSQL_DIR"; then
AC_MSG_ERROR(Cannot find libpq-fe.h. Please specify the installation path of PostgreSQL)
for i in $PGSQL_SEARCH_PATHS; do
for j in include include/pgsql include/postgres include/postgresql src/include/libpq ""; do
if test -r "$i/$j/libpq-fe.h"; then
PGSQL_INC_BASE=$i
PGSQL_INCLUDE=$i/$j
fi
done
for j in lib lib/pgsql lib/postgres lib/postgresql src/interfaces/libpq ""; do
if test -f "$i/$j/libpq.so"; then
PGSQL_LIBDIR=$i/$j
fi
done
done
if test -z "$PGSQL_INCLUDE"; then
AC_MSG_ERROR(Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path)
fi
PGSQL_INCLUDE=-I$PGSQL_INCDIR
PGSQL_LIBDIR=$PGSQL_DIR/lib
test -d $PGSQL_DIR/lib/pgsql && PGSQL_LIBDIR=$PGSQL_DIR/lib/pgsql
if test -z "$PGSQL_LIBDIR"; then
AC_MSG_ERROR(Cannot find libpq.so. Please specify correct PostgreSQL installation path)
fi
if test -z "$PGSQL_INCLUDE" -a -z "$PGSQL_LIBDIR" ; then
AC_MSG_ERROR([Unable to find libpq anywhere under $withval])
fi
AC_DEFINE(HAVE_PGSQL,1,[ ])
old_LIBS=$LIBS
old_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -L$PGSQL_LIBDIR"
AC_CHECK_LIB(pq, PQescapeString,AC_DEFINE(HAVE_PQESCAPE,1,[ ]))
AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[ ]))
AC_CHECK_LIB(pq, PQoidValue,AC_DEFINE(HAVE_PQOIDVALUE,1,[ ]))
AC_CHECK_LIB(pq, PQclientEncoding,AC_DEFINE(HAVE_PQCLIENTENCODING,1,[ ]))
AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[ ]))
LIBS=$old_LIBS
LDFLAGS=$old_LDFLAGS
AC_DEFINE(HAVE_PGSQL,1,[ ])
PHP_ADD_LIBRARY_WITH_PATH(pq, $PGSQL_LIBDIR, PGSQL_SHARED_LIBADD)
PHP_EXTENSION(pgsql,$ext_shared)
PHP_SUBST(PGSQL_SHARED_LIBADD)
PGSQL_INCLUDE=-I$PGSQL_INCLUDE
PHP_SUBST(PGSQL_INCLUDE)
PHP_EXTENSION(pgsql,$ext_shared)
fi