summaryrefslogtreecommitdiff
path: root/ext/pdo_dblib
diff options
context:
space:
mode:
authorFrank M. Kromann <fmk@php.net>2005-01-18 07:17:01 +0000
committerFrank M. Kromann <fmk@php.net>2005-01-18 07:17:01 +0000
commit25917d58859ac54cbe067fe3e5c20de97e25357c (patch)
tree88f9647dc9fbada591e17224715da7fceb2bc96a /ext/pdo_dblib
parent14821bb8cf46e3d21bdfb47163655370720213a6 (diff)
downloadphp-git-25917d58859ac54cbe067fe3e5c20de97e25357c.tar.gz
Make this compile with the generic ntwdblib from Microsoft
Diffstat (limited to 'ext/pdo_dblib')
-rwxr-xr-xext/pdo_dblib/config.w326
-rw-r--r--ext/pdo_dblib/dblib_driver.c9
-rw-r--r--ext/pdo_dblib/dblib_stmt.c2
-rw-r--r--ext/pdo_dblib/pdo_dblib.c4
-rw-r--r--ext/pdo_dblib/php_pdo_dblib_int.h13
5 files changed, 27 insertions, 7 deletions
diff --git a/ext/pdo_dblib/config.w32 b/ext/pdo_dblib/config.w32
index 4528970fb5..2afa731dfd 100755
--- a/ext/pdo_dblib/config.w32
+++ b/ext/pdo_dblib/config.w32
@@ -25,11 +25,11 @@ if (PHP_PDO_DBLIB != "no") {
EXTENSION("pdo_dblib", "pdo_dblib.c dblib_driver.c dblib_stmt.c", null, "",
PDO_DBLIB_FLAVOUR == "freetds" ? "php_pdo_sybase.dll" : "php_pdo_mssql.dll");
if (PDO_DBLIB_FLAVOUR != "freetds") {
- ADD_FLAG("CFLAGS_PDO_DBLIB", "/DDBNTWIN32=1 /DMSSQL" + PDO_DBLIB_FLAVOUR + "0=1 /DMSSQL_VERSION \\\"" + PDO_DBLIB_FLAVOUR + ".0\\\"");
+ ADD_FLAG("CFLAGS_PDO_DBLIB", "/DPHP_DBLIB_IS_MSSQL=1 /DDBNTWIN32=1 /DMSSQL" + PDO_DBLIB_FLAVOUR + "0=1 /DMSSQL_VERSION=\\\"" + PDO_DBLIB_FLAVOUR + ".0\\\"");
AC_DEFINE("PDO_DBLIB_IS_MSSQL", PDO_DBLIB_FLAVOUR, "Have MSSQL support");
- PDO_DBLIB_FLAVOUR = "MSSQL " + PDO_DBLIB_FLAVOUR;
+ PDO_DBLIB_FLAVOUR = "MSSQL_" + PDO_DBLIB_FLAVOUR;
}
- ADD_FLAG('CFLAGS_PDO_DBLIB', "/I ..\\pecl /D PDO_DBLIB_FLAVOUR=\\\"" + PDO_DBLIB_FLAVOUR + "\\\"");
+ ADD_FLAG('CFLAGS_PDO_DBLIB', "/I pecl /I ..\\pecl /D PDO_DBLIB_FLAVOUR=\\\"" + PDO_DBLIB_FLAVOUR + "\\\"");
}
ADD_EXTENSION_DEP('pdo_dblib', 'pdo');
}
diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c
index 2bb40ce88f..9f3c828eb6 100644
--- a/ext/pdo_dblib/dblib_driver.c
+++ b/ext/pdo_dblib/dblib_driver.c
@@ -205,11 +205,20 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
if (dbh->password) {
DBSETLPWD(H->login, dbh->password);
}
+
+#if !PHP_DBLIB_IS_MSSQL
if (vars[0].optval) {
DBSETLCHARSET(H->login, vars[0].optval);
}
+#endif
+
DBSETLAPP(H->login, vars[1].optval);
+#if PHP_DBLIB_IS_MSSQL
+ dbprocerrhandle(H->login, (EHANDLEFUNC) error_handler);
+ dbprocmsghandle(H->login, (MHANDLEFUNC) msg_handler);
+#endif
+
H->link = dbopen(H->login, vars[2].optval);
if (H->link == NULL) {
diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c
index 22e0d6628d..72d9170648 100644
--- a/ext/pdo_dblib/dblib_stmt.c
+++ b/ext/pdo_dblib/dblib_stmt.c
@@ -148,7 +148,7 @@ static int pdo_dblib_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC)
break;
default:
- if (dbwillconvert(S->cols[i].coltype, SYBCHAR)) {
+ if (dbwillconvert(S->cols[i].coltype, SQLCHAR)) {
val->len = 32 + (2 * dbdatlen(H->link, i+1));
val->data = emalloc(val->len);
diff --git a/ext/pdo_dblib/pdo_dblib.c b/ext/pdo_dblib/pdo_dblib.c
index e89c30b9bf..d6623420db 100644
--- a/ext/pdo_dblib/pdo_dblib.c
+++ b/ext/pdo_dblib/pdo_dblib.c
@@ -59,7 +59,7 @@ zend_module_entry pdo_dblib_module_entry = {
ZEND_GET_MODULE(pdo_dblib)
#endif
-static int error_handler(DBPROCESS *dbproc, int severity, int dberr,
+int error_handler(DBPROCESS *dbproc, int severity, int dberr,
int oserr, char *dberrstr, char *oserrstr)
{
pdo_dblib_err *einfo;
@@ -98,7 +98,7 @@ static int error_handler(DBPROCESS *dbproc, int severity, int dberr,
return INT_CANCEL;
}
-static int msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate,
+int msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate,
int severity, char *msgtext, char *srvname, char *procname, DBUSMALLINT line)
{
pdo_dblib_err *einfo;
diff --git a/ext/pdo_dblib/php_pdo_dblib_int.h b/ext/pdo_dblib/php_pdo_dblib_int.h
index 64e86b1fbe..f9b729962c 100644
--- a/ext/pdo_dblib/php_pdo_dblib_int.h
+++ b/ext/pdo_dblib/php_pdo_dblib_int.h
@@ -30,7 +30,12 @@
# define DBMSGHANDLE(a, b) dbprocmsghandle(a, b)
# define EHANDLEFUNC DBERRHANDLE_PROC
# define MHANDLEFUNC DBMSGHANDLE_PROC
-# define DBSETOPT(a, b, b) dbsetopt(a, b, c)
+# define DBSETOPT(a, b, c) dbsetopt(a, b, c)
+# define SYBESMSG SQLESMSG
+# define SYBESEOF SQLESEOF
+# define SYBEFCON SQLECONN // SQLEFCON does not exist in MS SQL Server.
+# define SYBEMEM SQLEMEM
+# define SYBEPWD SQLEPWD
#else
# include <sybfront.h>
@@ -78,6 +83,12 @@ typedef unsigned char *LPBYTE;
typedef float DBFLT4;
#endif
+int error_handler(DBPROCESS *dbproc, int severity, int dberr,
+ int oserr, char *dberrstr, char *oserrstr);
+
+int msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate,
+ int severity, char *msgtext, char *srvname, char *procname, DBUSMALLINT line);
+
extern pdo_driver_t pdo_dblib_driver;
extern struct pdo_stmt_methods dblib_stmt_methods;