From 3cad348509b66828f421d1b843a025b555519a83 Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Fri, 4 Jun 1999 10:45:54 +0000 Subject: [PATCH] * Add a new workspace for dynamic PHP extensions. * Add a few functions to PHP's API. * Get the MySQL extension up-to-date and thread safe. * Add a project for building the MySQL extension under Win32. --- ext/mysql/Readme_w32.txt | 14 ++++ ext/mysql/mysql.c | 73 ++++++++++++----- ext/mysql/mysql.dsp | 171 +++++++++++++++++++++++++++++++++++++++ ext/mysql/php3_mysql.h | 9 ++- main/config.w32.h | 1 - main/php.h | 4 +- main/php_globals.h | 2 +- main/php_ini.c | 8 +- main/php_ini.h | 8 +- php4ext.dsw | 29 +++++++ 10 files changed, 285 insertions(+), 34 deletions(-) create mode 100644 ext/mysql/Readme_w32.txt create mode 100644 ext/mysql/mysql.dsp create mode 100644 php4ext.dsw diff --git a/ext/mysql/Readme_w32.txt b/ext/mysql/Readme_w32.txt new file mode 100644 index 00000000000..4f4e2250657 --- /dev/null +++ b/ext/mysql/Readme_w32.txt @@ -0,0 +1,14 @@ +MySQL Extension for PHP 4.0 - Win32 README +------------------------------------------ + +In order to compile this extension, MySQL must be installed in a parrallel directory +to that of PHP 4.0. For example, if you have PHP 4.0's source tree set up in +C:\Projects\php4, you must have MySQL set up in C:\Projects\MySQL. The compiler +will look for include files in C:\Projects\MySQL\include and for the library +files in C:\Projects\MySQL\lib. + +You can change this by editing the project settings, but it's not recommended, since +you will have to do it every time you obtain a new version of the PHP 4.0 source tree. + + +[4/6/1999 zeev@zend.com] \ No newline at end of file diff --git a/ext/mysql/mysql.c b/ext/mysql/mysql.c index d68f4c9b6ce..d632b3481bc 100644 --- a/ext/mysql/mysql.c +++ b/ext/mysql/mysql.c @@ -36,17 +36,14 @@ */ #if COMPILE_DL -# if PHP_31 -# include "../phpdl.h" -# else -# include "dl/phpdl.h" -# endif +#include "dl/phpdl.h" #endif #include "php.h" #include "php_globals.h" #include "ext/standard/php3_standard.h" #include "php3_mysql.h" +#include "php_globals.h" #if WIN32|WINNT @@ -151,7 +148,7 @@ php3_module_entry mysql_module_entry = { #ifdef ZTS int mysql_globals_id; #else -php_mysql_globals mysql_globals; +PHP_MYSQL_API php_mysql_globals mysql_globals; #endif #ifdef COMPILE_DL @@ -277,7 +274,7 @@ static void php_mysql_init_globals(php_mysql_globals *mysql_globals) int php3_minit_mysql(INIT_FUNC_ARGS) { #ifdef ZTS - mysql_globals_id = tsrm_allocate_id(sizeof(php_mysql_globals), php_mysql_init_globals, NULL); + mysql_globals_id = ts_allocate_id(sizeof(php_mysql_globals), php_mysql_init_globals, NULL); #else MySG(num_persistent)=0; #endif @@ -359,6 +356,7 @@ static void php3_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) int hashed_details_length,port; MYSQL *mysql; MySLS_FETCH(); + PLS_FETCH(); if (PG(sql_safe_mode)) { if (ARG_COUNT(ht)>0) { @@ -598,6 +596,7 @@ static int php3_mysql_get_default_link(INTERNAL_FUNCTION_PARAMETERS MySLS_DC) return MySG(default_link); } + /* {{{ proto int mysql_connect([string hostname[:port]] [, string username] [, string password]) Open a connection to a MySQL Server */ PHP_FUNCTION(mysql_connect) @@ -606,6 +605,7 @@ PHP_FUNCTION(mysql_connect) } /* }}} */ + /* {{{ proto int mysql_pconnect([string hostname[:port]] [, string username] [, string password]) Open a persistent connection to a MySQL Server */ PHP_FUNCTION(mysql_pconnect) @@ -614,6 +614,7 @@ PHP_FUNCTION(mysql_pconnect) } /* }}} */ + /* {{{ proto int mysql_close([int link_identifier]) Close a MySQL connection */ PHP_FUNCTION(mysql_close) @@ -621,6 +622,7 @@ PHP_FUNCTION(mysql_close) pval *mysql_link; int id,type; MYSQL *mysql; + MySLS_FETCH(); switch (ARG_COUNT(ht)) { case 0: @@ -649,6 +651,7 @@ PHP_FUNCTION(mysql_close) } /* }}} */ + /* {{{ proto int mysql_select_db(string database_name [, int link_identifier]) Select a MySQL database */ PHP_FUNCTION(mysql_select_db) @@ -656,7 +659,7 @@ PHP_FUNCTION(mysql_select_db) pval *db,*mysql_link; int id,type; MYSQL *mysql; - + MySLS_FETCH(); switch(ARG_COUNT(ht)) { case 1: @@ -695,6 +698,7 @@ PHP_FUNCTION(mysql_select_db) } /* }}} */ + /* {{{ proto int mysql_create_db(string database_name [, int link_identifier]) Create a MySQL database */ PHP_FUNCTION(mysql_create_db) @@ -702,7 +706,7 @@ PHP_FUNCTION(mysql_create_db) pval *db,*mysql_link; int id,type; MYSQL *mysql; - + MySLS_FETCH(); switch(ARG_COUNT(ht)) { case 1: @@ -740,6 +744,7 @@ PHP_FUNCTION(mysql_create_db) } /* }}} */ + /* {{{ proto int mysql_drop_db(string database_name [, int link_identifier]) Drop (delete) a MySQL database */ PHP_FUNCTION(mysql_drop_db) @@ -747,7 +752,7 @@ PHP_FUNCTION(mysql_drop_db) pval *db,*mysql_link; int id,type; MYSQL *mysql; - + MySLS_FETCH(); switch(ARG_COUNT(ht)) { case 1: @@ -785,6 +790,7 @@ PHP_FUNCTION(mysql_drop_db) } /* }}} */ + /* {{{ proto int mysql_query(string query [, int link_identifier]) Send an SQL query to MySQL */ PHP_FUNCTION(mysql_query) @@ -793,7 +799,7 @@ PHP_FUNCTION(mysql_query) int id,type; MYSQL *mysql; MYSQL_RES *mysql_result; - + MySLS_FETCH(); switch(ARG_COUNT(ht)) { case 1: @@ -842,6 +848,7 @@ PHP_FUNCTION(mysql_query) } /* }}} */ + /* {{{ proto int mysql_db_query(string database_name, string query [, int link_identifier]) Send an SQL query to MySQL */ PHP_FUNCTION(mysql_db_query) @@ -850,7 +857,7 @@ PHP_FUNCTION(mysql_db_query) int id,type; MYSQL *mysql; MYSQL_RES *mysql_result; - + MySLS_FETCH(); switch(ARG_COUNT(ht)) { case 2: @@ -907,6 +914,7 @@ PHP_FUNCTION(mysql_db_query) } /* }}} */ + /* {{{ proto int mysql_list_dbs([int link_identifier]) List databases available on a MySQL server */ PHP_FUNCTION(mysql_list_dbs) @@ -915,7 +923,7 @@ PHP_FUNCTION(mysql_list_dbs) int id,type; MYSQL *mysql; MYSQL_RES *mysql_result; - + MySLS_FETCH(); switch(ARG_COUNT(ht)) { case 0: @@ -949,6 +957,7 @@ PHP_FUNCTION(mysql_list_dbs) } /* }}} */ + /* {{{ proto int mysql_list_tables(string database_name [, int link_identifier]) List tables in a MySQL database */ PHP_FUNCTION(mysql_list_tables) @@ -957,7 +966,7 @@ PHP_FUNCTION(mysql_list_tables) int id,type; MYSQL *mysql; MYSQL_RES *mysql_result; - + MySLS_FETCH(); switch(ARG_COUNT(ht)) { case 1: @@ -999,6 +1008,7 @@ PHP_FUNCTION(mysql_list_tables) } /* }}} */ + /* {{{ proto int mysql_list_fields(string database_name, string table_name [, int link_identifier]) List MySQL result fields */ PHP_FUNCTION(mysql_list_fields) @@ -1007,7 +1017,7 @@ PHP_FUNCTION(mysql_list_fields) int id,type; MYSQL *mysql; MYSQL_RES *mysql_result; - + MySLS_FETCH(); switch(ARG_COUNT(ht)) { case 2: @@ -1050,6 +1060,7 @@ PHP_FUNCTION(mysql_list_fields) } /* }}} */ + /* {{{ proto string mysql_error([int link_identifier]) Returns the text of the error message from previous MySQL operation */ PHP_FUNCTION(mysql_error) @@ -1057,7 +1068,7 @@ PHP_FUNCTION(mysql_error) pval *mysql_link; int id,type; MYSQL *mysql; - + MySLS_FETCH(); switch(ARG_COUNT(ht)) { case 0: @@ -1088,6 +1099,7 @@ PHP_FUNCTION(mysql_error) } /* }}} */ + /* {{{ proto int mysql_errno([int link_identifier]) Returns the number of the error message from previous MySQL operation */ #ifdef mysql_errno @@ -1096,7 +1108,7 @@ PHP_FUNCTION(mysql_errno) pval *mysql_link; int id,type; MYSQL *mysql; - + MySLS_FETCH(); switch(ARG_COUNT(ht)) { case 0: @@ -1128,6 +1140,7 @@ PHP_FUNCTION(mysql_errno) #endif /* }}} */ + /* {{{ proto int mysql_affected_rows([int link_identifier]) Get number of affected rows in previous MySQL operation */ PHP_FUNCTION(mysql_affected_rows) @@ -1135,7 +1148,7 @@ PHP_FUNCTION(mysql_affected_rows) pval *mysql_link; int id,type; MYSQL *mysql; - + MySLS_FETCH(); switch(ARG_COUNT(ht)) { case 0: @@ -1165,6 +1178,7 @@ PHP_FUNCTION(mysql_affected_rows) } /* }}} */ + /* {{{ proto int mysql_insert_id([int link_identifier]) Get the id generated from the previous INSERT operation */ PHP_FUNCTION(mysql_insert_id) @@ -1172,7 +1186,7 @@ PHP_FUNCTION(mysql_insert_id) pval *mysql_link; int id,type; MYSQL *mysql; - + MySLS_FETCH(); switch(ARG_COUNT(ht)) { case 0: @@ -1202,6 +1216,7 @@ PHP_FUNCTION(mysql_insert_id) } /* }}} */ + /* {{{ proto int mysql_result(int result, int row [, mixed field]) Get result data */ PHP_FUNCTION(mysql_result) @@ -1314,6 +1329,7 @@ PHP_FUNCTION(mysql_result) } /* }}} */ + /* {{{ proto int mysql_num_rows(int result) Get number of rows in a result */ PHP_FUNCTION(mysql_num_rows) @@ -1367,6 +1383,7 @@ PHP_FUNCTION(mysql_num_fields) } /* }}} */ + /* {{{ proto array mysql_fetch_row(int result) Get a result row as an enumerated array */ PHP_FUNCTION(mysql_fetch_row) @@ -1419,6 +1436,7 @@ PHP_FUNCTION(mysql_fetch_row) } /* }}} */ + static PHP_FUNCTION(mysql_fetch_hash) { pval *result; @@ -1474,6 +1492,7 @@ static PHP_FUNCTION(mysql_fetch_hash) } } + /* {{{ proto object mysql_fetch_object(int result) Fetch a result row as an object */ PHP_FUNCTION(mysql_fetch_object) @@ -1482,11 +1501,12 @@ PHP_FUNCTION(mysql_fetch_object) if (return_value->type==IS_ARRAY) { return_value->type=IS_OBJECT; return_value->value.obj.properties = return_value->value.ht; - return_value->value.obj.ce = &standard_class; + return_value->value.obj.ce = &zend_standard_class_def; } } /* }}} */ + /* {{{ proto array mysql_fetch_array(int result) Fetch a result row as an associative array */ PHP_FUNCTION(mysql_fetch_array) @@ -1495,6 +1515,7 @@ PHP_FUNCTION(mysql_fetch_array) } /* }}} */ + /* {{{ proto int mysql_data_seek(int result, int row_number) Move internal result pointer */ PHP_FUNCTION(mysql_data_seek) @@ -1525,6 +1546,7 @@ PHP_FUNCTION(mysql_data_seek) } /* }}} */ + /* {{{ proto array mysql_fetch_lengths(int result) Get max data size of each column in a result */ PHP_FUNCTION(mysql_fetch_lengths) @@ -1562,6 +1584,7 @@ PHP_FUNCTION(mysql_fetch_lengths) } /* }}} */ + static char *php3_mysql_get_field_name(int field_type) { switch(field_type) { @@ -1610,6 +1633,7 @@ static char *php3_mysql_get_field_name(int field_type) } } + /* {{{ proto object mysql_fetch_field(int result [, int field_offset]) Get column information from a result and return as an object */ PHP_FUNCTION(mysql_fetch_field) @@ -1673,6 +1697,7 @@ PHP_FUNCTION(mysql_fetch_field) } /* }}} */ + /* {{{ proto int mysql_field_seek(int result, int field_offset) Set result pointer to a specific field offset */ PHP_FUNCTION(mysql_field_seek) @@ -1703,12 +1728,14 @@ PHP_FUNCTION(mysql_field_seek) } /* }}} */ + #define PHP3_MYSQL_FIELD_NAME 1 #define PHP3_MYSQL_FIELD_TABLE 2 #define PHP3_MYSQL_FIELD_LEN 3 #define PHP3_MYSQL_FIELD_TYPE 4 #define PHP3_MYSQL_FIELD_FLAGS 5 + static void php3_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) { pval *result, *field; @@ -1835,6 +1862,7 @@ static void php3_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) } } + /* {{{ proto string mysql_field_name(int result, int field_index) Get the name of the specified field in a result */ PHP_FUNCTION(mysql_field_name) @@ -1843,6 +1871,7 @@ PHP_FUNCTION(mysql_field_name) } /* }}} */ + /* {{{ proto string mysql_field_table(int result, int field_offset) Get name of the table the specified field is in */ PHP_FUNCTION(mysql_field_table) @@ -1851,6 +1880,7 @@ PHP_FUNCTION(mysql_field_table) } /* }}} */ + /* {{{ proto int mysql_field_len(int result, int field_offet) Returns the length of the specified field */ PHP_FUNCTION(mysql_field_len) @@ -1859,6 +1889,7 @@ PHP_FUNCTION(mysql_field_len) } /* }}} */ + /* {{{ proto string mysql_field_type(int result, int field_offset) Get the type of the specified field in a result */ PHP_FUNCTION(mysql_field_type) @@ -1867,6 +1898,7 @@ PHP_FUNCTION(mysql_field_type) } /* }}} */ + /* {{{ proto string mysql_field_flags(int result, int field_offset) Get the flags associated with the specified field in a result */ PHP_FUNCTION(mysql_field_flags) @@ -1875,6 +1907,7 @@ PHP_FUNCTION(mysql_field_flags) } /* }}} */ + /* {{{ proto int mysql_free_result(int result) Free result memory */ PHP_FUNCTION(mysql_free_result) diff --git a/ext/mysql/mysql.dsp b/ext/mysql/mysql.dsp new file mode 100644 index 00000000000..0305861375e --- /dev/null +++ b/ext/mysql/mysql.dsp @@ -0,0 +1,171 @@ +# Microsoft Developer Studio Project File - Name="mysql" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=mysql - Win32 Debug_TS +!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 "mysql.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 "mysql.mak" CFG="mysql - Win32 Debug_TS" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "mysql - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "mysql - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "mysql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "mysql - Win32 Release_TS" (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)" == "mysql - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "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 "MYSQL_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\libzend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\..\TSRM" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL" /D HAVE_MYSQL=1 /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40d /d "NDEBUG" +# ADD RSC /l 0x40d /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 libmySQL.lib php4nts.lib /nologo /dll /machine:I386 /out:"Release/php_mysql.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release" + +!ELSEIF "$(CFG)" == "mysql - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\libzend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\..\TSRM" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL" /D HAVE_MYSQL=1 /D ZEND_DEBUG=1 /FR /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40d /d "_DEBUG" +# ADD RSC /l 0x40d /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 libmySQL.lib php4nts.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_mysql.dll" /pdbtype:sept /libpath:"..\..\..\MySQL\lib\debug" /libpath:"..\..\Debug" + +!ELSEIF "$(CFG)" == "mysql - Win32 Debug_TS" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug_TS" +# PROP BASE Intermediate_Dir "Debug_TS" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_TS" +# PROP Intermediate_Dir "Debug_TS" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\libzend" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL" /D HAVE_MYSQL=1 /FR /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\libzend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL" /D HAVE_MYSQL=1 /D "ZTS" /FR /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40d /d "_DEBUG" +# ADD RSC /l 0x40d /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 libmySQL.lib php4ts.lib /nologo /dll /debug /machine:I386 /out:"Debug_TS/php_mysql.dll" /pdbtype:sept /libpath:"..\..\..\MySQL\lib\debug" /libpath:"..\..\Debug_TS" + +!ELSEIF "$(CFG)" == "mysql - Win32 Release_TS" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release_TS" +# PROP BASE Intermediate_Dir "Release_TS" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_TS" +# PROP Intermediate_Dir "Release_TS" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\libzend" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL" /D HAVE_MYSQL=1 /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\libzend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\..\TSRM" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL" /D HAVE_MYSQL=1 /D "ZTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40d /d "NDEBUG" +# ADD RSC /l 0x40d /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 libmySQL.lib php4ts.lib /nologo /dll /machine:I386 /out:"Release_TS/php_mysql.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release_TS" + +!ENDIF + +# Begin Target + +# Name "mysql - Win32 Release" +# Name "mysql - Win32 Debug" +# Name "mysql - Win32 Debug_TS" +# Name "mysql - Win32 Release_TS" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\mysql.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\php3_mysql.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 +# Begin Source File + +SOURCE=.\Readme_w32.txt +# End Source File +# End Target +# End Project diff --git a/ext/mysql/php3_mysql.h b/ext/mysql/php3_mysql.h index 2b5e55e9852..fc964a19453 100644 --- a/ext/mysql/php3_mysql.h +++ b/ext/mysql/php3_mysql.h @@ -36,6 +36,9 @@ #if COMPILE_DL #undef HAVE_MYSQL #define HAVE_MYSQL 1 +# if WIN32||WINNT +# define PHP_MYSQL_API __declspec(dllexport) +# endif #endif #if HAVE_MYSQL @@ -43,6 +46,10 @@ #define DLEXPORT #endif +#ifdef ZTS +#include "TSRM.h" +#endif + extern php3_module_entry mysql_module_entry; #define mysql_module_ptr &mysql_module_entry @@ -106,7 +113,7 @@ typedef struct { # define MySLS_CC # define MySG(v) (mysql_globals.v) # define MySLS_FETCH() -extern ZEND_API php_mysql_globals mysql_globals; +extern PHP_MYSQL_API php_mysql_globals mysql_globals; #endif diff --git a/main/config.w32.h b/main/config.w32.h index c0652962392..ba1827b1025 100644 --- a/main/config.w32.h +++ b/main/config.w32.h @@ -37,7 +37,6 @@ ---------------------------------------------------------------*/ #if !defined(COMPILE_DL) #define HAVE_SNMP 0 -#define HAVE_MYSQL 0 # define HAVE_ERRMSG_H 0 /*needed for mysql 3.21.17 and up*/ #define HAVE_LDAP 0 #define DBASE 0 diff --git a/main/php.h b/main/php.h index 955cbe66ca9..8872f198a05 100644 --- a/main/php.h +++ b/main/php.h @@ -190,7 +190,7 @@ extern char *strerror(int); #endif #if HAVE_PWD_H -# if MSVC5 +# if WIN32||WINNT #include "win32/pwd.h" #include "win32/param.h" # else @@ -258,8 +258,6 @@ extern pval *data; extern char **environ; #endif -extern PHPAPI int le_index_ptr; /* list entry type for index pointers */ - extern void phperror(char *error); extern PHPAPI void php3_error(int type, const char *format,...); extern PHPAPI int php3_printf(const char *format,...); diff --git a/main/php_globals.h b/main/php_globals.h index ea2597e6a62..7dd5cf40027 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -12,7 +12,7 @@ typedef struct _php_core_globals php_core_globals; # define PLS_CC , PLS_C # define PG(v) (core_globals->v) # define PLS_FETCH() php_core_globals *core_globals = ts_resource(core_globals_id) -PHPAPI extern int core_globals_id; +extern PHPAPI int core_globals_id; #else # define PLS_D # define PLS_DC diff --git a/main/php_ini.c b/main/php_ini.c index e5b219eea69..610e85ce12d 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -351,7 +351,7 @@ PHPAPI void display_ini_entries(zend_module_entry *module) /* Standard message handlers */ -PHP_INI_MH(OnUpdateInt) +PHPAPI PHP_INI_MH(OnUpdateInt) { long *p; #ifndef ZTS @@ -369,7 +369,7 @@ PHP_INI_MH(OnUpdateInt) } -PHP_INI_MH(OnUpdateReal) +PHPAPI PHP_INI_MH(OnUpdateReal) { double *p; #ifndef ZTS @@ -387,7 +387,7 @@ PHP_INI_MH(OnUpdateReal) } -PHP_INI_MH(OnUpdateString) +PHPAPI PHP_INI_MH(OnUpdateString) { char **p; #ifndef ZTS @@ -405,7 +405,7 @@ PHP_INI_MH(OnUpdateString) } -PHP_INI_MH(OnUpdateStringUnempty) +PHPAPI PHP_INI_MH(OnUpdateStringUnempty) { char **p; #ifndef ZTS diff --git a/main/php_ini.h b/main/php_ini.h index 09a9f62c1bb..dc57089588a 100644 --- a/main/php_ini.h +++ b/main/php_ini.h @@ -111,10 +111,10 @@ pval *cfg_get_entry(char *name, uint name_length); /* Standard message handlers */ -PHP_INI_MH(OnUpdateInt); -PHP_INI_MH(OnUpdateReal); -PHP_INI_MH(OnUpdateString); -PHP_INI_MH(OnUpdateStringUnempty); +PHPAPI PHP_INI_MH(OnUpdateInt); +PHPAPI PHP_INI_MH(OnUpdateReal); +PHPAPI PHP_INI_MH(OnUpdateString); +PHPAPI PHP_INI_MH(OnUpdateStringUnempty); #define PHP_INI_DISPLAY_ORIG 1 diff --git a/php4ext.dsw b/php4ext.dsw new file mode 100644 index 00000000000..8cf96a86c1a --- /dev/null +++ b/php4ext.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "mysql"=.\ext\mysql\mysql.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### +