Removed old version 6.5 code. Clinet Libraries for SQL Server 7.0 can be used with version 6,5.

Minor changes to use som Zend macros to define globals.
This commit is contained in:
Frank M. Kromann 2000-11-29 22:06:47 +00:00
parent 5cb6b6c667
commit 20490db03f
3 changed files with 21 additions and 104 deletions

View File

@ -17,8 +17,6 @@ CFG=mssql - Win32 MSSQL 70 Release_TS
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mssql - Win32 MSSQL 65 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "mssql - Win32 MSSQL 65 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "mssql - Win32 MSSQL 70 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "mssql - Win32 MSSQL 70 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
@ -31,61 +29,7 @@ CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "mssql - Win32 MSSQL 65 Release_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "MSSQL_65_Release_TS"
# PROP BASE Intermediate_Dir "MSSQL_65_Release_TS"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "MSSQL_65_Release_TS"
# PROP Intermediate_Dir "MSSQL_65_Release_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D MSSQL65=1 /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSSQL=1 /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x406 /d "NDEBUG"
# ADD RSC /l 0x406 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib ntwdblib.lib /nologo /dll /machine:I38
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mssql65.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\mssql-65\lib" /libpath:"..\..\Release_TS_Inline"
!ELSEIF "$(CFG)" == "mssql - Win32 MSSQL 65 Debug_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "MSSQL_65_Debug_TS"
# PROP BASE Intermediate_Dir "MSSQL_65_Debug_TS"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "MSSQL_65_Debug_TS"
# PROP Intermediate_Dir "MSSQL_65_Debug_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "mssql-70" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /D MSSQL65=1 /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D MSSQL65=1 /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSSQL=1 /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x406 /d "NDEBUG"
# ADD RSC /l 0x406 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib ntwdblib.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_mssql65.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\mssql-65\lib"
!ELSEIF "$(CFG)" == "mssql - Win32 MSSQL 70 Release_TS"
!IF "$(CFG)" == "mssql - Win32 MSSQL 70 Release_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
@ -143,8 +87,6 @@ LINK32=link.exe
# Begin Target
# Name "mssql - Win32 MSSQL 65 Release_TS"
# Name "mssql - Win32 MSSQL 65 Debug_TS"
# Name "mssql - Win32 MSSQL 70 Release_TS"
# Name "mssql - Win32 MSSQL 70 Debug_TS"
# Begin Group "Source Files"

View File

@ -78,7 +78,7 @@ zend_module_entry mssql_module_entry = {
#ifdef ZTS
int mssql_globals_id;
#else
PHP_MSSQL_API php_mssql_globals mssql_globals;
PHP_MSSQL_API zend_mssql_globals mssql_globals;
#endif
#ifdef COMPILE_DL_MSSQL
@ -89,16 +89,16 @@ ZEND_GET_MODULE(mssql)
PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN("mssql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateBool, allow_persistent, php_mssql_globals, mssql_globals)
STD_PHP_INI_ENTRY_EX("mssql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_persistent, php_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_links, php_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.min_error_severity", "10", PHP_INI_ALL, OnUpdateInt, cfg_min_error_severity, php_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.min_message_severity", "10", PHP_INI_ALL, OnUpdateInt, cfg_min_message_severity, php_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_BOOLEAN("mssql.compatability_mode", "0", PHP_INI_ALL, OnUpdateBool, compatability_mode, php_mssql_globals, mssql_globals)
STD_PHP_INI_ENTRY_EX("mssql.connect_timeout", "5", PHP_INI_ALL, OnUpdateInt, connect_timeout, php_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.textsize", "-1", PHP_INI_ALL, OnUpdateInt, textsize, php_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.textlimit", "-1", PHP_INI_ALL, OnUpdateInt, textlimit, php_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.batchsize", "0", PHP_INI_ALL, OnUpdateInt, batchsize, php_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_BOOLEAN("mssql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateBool, allow_persistent, zend_mssql_globals, mssql_globals)
STD_PHP_INI_ENTRY_EX("mssql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_persistent, zend_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_links, zend_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.min_error_severity", "10", PHP_INI_ALL, OnUpdateInt, cfg_min_error_severity, zend_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.min_message_severity", "10", PHP_INI_ALL, OnUpdateInt, cfg_min_message_severity, zend_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_BOOLEAN("mssql.compatability_mode", "0", PHP_INI_ALL, OnUpdateBool, compatability_mode, zend_mssql_globals, mssql_globals)
STD_PHP_INI_ENTRY_EX("mssql.connect_timeout", "5", PHP_INI_ALL, OnUpdateInt, connect_timeout, zend_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.textsize", "-1", PHP_INI_ALL, OnUpdateInt, textsize, zend_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.textlimit", "-1", PHP_INI_ALL, OnUpdateInt, textlimit, zend_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.batchsize", "0", PHP_INI_ALL, OnUpdateInt, batchsize, zend_mssql_globals, mssql_globals, display_link_numbers)
PHP_INI_END()
/* error handler */
@ -201,8 +201,7 @@ static void _close_mssql_plink(zend_rsrc_list_entry *rsrc)
MS_SQL_G(num_links)--;
}
#ifdef ZTS
static void php_mssql_init_globals(php_mssql_globals *mssql_globals)
static void php_mssql_init_globals(zend_mssql_globals *mssql_globals)
{
MS_SQL_G(num_persistent) = 0;
if (MS_SQL_G(compatability_mode)) {
@ -211,18 +210,10 @@ static void php_mssql_init_globals(php_mssql_globals *mssql_globals)
MS_SQL_G(get_column_content) = php_mssql_get_column_content_without_type;
}
}
#endif
PHP_MINIT_FUNCTION(mssql)
{
MSSQLLS_D;
#ifdef ZTS
mssql_globals_id = ts_allocate_id(sizeof(php_mssql_globals), php_mssql_init_globals, NULL);
mssql_globals = ts_resource(mssql_globals_id);
#else
MS_SQL_G(num_persistent) = 0;
#endif
ZEND_INIT_MODULE_GLOBALS(mssql, php_mssql_init_globals, NULL);
REGISTER_INI_ENTRIES();
le_result = zend_register_list_destructors_ex(_free_mssql_result, NULL, "mssql result", module_number);
@ -235,8 +226,6 @@ PHP_MINIT_FUNCTION(mssql)
}
dberrhandle((DBERRHANDLE_PROC) php_mssql_error_handler);
dbmsghandle((DBMSGHANDLE_PROC) php_mssql_message_handler);
if (MS_SQL_G(connect_timeout) < 1) MS_SQL_G(connect_timeout) = 1;
dbsetlogintime(MS_SQL_G(connect_timeout));
return SUCCESS;
}
@ -248,7 +237,6 @@ PHP_MSHUTDOWN_FUNCTION(mssql)
return SUCCESS;
}
PHP_RINIT_FUNCTION(mssql)
{
MSSQLLS_FETCH();
@ -259,6 +247,8 @@ PHP_RINIT_FUNCTION(mssql)
MS_SQL_G(server_message) = empty_string;
MS_SQL_G(min_error_severity) = MS_SQL_G(cfg_min_error_severity);
MS_SQL_G(min_message_severity) = MS_SQL_G(cfg_min_message_severity);
if (MS_SQL_G(connect_timeout) < 1) MS_SQL_G(connect_timeout) = 1;
dbsetlogintime(MS_SQL_G(connect_timeout));
return SUCCESS;
}

View File

@ -31,19 +31,9 @@
#endif
#if MSSQL65
#define MSSQL_VERSION "6.5"
#include "../../../php_build/mssql-65/include/sqlfront.h"
#include "../../../php_build/mssql-65/include/sqldb.h"
#elif MSSQL70
#define MSSQL_VERSION "7.0"
//#include "../../../php_build/mssql-70/include/sqlfront.h"
//#include "../../../php_build/mssql-70/include/sqldb.h"
#include "sqlfront.h"
#include "sqldb.h"
#else
#define MSSQL_VERSION "Unknown"
#endif
#define coltype(j) dbcoltype(mssql_ptr->link,j)
#define intcol(i) ((int) *(DBINT *) dbdata(mssql_ptr->link,i))
@ -53,11 +43,7 @@
#define charcol(i) ((DBCHAR *) dbdata(mssql_ptr->link,i))
#define floatcol(i) ((float) *(DBFLT8 *) dbdata(mssql_ptr->link,i))
#ifndef DLEXPORT
#define DLEXPORT
#endif
#ifdef __ZTS
#ifdef ZTS
#include "TSRM.h"
#endif
@ -100,7 +86,7 @@ typedef struct mssql_link {
int valid;
} mssql_link;
typedef struct {
ZEND_BEGIN_MODULE_GLOBALS(mssql)
long default_link;
long num_links,num_persistent;
long max_links,max_persistent;
@ -113,7 +99,7 @@ typedef struct {
void (*get_column_content)(mssql_link *mssql_ptr,int offset,pval *result,int column_type);
long textsize, textlimit, batchsize;
HashTable *resource_list, *resource_plist;
} php_mssql_globals;
ZEND_END_MODULE_GLOBALS(mssql)
#define MSSQL_ROWS_BLOCK 128
@ -136,12 +122,12 @@ typedef struct mssql_result {
#ifdef ZTS
# define MSSQLLS_D php_mssql_globals *mssql_globals
# define MSSQLLS_D zend_mssql_globals *mssql_globals
# define MSSQLLS_DC , MSSQLLS_D
# define MSSQLLS_C mssql_globals
# define MSSQLLS_CC , MSSQLLS_C
# define MS_SQL_G(v) (mssql_globals->v)
# define MSSQLLS_FETCH() php_mssql_globals *mssql_globals = ts_resource(mssql_globals_id)
# define MSSQLLS_FETCH() zend_mssql_globals *mssql_globals = ts_resource(mssql_globals_id)
#else
# define MSSQLLS_D
# define MSSQLLS_DC
@ -149,7 +135,6 @@ typedef struct mssql_result {
# define MSSQLLS_CC
# define MS_SQL_G(v) (mssql_globals.v)
# define MSSQLLS_FETCH()
extern PHP_MSSQL_API php_mssql_globals mssql_globals;
#endif
#else