mirror of
https://github.com/php/php-src.git
synced 2024-11-29 04:46:07 +08:00
Adding MS SQL Server module for Win32
This commit is contained in:
parent
a79bdcc28f
commit
e5ca107a3d
10
ext/mssql/Readme_w32.txt
Normal file
10
ext/mssql/Readme_w32.txt
Normal file
@ -0,0 +1,10 @@
|
||||
MS SQL Extension for PHP 4.0 - Win32 README
|
||||
-------------------------------------------
|
||||
|
||||
In order to compile this extension, copy sqlfront.h, sqldb.h and ntwdblib.lib to mssql-65 or mssql-70.
|
||||
These files are optaind from the MS SQL Server distribution CD
|
||||
|
||||
You can change the file location by changing include and lib paths in the project.
|
||||
|
||||
|
||||
[03/11/1999 fmk@swwwing.com]
|
118
ext/mssql/mssql.dsp
Normal file
118
ext/mssql/mssql.dsp
Normal file
@ -0,0 +1,118 @@
|
||||
# Microsoft Developer Studio Project File - Name="mssql" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=mssql - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "mssql.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "mssql.mak" CFG="mssql - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "mssql - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "mssql - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "mssql - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "mssql___Win32_Release"
|
||||
# PROP BASE Intermediate_Dir "mssql___Win32_Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "MSSQL_65_Release"
|
||||
# PROP Intermediate_Dir "MSSQL_65_Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\libzend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL" /D "DBNTWIN32" /D ZTS=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 /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.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"MSSQL_65_Release/php_mssql.dll" /libpath:"..\..\Release_TS"
|
||||
|
||||
!ELSEIF "$(CFG)" == "mssql - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x406 /d "_DEBUG"
|
||||
# ADD RSC /l 0x406 /d "_DEBUG"
|
||||
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 /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# 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 /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "mssql - Win32 Release"
|
||||
# Name "mssql - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_mssql.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_mssql.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqldb.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqlfront.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
1429
ext/mssql/php_mssql.c
Normal file
1429
ext/mssql/php_mssql.c
Normal file
File diff suppressed because it is too large
Load Diff
150
ext/mssql/php_mssql.h
Normal file
150
ext/mssql/php_mssql.h
Normal file
@ -0,0 +1,150 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997, 1998, 1999 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Frank M. Kromann <fmk@swwwing.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _PHP_MSSQL_H
|
||||
#define _PHP_MSSQL_H
|
||||
|
||||
|
||||
#if HAVE_MSSQL
|
||||
#include "sqlfront.h"
|
||||
#include "sqldb.h"
|
||||
|
||||
#if MSSQL65
|
||||
#define MSSQL_VERSION "6.5"
|
||||
#elif MSSQL70
|
||||
#define MSSQL_VERSION "7.0"
|
||||
#else
|
||||
#define MSSQL_VERSION "Unknown"
|
||||
#endif
|
||||
|
||||
#define coltype(j) dbcoltype(mssql_ptr->link,j)
|
||||
#define intcol(i) ((int) *(DBINT *) dbdata(mssql_ptr->link,i))
|
||||
#define smallintcol(i) ((int) *(DBSMALLINT *) dbdata(mssql_ptr->link,i))
|
||||
#define tinyintcol(i) ((int) *(DBTINYINT *) dbdata(mssql_ptr->link,i))
|
||||
#define anyintcol(j) (coltype(j)==SQLINT4?intcol(j):(coltype(j)==SQLINT2?smallintcol(j):tinyintcol(j)))
|
||||
#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
|
||||
#include "TSRM.h"
|
||||
#endif
|
||||
|
||||
extern zend_module_entry mssql_module_entry;
|
||||
#define mssql_module_ptr &mssql_module_entry
|
||||
|
||||
extern PHP_MINIT_FUNCTION(mssql);
|
||||
extern PHP_MSHUTDOWN_FUNCTION(mssql);
|
||||
extern PHP_RINIT_FUNCTION(mssql);
|
||||
extern PHP_RSHUTDOWN_FUNCTION(mssql);
|
||||
PHP_MINFO_FUNCTION(mssql);
|
||||
|
||||
PHP_FUNCTION(mssql_connect);
|
||||
PHP_FUNCTION(mssql_pconnect);
|
||||
PHP_FUNCTION(mssql_close);
|
||||
PHP_FUNCTION(mssql_select_db);
|
||||
PHP_FUNCTION(mssql_query);
|
||||
PHP_FUNCTION(mssql_free_result);
|
||||
PHP_FUNCTION(mssql_get_last_message);
|
||||
PHP_FUNCTION(mssql_num_rows);
|
||||
PHP_FUNCTION(mssql_num_fields);
|
||||
PHP_FUNCTION(mssql_fetch_field);
|
||||
PHP_FUNCTION(mssql_fetch_row);
|
||||
PHP_FUNCTION(mssql_fetch_array);
|
||||
PHP_FUNCTION(mssql_fetch_object);
|
||||
PHP_FUNCTION(mssql_field_length);
|
||||
PHP_FUNCTION(mssql_field_name);
|
||||
PHP_FUNCTION(mssql_field_type);
|
||||
PHP_FUNCTION(mssql_data_seek);
|
||||
PHP_FUNCTION(mssql_field_seek);
|
||||
PHP_FUNCTION(mssql_result);
|
||||
PHP_FUNCTION(mssql_min_error_severity);
|
||||
PHP_FUNCTION(mssql_min_message_severity);
|
||||
|
||||
typedef struct mssql_link {
|
||||
LOGINREC *login;
|
||||
DBPROCESS *link;
|
||||
int valid;
|
||||
} mssql_link;
|
||||
|
||||
typedef struct {
|
||||
long default_link;
|
||||
long num_links,num_persistent;
|
||||
long max_links,max_persistent;
|
||||
long allow_persistent;
|
||||
char *appname;
|
||||
char *server_message;
|
||||
int le_link,le_plink,le_result;
|
||||
long min_error_severity, min_message_severity;
|
||||
long cfg_min_error_severity, cfg_min_message_severity;
|
||||
long compatability_mode, connect_timeout;
|
||||
void (*get_column_content)(mssql_link *mssql_ptr,int offset,pval *result,int column_type);
|
||||
long textsize, textlimit;
|
||||
HashTable *resource_list, *resource_plist;
|
||||
} php_mssql_globals;
|
||||
|
||||
#define MSSQL_ROWS_BLOCK 128
|
||||
|
||||
typedef struct mssql_field {
|
||||
char *name,*column_source;
|
||||
long max_length;
|
||||
int numeric;
|
||||
int type;
|
||||
} mssql_field;
|
||||
|
||||
typedef struct mssql_result {
|
||||
pval **data;
|
||||
mssql_field *fields;
|
||||
mssql_link *mssql_ptr;
|
||||
int cur_row,cur_field;
|
||||
int num_rows,num_fields;
|
||||
} mssql_result;
|
||||
|
||||
|
||||
#ifdef ZTS
|
||||
# define MSSQLLS_D php_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)
|
||||
#else
|
||||
# define MSSQLLS_D
|
||||
# define MSSQLLS_DC
|
||||
# define MSSQLLS_C
|
||||
# define MSSQLLS_CC
|
||||
# define MS_SQL_G(v) (mssql_globals.v)
|
||||
# define MSSQLLS_FETCH()
|
||||
extern ZEND_API php_mssql_globals mssql_globals;
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define mssql_module_ptr NULL
|
||||
|
||||
#endif /* HAVE_MSSQL */
|
||||
|
||||
#define phpext_mssql_ptr mssql_module_ptr
|
||||
|
||||
#endif /* _PHP_MSSQL_H */
|
Loading…
Reference in New Issue
Block a user