cvs: /php4 NEWS ltconfig ltmain.sh php.ini-dist /php4/ext/odbc php_odbc.c php_odbc.h

From: Date: Tue, 30 Nov 1999 12:42:08 +0000
Subject: cvs: /php4 NEWS ltconfig ltmain.sh php.ini-dist /php4/ext/odbc php_odbc.c php_odbc.h
Groups: php.version4 
Request: Send a blank email to php-version4+get-7092@lists.php.net to get a copy of this message
lurcher Tue Nov 30 07:42:08 1999 EDT Modified files: /php4 NEWS ltconfig ltmain.sh php.ini-dist /php4/ext/odbc php_odbc.c php_odbc.h Log: Added check in the ODBC module that a connection is still valid before reuse in a persistent connection. Index: php4/NEWS diff -u php4/NEWS:1.54 php4/NEWS:1.55 --- php4/NEWS:1.54 Mon Nov 29 21:08:26 1999 +++ php4/NEWS Tue Nov 30 07:41:33 1999 @@ -2,6 +2,8 @@ ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ?? ????, Version 4.0 Beta 4 +- Added check to see if a persistent connection is still valid with the + ODBC interface before reusing (nick@easysoft.com) - Added DBMaker support (patch by Pax Tsai <paxtsai@lion.syscom.com.tw>) - Renamed "PECL" to "PEAR" (PHP Extension and Add-on Repository) (Stig) - buildconf now uses build.mk (Stig) Index: php4/ltconfig diff -u php4/ltconfig:1.6 php4/ltconfig:1.7 --- php4/ltconfig:1.6 Fri Nov 26 09:57:50 1999 +++ php4/ltconfig Tue Nov 30 07:41:33 1999 @@ -1188,8 +1188,8 @@ netbsd*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $compile_rpath $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $compile_rpath $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' # can we support soname and/or expsyms with a.out? -oliva @@ -1210,8 +1210,8 @@ EOF elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $compile_rpath $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $compile_rpath $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi @@ -1226,8 +1226,8 @@ *) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $compile_rpath $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $compile_rpath $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi @@ -1428,9 +1428,9 @@ no_undefined_flag=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD $compile_rpath -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD $compile_rpath -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case "$host_os" in Index: php4/ltmain.sh diff -u php4/ltmain.sh:1.6 php4/ltmain.sh:1.7 --- php4/ltmain.sh:1.6 Fri Nov 26 09:57:50 1999 +++ php4/ltmain.sh Tue Nov 30 07:41:33 1999 @@ -1162,7 +1162,7 @@ *.o | *.obj | *.a | *.lib) # A standard object. - libobjs="$libobjs $arg" + objs="$objs $arg" ;; *.lo) @@ -1796,94 +1796,6 @@ esac fi - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$compile_rpath " in - *" $libdir "*) ;; - *) compile_rpath="$compile_rpath $libdir" ;; - esac - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - # Create the output directory, or remove our outputs if we need to. if test -d $output_objdir; then $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" @@ -2043,7 +1955,6 @@ done done if test -n "$a_deplib" ; then - newdeplibs="$newdeplibs $a_deplib" droppeddeps=yes echo echo "*** Warning: This library needs some functionality provided by $a_deplib." Index: php4/php.ini-dist diff -u php4/php.ini-dist:1.11 php4/php.ini-dist:1.12 --- php4/php.ini-dist:1.11 Tue Nov 9 15:58:43 1999 +++ php4/php.ini-dist Tue Nov 30 07:41:33 1999 @@ -191,6 +191,7 @@ ;uodbc.default_user = Not yet implemented ;uodbc.default_pw = Not yet implemented uodbc.allow_persistent = On ; allow or prevent persistent links +uodbc.check_persistent = On ; check that a connection is still validbefore reuse uodbc.max_persistent = -1 ; maximum number of persistent links. -1 means no limit uodbc.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit uodbc.defaultlrl = 4096 ; Handling of LONG fields. Returns number of bytes to variables, 0 means passthru Index: php4/ext/odbc/php_odbc.c diff -u php4/ext/odbc/php_odbc.c:1.12 php4/ext/odbc/php_odbc.c:1.13 --- php4/ext/odbc/php_odbc.c:1.12 Sun Nov 28 19:45:28 1999 +++ php4/ext/odbc/php_odbc.c Tue Nov 30 07:41:36 1999 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_odbc.c,v 1.12 1999/11/29 00:45:28 ssb Exp $ */ +/* $Id: php_odbc.c,v 1.13 1999/11/30 12:41:36 lurcher Exp $ */ #if COMPILE_DL #include "dl/phpdl.h" @@ -301,6 +301,8 @@ defaultlrl, php_odbc_globals, odbc_globals, display_lrl) STD_PHP_INI_ENTRY_EX("odbc.defaultbinmode", "1", PHP_INI_ALL, OnUpdateInt, defaultbinmode, php_odbc_globals, odbc_globals, display_binmode) + STD_PHP_INI_BOOLEAN("odbc.check_persistent", "1", PHP_INI_SYSTEM, OnUpdateInt, + check_persistent, php_odbc_globals, odbc_globals) PHP_INI_END() #ifdef ZTS @@ -1718,6 +1720,8 @@ * no matter if it is to be persistent or not */ +try_and_get_another_connection: + if (persistent) { list_entry *le; @@ -1755,8 +1759,30 @@ if (le->type != le_pconn) { RETURN_FALSE; } - /* XXX we should ensure that the connection is still available */ + /* + * check to see if the connection is still valid + */ db_conn = (odbc_connection *)le->ptr; + + /* + * check to see if the connection is still in place (lurcher) + */ + if (ODBCG(check_persistent)) { + SQLRETURN ret; + SQLCHAR d_name[ 32 ]; + SQLSMALLINT len; + + ret = SQLGetInfo( db_conn -> hdbc, + SQL_DATA_SOURCE_READ_ONLY, + d_name, sizeof( d_name ), &len ); + + if ( ret != SQL_SUCCESS ) + { + zend_hash_del(plist, hashed_details, hashed_len + 1); SQLDisconnect( db_conn -> hdbc ); + SQLFreeConnect( db_conn -> hdbc ); + goto try_and_get_another_connection; + } + } } ZEND_REGISTER_RESOURCE(return_value, db_conn, le_pconn); } else { /* non persistent */ Index: php4/ext/odbc/php_odbc.h diff -u php4/ext/odbc/php_odbc.h:1.8 php4/ext/odbc/php_odbc.h:1.9 --- php4/ext/odbc/php_odbc.h:1.8 Sun Nov 28 19:45:28 1999 +++ php4/ext/odbc/php_odbc.h Tue Nov 30 07:41:36 1999 @@ -28,7 +28,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_odbc.h,v 1.8 1999/11/29 00:45:28 ssb Exp $ */ +/* $Id: php_odbc.h,v 1.9 1999/11/30 12:41:36 lurcher Exp $ */ #ifndef _PHP_ODBC_H #define _PHP_ODBC_H @@ -241,6 +241,7 @@ char *defUser; char *defPW; long allow_persistent; + long check_persistent; long max_persistent; long max_links; long num_persistent;

« previous php.version4 (#7092) next »