summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>1999-11-09 14:28:59 +0000
committerStig Bakken <ssb@php.net>1999-11-09 14:28:59 +0000
commitfd056d0c01fffe19203f823425d73de85c9dbe7e (patch)
treed820beacbc9e070ad0d65e09a4c7b9aa216e6152 /ext
parenta4ff16dd6881707edd733beb6eb5ffd4a5984d57 (diff)
downloadphp-git-fd056d0c01fffe19203f823425d73de85c9dbe7e.tar.gz
Clean up ODBC HAVE_XXX symbols, compile fixes for OpenLink and Solid.
#The Solid support still does not link, though (looks like a side-effect of #the way the Solid libs are named and our stubborn friend libtool). #This can wait until after 4.0b3.
Diffstat (limited to 'ext')
-rw-r--r--ext/odbc/config.h.stub22
-rw-r--r--ext/odbc/config.m420
-rw-r--r--ext/odbc/php3_velocis.h2
-rw-r--r--ext/odbc/php_odbc.c36
-rw-r--r--ext/odbc/php_odbc.h28
-rw-r--r--ext/odbc/velocis.c2
6 files changed, 57 insertions, 53 deletions
diff --git a/ext/odbc/config.h.stub b/ext/odbc/config.h.stub
index a339939aa1..e162d9f64b 100644
--- a/ext/odbc/config.h.stub
+++ b/ext/odbc/config.h.stub
@@ -1,11 +1,11 @@
-#define HAVE_SOLID 0
-#define HAVE_IBMDB2 0
-#define HAVE_IODBC 0
-#define HAVE_ESOOB 0
-#define HAVE_UNIXODBC 0
-#define HAVE_OPENLINK 0
-#define HAVE_ADABAS 0
-#define HAVE_CODBC 0
-#define HAVE_UODBC 0
-#define HAVE_EMPRESS 0
-#define HAVE_VELOCIS 0
+#undef HAVE_SOLID
+#undef HAVE_IBMDB2
+#undef HAVE_IODBC
+#undef HAVE_ESOOB
+#undef HAVE_UNIXODBC
+#undef HAVE_OPENLINK
+#undef HAVE_ADABAS
+#undef HAVE_CODBC
+#undef HAVE_UODBC
+#undef HAVE_EMPRESS
+#undef HAVE_VELOCIS
diff --git a/ext/odbc/config.m4 b/ext/odbc/config.m4
index 0ecc2f28a3..ee2a0e443e 100644
--- a/ext/odbc/config.m4
+++ b/ext/odbc/config.m4
@@ -80,7 +80,7 @@ if test -z "$ODBC_TYPE"; then
AC_MSG_CHECKING(for Solid support)
AC_ARG_WITH(solid,
[ --with-solid[=DIR] Include Solid support. DIR is the Solid base
- install directory, defaults to /usr/local/solid],
+ install directory, defaults to /usr/local/solid],
[
if test "$withval" = "yes"; then
withval=/usr/local/solid
@@ -88,13 +88,13 @@ AC_ARG_WITH(solid,
if test "$withval" != "no"; then
ODBC_INCDIR=$withval/include
ODBC_LIBDIR=$withval/lib
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_TYPE=solid
- AC_DEFINE(HAVE_SOLID)
- AC_MSG_RESULT(yes)
- AC_FIND_SOLID_LIBS($ODBC_LIBDIR)
+ ODBC_INCLUDE=-I$ODBC_INCDIR
+ ODBC_TYPE=solid
+ AC_DEFINE(HAVE_SOLID)
+ AC_MSG_RESULT(yes)
+ AC_FIND_SOLID_LIBS($ODBC_LIBDIR)
else
- AC_MSG_RESULT(no)
+ AC_MSG_RESULT(no)
fi
],[
AC_MSG_RESULT(no)
@@ -116,8 +116,8 @@ AC_ARG_WITH(ibm-db2,
ODBC_LIBDIR=$withval/lib
fi
ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_TYPE=db2
- ODBC_LIBS="-ldb2"
+ ODBC_TYPE=db2
+ ODBC_LIBS="-ldb2"
AC_DEFINE(HAVE_IBMDB2)
AC_MSG_RESULT(yes)
@@ -334,7 +334,7 @@ fi
if test -n "$ODBC_TYPE"; then
INCLUDES="$INCLUDES $ODBC_INCLUDE"
EXTRA_LIBS="$EXTRA_LIBS $ODBC_LFLAGS $ODBC_LIBS"
- AC_DEFINE(HAVE_UODBC, 1)
+ AC_DEFINE(HAVE_UODBC)
AC_SUBST(ODBC_INCDIR)
AC_SUBST(ODBC_INCLUDE)
AC_SUBST(ODBC_LIBDIR)
diff --git a/ext/odbc/php3_velocis.h b/ext/odbc/php3_velocis.h
index 2edb1f2528..e2cdde87af 100644
--- a/ext/odbc/php3_velocis.h
+++ b/ext/odbc/php3_velocis.h
@@ -38,7 +38,7 @@
#define HAVE_VELOCIS 1
#endif
-#if HAVE_VELOCIS && !HAVE_UODBC
+#if defined(HAVE_VELOCIS) && !HAVE_UODBC
#define UNIX
#include <sql.h>
#include <sqlext.h>
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index 64ed24d343..c24c47e084 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -147,7 +147,7 @@ static void _free_odbc_result(odbc_result *res)
res->values = NULL;
}
if (res->stmt) {
-#if HAVE_SOLID
+#ifdef HAVE_SOLID
SQLTransact(res->conn_ptr->henv, res->conn_ptr->hdbc,
(UWORD)SQL_COMMIT);
#endif
@@ -536,7 +536,7 @@ int odbc_bindcols(odbc_result *result)
result->values[i].value = NULL;
break;
-#if HAVE_ADABAS
+#ifdef HAVE_ADABAS
case SQL_TIMESTAMP:
result->values[i].value = (char *)emalloc(27);
SQLBindCol(result->stmt, (UWORD)(i+1), SQL_C_CHAR, result->values[i].value,
@@ -913,7 +913,7 @@ PHP_FUNCTION(odbc_exec)
odbc_result *result = NULL;
odbc_connection *conn;
RETCODE rc;
-#if HAVE_SQL_EXTENDED_FETCH
+#ifdef HAVE_SQL_EXTENDED_FETCH
UDWORD scrollopts;
#endif
@@ -951,7 +951,7 @@ PHP_FUNCTION(odbc_exec)
RETURN_FALSE;
}
-#if HAVE_SQL_EXTENDED_FETCH
+#ifdef HAVE_SQL_EXTENDED_FETCH
/* Solid doesn't have ExtendedFetch, if DriverManager is used, get Info,
whether Driver supports ExtendedFetch */
rc = SQLGetInfo(conn->hdbc, SQL_FETCH_DIRECTION, (void *) &scrollopts, sizeof(scrollopts), NULL);
@@ -1010,7 +1010,7 @@ PHP_FUNCTION(odbc_fetch_into)
RETCODE rc;
SWORD sql_c_type;
char *buf = NULL;
-#if HAVE_SQL_EXTENDED_FETCH
+#ifdef HAVE_SQL_EXTENDED_FETCH
UDWORD crow;
UWORD RowStatus[1];
SDWORD rownum = -1;
@@ -1066,7 +1066,7 @@ PHP_FUNCTION(odbc_fetch_into)
}
}
-#if HAVE_SQL_EXTENDED_FETCH
+#ifdef HAVE_SQL_EXTENDED_FETCH
if (result->fetch_abs) {
if (rownum > 0)
rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus);
@@ -1079,7 +1079,7 @@ PHP_FUNCTION(odbc_fetch_into)
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
RETURN_FALSE;
-#if HAVE_SQL_EXTENDED_FETCH
+#ifdef HAVE_SQL_EXTENDED_FETCH
if (rownum > 0 && result->fetch_abs)
result->fetched = rownum;
else
@@ -1145,7 +1145,7 @@ PHP_FUNCTION(odbc_fetch_into)
}
/* }}} */
-#if HAVE_SOLID
+#ifdef HAVE_SOLID
PHP_FUNCTION(solid_fetch_prev)
{
odbc_result *result;
@@ -1181,7 +1181,7 @@ PHP_FUNCTION(odbc_fetch_row)
odbc_result *result;
RETCODE rc;
pval **pv_res, **pv_row;
-#if HAVE_SQL_EXTENDED_FETCH
+#ifdef HAVE_SQL_EXTENDED_FETCH
UDWORD crow;
UWORD RowStatus[1];
#endif
@@ -1204,7 +1204,7 @@ PHP_FUNCTION(odbc_fetch_row)
RETURN_FALSE;
}
-#if HAVE_SQL_EXTENDED_FETCH
+#ifdef HAVE_SQL_EXTENDED_FETCH
if (result->fetch_abs) {
if (numArgs > 1)
rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus);
@@ -1240,7 +1240,7 @@ PHP_FUNCTION(odbc_result)
RETCODE rc;
SDWORD fieldsize;
pval **pv_res, **pv_field;
-#if HAVE_SQL_EXTENDED_FETCH
+#ifdef HAVE_SQL_EXTENDED_FETCH
UDWORD crow;
UWORD RowStatus[1];
#endif
@@ -1289,7 +1289,7 @@ PHP_FUNCTION(odbc_result)
if (result->fetched == 0) {
/* User forgot to call odbc_fetchrow(), let's do it here */
-#if HAVE_SQL_EXTENDED_FETCH
+#ifdef HAVE_SQL_EXTENDED_FETCH
if (result->fetch_abs)
rc = SQLExtendedFetch(result->stmt, SQL_FETCH_NEXT, 1, &crow,RowStatus);
else
@@ -1409,7 +1409,7 @@ PHP_FUNCTION(odbc_result_all)
RETCODE rc;
pval **pv_res, **pv_format;
SWORD sql_c_type;
-#if HAVE_SQL_EXTENDED_FETCH
+#ifdef HAVE_SQL_EXTENDED_FETCH
UDWORD crow;
UWORD RowStatus[1];
#endif
@@ -1429,7 +1429,7 @@ PHP_FUNCTION(odbc_result_all)
php_error(E_WARNING, "No tuples available at this result index");
RETURN_FALSE;
}
-#if HAVE_SQL_EXTENDED_FETCH
+#ifdef HAVE_SQL_EXTENDED_FETCH
if (result->fetch_abs)
rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
else
@@ -1509,7 +1509,7 @@ PHP_FUNCTION(odbc_result_all)
}
php_printf("</tr>\n");
-#if HAVE_SQL_EXTENDED_FETCH
+#ifdef HAVE_SQL_EXTENDED_FETCH
if (result->fetch_abs)
rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
else
@@ -1565,11 +1565,11 @@ int odbc_sqlconnect(odbc_connection **conn, char *db, char *uid, char *pwd, int
SQLAllocEnv(&((*conn)->henv));
SQLAllocConnect((*conn)->henv, &((*conn)->hdbc));
-#if HAVE_SOLID
+#ifdef HAVE_SOLID
SQLSetConnectOption((*conn)->hdbc, SQL_TRANSLATE_OPTION,
SQL_SOLID_XLATOPT_NOCNV);
#endif
-#if HAVE_OPENLINK
+#ifdef HAVE_OPENLINK
{
char dsnbuf[300];
short dsnbuflen;
@@ -1588,7 +1588,7 @@ int odbc_sqlconnect(odbc_connection **conn, char *db, char *uid, char *pwd, int
return FALSE;
}
}
-#if HAVE_EMPRESS
+#ifdef HAVE_EMPRESS
{
int direct = 0;
char dsnbuf[300];
diff --git a/ext/odbc/php_odbc.h b/ext/odbc/php_odbc.h
index f07a263373..1e0c36c323 100644
--- a/ext/odbc/php_odbc.h
+++ b/ext/odbc/php_odbc.h
@@ -45,22 +45,24 @@
/* checking in the same order as in configure.in */
-#if HAVE_SOLID /* Solid Server */
+#ifdef HAVE_SOLID /* Solid Server */
#define ODBC_TYPE "Solid"
#include <cli0core.h>
#include <cli0ext1.h>
-#define HAVE_SQL_EXTENDED_FETCH 0
+#undef HAVE_SQL_EXTENDED_FETCH
PHP_FUNCTION(solid_fetch_prev);
+#define SQLSMALLINT SWORD
+#define SQLUSMALLINT UWORD
-#elif HAVE_EMPRESS /* Empress */
+#elif defined(HAVE_EMPRESS) /* Empress */
#define ODBC_TYPE "Empress"
#include <sql.h>
#include <sqlext.h>
-#define HAVE_SQL_EXTENDED_FETCH 0
+#undef HAVE_SQL_EXTENDED_FETCH
-#elif HAVE_ADABAS /* Adabas D */
+#elif defined(HAVE_ADABAS) /* Adabas D */
#define ODBC_TYPE "Adabas D"
#include <WINDOWS.H>
@@ -68,7 +70,7 @@ PHP_FUNCTION(solid_fetch_prev);
#include <sqlext.h>
#define HAVE_SQL_EXTENDED_FETCH 1
-#elif HAVE_IODBC /* iODBC library */
+#elif defined(HAVE_IODBC) /* iODBC library */
#define ODBC_TYPE "iODBC"
#include <isql.h>
@@ -81,21 +83,21 @@ PHP_FUNCTION(solid_fetch_prev);
#define SQL_LEN_DATA_AT_EXEC_OFFSET (-100)
#define SQL_LEN_DATA_AT_EXEC(length) (-(length)+SQL_LEN_DATA_AT_EXEC_OFFSET)
-#elif HAVE_UNIXODBC /* unixODBC library */
+#elif defined(HAVE_UNIXODBC) /* unixODBC library */
#define ODBC_TYPE "unixODBC"
#include <sql.h>
#include <sqlext.h>
#define HAVE_SQL_EXTENDED_FETCH 1
-#elif HAVE_ESOOB /* Easysoft ODBC-ODBC Bridge library */
+#elif defined(HAVE_ESOOB) /* Easysoft ODBC-ODBC Bridge library */
#define ODBC_TYPE "ESOOB"
#include <sql.h>
#include <sqlext.h>
#define HAVE_SQL_EXTENDED_FETCH 1
-#elif HAVE_OPENLINK /* OpenLink ODBC drivers */
+#elif defined(HAVE_OPENLINK) /* OpenLink ODBC drivers */
#define ODBC_TYPE "Openlink"
#include <iodbc.h>
@@ -103,8 +105,10 @@ PHP_FUNCTION(solid_fetch_prev);
#include <isqlext.h>
#include <udbcext.h>
#define HAVE_SQL_EXTENDED_FETCH 1
+#define SQLSMALLINT SWORD
+#define SQLUSMALLINT UWORD
-#elif HAVE_VELOCIS /* Raima Velocis */
+#elif defined(HAVE_VELOCIS) /* Raima Velocis */
#define ODBC_TYPE "Velocis"
#define UNIX
@@ -112,13 +116,13 @@ PHP_FUNCTION(solid_fetch_prev);
#include <sql.h>
#include <sqlext.h>
-#elif HAVE_CODBC /* Custom ODBC */
+#elif defined(HAVE_CODBC) /* Custom ODBC */
#define ODBC_TYPE "Custom ODBC"
#define HAVE_SQL_EXTENDED_FETCH 1
#include <odbc.h>
-#elif HAVE_IBMDB2 /* DB2 CLI */
+#elif defined(HAVE_IBMDB2) /* DB2 CLI */
#define ODBC_TYPE "IBM DB2 CLI"
#define HAVE_SQL_EXTENDED_FETCH 1
diff --git a/ext/odbc/velocis.c b/ext/odbc/velocis.c
index 0bd999ab31..1d4bc50728 100644
--- a/ext/odbc/velocis.c
+++ b/ext/odbc/velocis.c
@@ -40,7 +40,7 @@
# define THREAD_LS
#endif
-#if HAVE_VELOCIS
+#ifdef HAVE_VELOCIS
#include "php3_velocis.h"
function_entry velocis_functions[] = {