Skip to content

Commit cebe50a

Browse files
authored
Remove driver specific support from ODBC (php#15727)
* Purge most special cases for building ODBC with specific drivers PDO_ODBC doesn't do this, and most of these drivers are not in use with PHP, at least like this. Chances are these expose an ODBC driver you can use with a normal driver manager like unixODBC or iODBC. If not, it can be specified as a custom driver, though it does not include any workarounds. There might be some redundant definitions now as a result. IBM Db2 is kept as a special case due to it also being in PDO_ODBC, though I wonder how good of an idea this is. See phpGH-15630 * Remove never used include This would only be used on 68k classic Mac OS. Did PHP ever run there? * Fold HAVE_SQL_EXTENDED_FETCH All supported driver managers can do extended fetches. * Ope, accidentally deleted this in a refactor * All driver managers support SQLDataSources now too So we don't need the define? * Remove undef CHAR There's no justification behind as to why this should be. * Don't special case SQL_TIMESTAMP The default handling for turning into SQL_C_CHAR is fine, and the special case for Adabas is no longer needed. * Assume fetch_hash is always possible The driver managers and even Db2 support this. This would also allow simplifying the fetch code to merge fetch_into and fetch_array into a single implementation perhaps. * Update UPGRADING for driver specific removal * Update NEWS for driver specific removal
1 parent 156c847 commit cebe50a

File tree

9 files changed

+22
-597
lines changed

9 files changed

+22
-597
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ PHP NEWS
3939
. Fixed bug GH-11952 (Fix locale strings canonicalization for IntlDateFormatter
4040
and NumberFormatter). (alexandre-daubois)
4141

42+
- ODBC:
43+
. Removed driver-specific build flags and support. (Calvin Buckley)
44+
4245
- Opcache:
4346
. Fixed bug GH-19486 (Incorrect opline after deoptimization). (Arnaud)
4447
. Fixed bug GH-19601 (Wrong JIT stack setup on aarch64/clang). (Arnaud)

UPGRADING

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ PHP 8.5 UPGRADE NOTES
9191
- ODBC:
9292
. ODBC now assumes that at least ODBC 3.5 functionality is available. The
9393
ODBCVER definition and build system flags to control it have been removed.
94+
. ODBC no longer has build flags to build against specific drivers (except
95+
for DB2) and removes special cases for those drivers. It is strongly
96+
recommended to use a driver manager like iODBC or unixODBC on non-Windows.
9497

9598
- Opcache:
9699
. The Opcache extension is now always built into the PHP binary and is always

ext/odbc/config.m4

Lines changed: 1 addition & 294 deletions
Original file line numberDiff line numberDiff line change
@@ -7,172 +7,10 @@ AC_DEFUN([PHP_ODBC_CHECK_HEADER],
77
[AS_IF([test ! -f "$ODBC_INCDIR/$1"],
88
[AC_MSG_ERROR([ODBC header file '$ODBC_INCDIR/$1' not found!])])])
99

10-
dnl
11-
dnl PHP_ODBC_FIND_SOLID_LIBS(libdir)
12-
dnl
13-
dnl Figure out which library file to link with for the Solid support.
14-
dnl
15-
AC_DEFUN([PHP_ODBC_FIND_SOLID_LIBS],[
16-
AC_MSG_CHECKING([Solid library file])
17-
ac_solid_uname_r=$(uname -r 2>/dev/null)
18-
ac_solid_uname_s=$(uname -s 2>/dev/null)
19-
case $ac_solid_uname_s in
20-
AIX) ac_solid_os=a3x;; # a4x for AIX4/ Solid 2.3/3.0 only
21-
HP-UX) ac_solid_os=h9x;; # h1x for hpux11, h0x for hpux10
22-
Linux)
23-
if ldd -v /bin/sh | grep GLIBC > /dev/null; then
24-
ac_solid_os=l2x
25-
else
26-
ac_solid_os=lux
27-
fi
28-
AC_DEFINE([SS_LINUX], [1],
29-
[Define to 1 to be able to use the obsolete <sqlunix.h> header file on
30-
some Linux systems.])
31-
;;
32-
SunOS)
33-
ac_solid_os=ssx;; # should we deal with SunOS 4?
34-
FreeBSD)
35-
if test $(expr $ac_solid_uname_r : '\(.\)') -gt "2"; then
36-
ac_solid_os=fex
37-
else
38-
ac_solid_os=fbx
39-
fi
40-
AC_DEFINE([SS_FBX], [1],
41-
[Define to 1 to be able to use the wchar defs in the obsolete
42-
<sqlunix.h> header file on some FreeBSD systems.])
43-
;;
44-
esac
45-
46-
if test -f $1/soc${ac_solid_os}35.a; then
47-
ac_solid_version=35
48-
ac_solid_prefix=soc
49-
elif test -f $1/scl${ac_solid_os}30.a; then
50-
ac_solid_version=30
51-
ac_solid_prefix=scl
52-
elif test -f $1/scl${ac_solid_os}23.a; then
53-
ac_solid_version=23
54-
ac_solid_prefix=scl
55-
fi
56-
57-
dnl Check for the library files, and setup the ODBC_LIBS path.
58-
if test ! -f $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.so && \
59-
test ! -f $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.a; then
60-
dnl we have an error and should bail out, as we can't find the libs!
61-
echo ""
62-
echo "*********************************************************************"
63-
echo "* Unable to locate $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.so or $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.a"
64-
echo "* Please correct this by creating the following links and reconfiguring:"
65-
echo "* $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.a -> $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.a"
66-
echo "* $1/${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.so -> $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.so"
67-
echo "*********************************************************************"
68-
else
69-
ODBC_LFLAGS=-L$1
70-
ODBC_LIBS=-l${ac_solid_prefix}${ac_solid_os}${ac_solid_version}
71-
fi
72-
73-
AC_MSG_RESULT([$(echo $ODBC_LIBS | $SED -e 's!.*/!!')])
74-
])
75-
76-
dnl
77-
dnl PHP_ODBC_FIND_EMPRESS_LIBS(libdir)
78-
dnl
79-
dnl Figure out which library file to link with for the Empress support.
80-
dnl
81-
AC_DEFUN([PHP_ODBC_FIND_EMPRESS_LIBS],[
82-
AC_MSG_CHECKING([Empress library file])
83-
ODBC_LIBS=$(echo $1/libempodbccl.so | cut -d' ' -f1)
84-
if test ! -f $ODBC_LIBS; then
85-
ODBC_LIBS=$(echo $1/libempodbccl.so | cut -d' ' -f1)
86-
fi
87-
AC_MSG_RESULT([$(echo $ODBC_LIBS | $SED -e 's!.*/!!')])
88-
])
89-
90-
dnl
91-
dnl PHP_ODBC_FIND_EMPRESS_BCS_LIBS(libdir)
92-
dnl
93-
dnl Figure out which library file to link with for the Empress local access
94-
dnl support.
95-
dnl
96-
AC_DEFUN([PHP_ODBC_FIND_EMPRESS_BCS_LIBS],[
97-
AC_MSG_CHECKING([Empress local access library file])
98-
ODBCBCS_LIBS=$(echo $1/libempodbcbcs.a | cut -d' ' -f1)
99-
if test ! -f $ODBCBCS_LIBS; then
100-
ODBCBCS_LIBS=$(echo $1/libempodbcbcs.a | cut -d' ' -f1)
101-
fi
102-
AC_MSG_RESULT([$(echo $ODBCBCS_LIBS | $SED -e 's!.*/!!')])
103-
])
104-
10510
dnl
10611
dnl configure options
10712
dnl
10813

109-
AS_VAR_IF([ODBC_TYPE],, [
110-
PHP_ARG_WITH([adabas],
111-
[for Adabas support],
112-
[AS_HELP_STRING([[--with-adabas[=DIR]]],
113-
[Include Adabas D support [/usr/local]])])
114-
115-
AS_VAR_IF([PHP_ADABAS], [no], [], [
116-
AS_VAR_IF([PHP_ADABAS], [yes], [PHP_ADABAS=/usr/local])
117-
PHP_ADD_INCLUDE([$PHP_ADABAS/incl])
118-
PHP_ADD_LIBPATH([$PHP_ADABAS/$PHP_LIBDIR])
119-
ODBC_OBJS="$PHP_ADABAS/$PHP_LIBDIR/odbclib.a"
120-
ODBC_LIB="$abs_builddir/ext/odbc/libodbc_adabas.a"
121-
$srcdir/build/shtool mkdir -f -p ext/odbc
122-
rm -f "$ODBC_LIB"
123-
cp "$ODBC_OBJS" "$ODBC_LIB"
124-
PHP_ADD_LIBRARY([sqlptc])
125-
PHP_ADD_LIBRARY([sqlrte])
126-
PHP_ADD_LIBRARY_WITH_PATH([odbc_adabas], [$abs_builddir/ext/odbc])
127-
ODBC_TYPE=adabas
128-
ODBC_INCDIR=$PHP_ADABAS/incl
129-
PHP_ODBC_CHECK_HEADER([sqlext.h])
130-
AC_DEFINE([HAVE_ADABAS], [1],
131-
[Define to 1 if the odbc extension uses the Adabas D.])
132-
])
133-
])
134-
135-
AS_VAR_IF([ODBC_TYPE],, [
136-
PHP_ARG_WITH([sapdb],
137-
[for SAP DB support],
138-
[AS_HELP_STRING([[--with-sapdb[=DIR]]],
139-
[Include SAP DB support [/usr/local]])])
140-
141-
AS_VAR_IF([PHP_SAPDB], [no], [], [
142-
AS_VAR_IF([PHP_SAPDB], [yes], [PHP_SAPDB=/usr/local])
143-
PHP_ADD_INCLUDE([$PHP_SAPDB/incl])
144-
PHP_ADD_LIBPATH([$PHP_SAPDB/$PHP_LIBDIR])
145-
PHP_ADD_LIBRARY([sqlod])
146-
ODBC_TYPE=sapdb
147-
AC_DEFINE([HAVE_SAPDB], [1],
148-
[Define to 1 if the odbc extension uses the SAP DB.])
149-
])
150-
])
151-
152-
AS_VAR_IF([ODBC_TYPE],, [
153-
PHP_ARG_WITH([solid],
154-
[for Solid support],
155-
[AS_HELP_STRING([[--with-solid[=DIR]]],
156-
[Include Solid support [/usr/local/solid]])])
157-
158-
AS_VAR_IF([PHP_SOLID], [no], [], [
159-
AS_VAR_IF([PHP_SOLID], [yes], [PHP_SOLID=/usr/local/solid])
160-
ODBC_INCDIR=$PHP_SOLID/include
161-
ODBC_LIBDIR=$PHP_SOLID/$PHP_LIBDIR
162-
ODBC_CFLAGS=-I$ODBC_INCDIR
163-
ODBC_TYPE=solid
164-
if test -f $ODBC_LIBDIR/soc*35.a; then
165-
AC_DEFINE([HAVE_SOLID_35], [1], [Define to 1 if Solid DB 3.5 is used.])
166-
elif test -f $ODBC_LIBDIR/scl*30.a; then
167-
AC_DEFINE([HAVE_SOLID_30], [1], [Define to 1 if Solid DB 3.0 is used.])
168-
elif test -f $ODBC_LIBDIR/scl*23.a; then
169-
AC_DEFINE([HAVE_SOLID], [1],
170-
[Define to 1 if the odbc extension uses the Solid DB.])
171-
fi
172-
PHP_ODBC_FIND_SOLID_LIBS([$ODBC_LIBDIR])
173-
])
174-
])
175-
17614
AS_VAR_IF([ODBC_TYPE],, [
17715
PHP_ARG_WITH([ibm-db2],
17816
[for IBM DB2 support],
@@ -210,70 +48,6 @@ PHP configure:
21048
])
21149
])
21250

213-
AS_VAR_IF([ODBC_TYPE],, [
214-
PHP_ARG_WITH([empress],
215-
[for Empress support],
216-
[AS_HELP_STRING([[--with-empress[=DIR]]],
217-
[Include Empress support $EMPRESSPATH (Empress Version >= 8.60
218-
required)])])
219-
220-
AS_VAR_IF([PHP_EMPRESS], [no], [], [
221-
AS_VAR_IF([PHP_EMPRESS], [yes], [
222-
ODBC_INCDIR=$EMPRESSPATH/include/odbc
223-
ODBC_LIBDIR=$EMPRESSPATH/shlib
224-
], [
225-
ODBC_INCDIR=$PHP_EMPRESS/include/odbc
226-
ODBC_LIBDIR=$PHP_EMPRESS/shlib
227-
])
228-
ODBC_CFLAGS=-I$ODBC_INCDIR
229-
ODBC_LFLAGS=-L$ODBC_LIBDIR
230-
ODBC_TYPE=empress
231-
AC_DEFINE([HAVE_EMPRESS], [1],
232-
[Define to 1 if the odbc extension uses the Empress.])
233-
PHP_ODBC_FIND_EMPRESS_LIBS([$ODBC_LIBDIR])
234-
])
235-
])
236-
237-
AS_VAR_IF([ODBC_TYPE],, [
238-
PHP_ARG_WITH([empress-bcs],
239-
[for Empress local access support],
240-
[AS_HELP_STRING([[--with-empress-bcs[=DIR]]],
241-
[Include Empress Local Access support $EMPRESSPATH (Empress Version >=
242-
8.60 required)])])
243-
244-
AS_VAR_IF([PHP_EMPRESS_BCS], [no], [], [
245-
AS_VAR_IF([PHP_EMPRESS_BCS], [yes], [
246-
ODBC_INCDIR=$EMPRESSPATH/include/odbc
247-
ODBC_LIBDIR=$EMPRESSPATH/shlib
248-
], [
249-
ODBC_INCDIR=$PHP_EMPRESS_BCS/include/odbc
250-
ODBC_LIBDIR=$PHP_EMPRESS_BCS/shlib
251-
])
252-
CC="empocc -bcs";export CC;
253-
LD="empocc -bcs";export LD;
254-
ODBC_CFLAGS=-I$ODBC_INCDIR
255-
ODBC_LFLAGS=-L$ODBC_LIBDIR
256-
LIST=$(empocc -listlines -bcs -o a a.c)
257-
258-
NEWLIST=
259-
for I in $LIST
260-
do
261-
case $I in
262-
$EMPRESSPATH/odbccl/lib/* | \
263-
$EMPRESSPATH/rdbms/lib/* | \
264-
$EMPRESSPATH/common/lib/*)
265-
NEWLIST="$NEWLIST $I"
266-
;;
267-
esac
268-
done
269-
ODBC_LIBS="-lempphpbcs -lms -lmscfg -lbasic -lbasic_os -lnlscstab -lnlsmsgtab -lm -ldl -lcrypt"
270-
ODBC_TYPE=empress-bcs
271-
AC_DEFINE([HAVE_EMPRESS], [1],
272-
[Define to 1 if the odbc extension uses the Empress.])
273-
PHP_ODBC_FIND_EMPRESS_BCS_LIBS([$ODBC_LIBDIR])
274-
])
275-
])
276-
27751
AS_VAR_IF([ODBC_TYPE],, [
27852
PHP_ARG_WITH([custom-odbc],
27953
[for a custom ODBC support],
@@ -313,25 +87,6 @@ PHP_ARG_WITH([iodbc],
31387
])
31488
])
31589

316-
AS_VAR_IF([ODBC_TYPE],, [
317-
PHP_ARG_WITH([esoob],
318-
[for Easysoft ODBC-ODBC Bridge support],
319-
[AS_HELP_STRING([[--with-esoob[=DIR]]],
320-
[Include Easysoft OOB support [/usr/local/easysoft/oob/client]])])
321-
322-
AS_VAR_IF([PHP_ESOOB], [no], [], [
323-
AS_VAR_IF([PHP_ESOOB], [yes], [PHP_ESOOB=/usr/local/easysoft/oob/client])
324-
ODBC_INCDIR=$PHP_ESOOB/include
325-
ODBC_LIBDIR=$PHP_ESOOB/$PHP_LIBDIR
326-
ODBC_LFLAGS=-L$ODBC_LIBDIR
327-
ODBC_CFLAGS=-I$ODBC_INCDIR
328-
ODBC_LIBS=-lesoobclient
329-
ODBC_TYPE=esoob
330-
AC_DEFINE([HAVE_ESOOB], [1],
331-
[Define to 1 if the odbc extension uses the Easysoft OOB.])
332-
])
333-
])
334-
33590
AS_VAR_IF([ODBC_TYPE],, [
33691
PHP_ARG_WITH([unixODBC],
33792
[whether to build with unixODBC support],
@@ -360,58 +115,10 @@ PHP_ARG_WITH([unixODBC],
360115
])
361116
])
362117

363-
AS_VAR_IF([ODBC_TYPE],, [
364-
PHP_ARG_WITH([dbmaker],
365-
[for DBMaker support],
366-
[AS_HELP_STRING([[--with-dbmaker[=DIR]]],
367-
[Include DBMaker support])])
368-
369-
AS_VAR_IF([PHP_DBMAKER], [no], [], [
370-
AS_VAR_IF([PHP_DBMAKER], [yes], [
371-
dnl Find dbmaker home directory
372-
DBMAKER_HOME=$(grep "^dbmaker:" /etc/passwd | $AWK -F: '{print $6}')
373-
374-
dnl check DBMaker version (from 5.0 to 2.0)
375-
DBMAKER_VERSION=5.0
376-
377-
while test ! -d $DBMAKER_HOME/$DBMAKER_VERSION && test "$DBMAKER_VERSION" != "2.9"; do
378-
DM_VER=$(echo $DBMAKER_VERSION | $SED -e 's/\.//' | $AWK '{ print $1-1;}')
379-
MAJOR_V=$(echo $DM_VER | $AWK '{ print $1/10; }' | $AWK -F. '{ print $1; }')
380-
MINOR_V=$(echo $DM_VER | $AWK '{ print $1%10; }')
381-
DBMAKER_VERSION=$MAJOR_V.$MINOR_V
382-
done
383-
384-
AS_VAR_IF([DBMAKER_VERSION], [2.9],
385-
[PHP_DBMAKER=$DBMAKER_HOME],
386-
[PHP_DBMAKER=$DBMAKER_HOME/$DBMAKER_VERSION])
387-
])
388-
389-
ODBC_INCDIR=$PHP_DBMAKER/include
390-
ODBC_LIBDIR=$PHP_DBMAKER/$PHP_LIBDIR
391-
ODBC_CFLAGS=-I$ODBC_INCDIR
392-
ODBC_LFLAGS=-L$ODBC_LIBDIR
393-
ODBC_LIBS="-ldmapic -lc"
394-
ODBC_TYPE=dbmaker
395-
396-
AC_DEFINE([HAVE_DBMAKER], [1],
397-
[Define to 1 if the odbc extension uses the DBMaker.])
398-
399-
AS_VAR_IF([ext_shared], [yes], [ODBC_LIBS="-ldmapic -lc -lm"], [
400-
PHP_ADD_LIBRARY_WITH_PATH([dmapic], [$ODBC_LIBDIR])
401-
PHP_ADD_INCLUDE([$ODBC_INCDIR])
402-
])
403-
])
404-
])
405118

406119
dnl Extension setup
407120
if test -n "$ODBC_TYPE"; then
408-
AS_VAR_IF([ODBC_TYPE], [dbmaker],, [
409-
PHP_EVAL_LIBLINE([$ODBC_LFLAGS $ODBC_LIBS], [ODBC_SHARED_LIBADD])
410-
AS_VAR_IF([ODBC_TYPE], [solid],,
411-
[AC_DEFINE([HAVE_SQLDATASOURCES], [1],
412-
[Define to 1 if ODBC library has 'SQLDataSources', as a function or
413-
macro.])])
414-
])
121+
PHP_EVAL_LIBLINE([$ODBC_LFLAGS $ODBC_LIBS], [ODBC_SHARED_LIBADD])
415122

416123
AC_DEFINE([HAVE_UODBC], [1],
417124
[Define to 1 if the PHP extension 'odbc' is available.])

ext/odbc/config.w32

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ if (PHP_ODBC == "yes") {
88
&& CHECK_HEADER_ADD_INCLUDE("sqlext.h", "CFLAGS_ODBC")) {
99
EXTENSION("odbc", "php_odbc.c odbc_utils.c", PHP_ODBC_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
1010
AC_DEFINE("HAVE_UODBC", 1, "Define to 1 if the PHP extension 'odbc' is available.");
11-
AC_DEFINE("HAVE_SQLDATASOURCES", 1, "Define to 1 if ODBC library has 'SQLDataSources', as a function or macro.");
1211
} else {
1312
WARNING("odbc support can't be enabled, libraries or header are missing (SDK)")
1413
PHP_ODBC = "no"

0 commit comments

Comments
 (0)