2016-01-30 03:00:20 +01:00
# ifndef PHP_SQLSRV_H
# define PHP_SQLSRV_H
//---------------------------------------------------------------------------------------------------------------------------------
// File: php_sqlsrv.h
//
// Contents: Declarations for the extension
//
// Comments: Also contains "internal" declarations shared across source files.
//
2021-09-08 02:38:17 +02:00
// Microsoft Drivers 5.10 for PHP for SQL Server
2016-01-30 03:00:20 +01:00
// Copyright(c) Microsoft Corporation
// All rights reserved.
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the ""Software""),
// to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//---------------------------------------------------------------------------------------------------------------------------------
2018-12-20 20:49:06 +01:00
# include "php.h"
2016-01-30 03:00:20 +01:00
2018-12-20 20:49:06 +01:00
//*********************************************************************************************************************************
// Global variables
//*********************************************************************************************************************************
2016-01-30 03:00:20 +01:00
2018-12-20 20:49:06 +01:00
// request level variables
ZEND_BEGIN_MODULE_GLOBALS ( sqlsrv )
2016-01-30 03:00:20 +01:00
2018-12-20 20:49:06 +01:00
// global objects for errors and warnings. These are returned by sqlsrv_errors.
zval errors ;
zval warnings ;
2016-01-30 03:00:20 +01:00
2018-12-20 20:49:06 +01:00
// flags for error handling and logging (set via sqlsrv_configure or php.ini)
zend_long log_severity ;
zend_long log_subsystems ;
zend_long current_subsystem ;
zend_bool warnings_return_as_errors ;
zend_long buffered_query_limit ;
2016-01-30 03:00:20 +01:00
2019-12-19 20:03:25 +01:00
# ifndef _WIN32
zend_long set_locale_info ;
# endif
2018-12-20 20:49:06 +01:00
ZEND_END_MODULE_GLOBALS ( sqlsrv )
2016-01-30 03:00:20 +01:00
2018-12-20 20:49:06 +01:00
ZEND_EXTERN_MODULE_GLOBALS ( sqlsrv ) ;
2016-01-30 03:00:20 +01:00
2018-12-20 20:49:06 +01:00
// macro used to access the global variables. Use it to make global variable access agnostic to threads
# define SQLSRV_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(sqlsrv, v)
2016-01-30 03:00:20 +01:00
2018-12-20 20:49:06 +01:00
# if defined(ZTS)
ZEND_TSRMLS_CACHE_EXTERN ( ) ;
2016-01-30 03:00:20 +01:00
# endif
//*********************************************************************************************************************************
// Initialization Functions
//*********************************************************************************************************************************
// variables set during initialization
extern zend_module_entry g_sqlsrv_module_entry ; // describes the extension to PHP
2017-01-19 20:05:51 +01:00
# define phpext_sqlsrv_ptr &g_sqlsrv_module_entry
2016-01-30 03:00:20 +01:00
// module initialization
PHP_MINIT_FUNCTION ( sqlsrv ) ;
// module shutdown function
PHP_MSHUTDOWN_FUNCTION ( sqlsrv ) ;
// request initialization function
PHP_RINIT_FUNCTION ( sqlsrv ) ;
// request shutdown function
PHP_RSHUTDOWN_FUNCTION ( sqlsrv ) ;
// module info function (info returned by phpinfo())
PHP_MINFO_FUNCTION ( sqlsrv ) ;
2018-12-20 20:49:06 +01:00
2016-01-30 03:00:20 +01:00
//*********************************************************************************************************************************
2018-12-20 20:49:06 +01:00
// Functions
2016-01-30 03:00:20 +01:00
//*********************************************************************************************************************************
2018-12-20 20:49:06 +01:00
2016-01-30 03:00:20 +01:00
PHP_FUNCTION ( sqlsrv_connect ) ;
PHP_FUNCTION ( sqlsrv_begin_transaction ) ;
PHP_FUNCTION ( sqlsrv_client_info ) ;
PHP_FUNCTION ( sqlsrv_close ) ;
PHP_FUNCTION ( sqlsrv_commit ) ;
PHP_FUNCTION ( sqlsrv_query ) ;
PHP_FUNCTION ( sqlsrv_prepare ) ;
PHP_FUNCTION ( sqlsrv_rollback ) ;
PHP_FUNCTION ( sqlsrv_server_info ) ;
PHP_FUNCTION ( sqlsrv_cancel ) ;
PHP_FUNCTION ( sqlsrv_execute ) ;
PHP_FUNCTION ( sqlsrv_fetch ) ;
PHP_FUNCTION ( sqlsrv_fetch_array ) ;
PHP_FUNCTION ( sqlsrv_fetch_object ) ;
PHP_FUNCTION ( sqlsrv_field_metadata ) ;
PHP_FUNCTION ( sqlsrv_free_stmt ) ;
PHP_FUNCTION ( sqlsrv_get_field ) ;
PHP_FUNCTION ( sqlsrv_has_rows ) ;
PHP_FUNCTION ( sqlsrv_next_result ) ;
PHP_FUNCTION ( sqlsrv_num_fields ) ;
PHP_FUNCTION ( sqlsrv_num_rows ) ;
PHP_FUNCTION ( sqlsrv_rows_affected ) ;
PHP_FUNCTION ( sqlsrv_send_stream_data ) ;
// type functions for SQL types.
// to expose SQL Server paramterized types, we use functions that return encoded integers that contain the size/precision etc.
// for example, SQLSRV_SQLTYPE_VARCHAR(4000) matches the usage of SQLSRV_SQLTYPE_INT with the size added.
PHP_FUNCTION ( SQLSRV_SQLTYPE_BINARY ) ;
PHP_FUNCTION ( SQLSRV_SQLTYPE_CHAR ) ;
PHP_FUNCTION ( SQLSRV_SQLTYPE_DECIMAL ) ;
PHP_FUNCTION ( SQLSRV_SQLTYPE_NCHAR ) ;
PHP_FUNCTION ( SQLSRV_SQLTYPE_NUMERIC ) ;
PHP_FUNCTION ( SQLSRV_SQLTYPE_NVARCHAR ) ;
PHP_FUNCTION ( SQLSRV_SQLTYPE_VARBINARY ) ;
PHP_FUNCTION ( SQLSRV_SQLTYPE_VARCHAR ) ;
// PHP type functions
// strings and streams may have an encoding parameterized, so we use the functions
// the valid encodings are SQLSRV_ENC_BINARY and SQLSRV_ENC_CHAR.
PHP_FUNCTION ( SQLSRV_PHPTYPE_STREAM ) ;
PHP_FUNCTION ( SQLSRV_PHPTYPE_STRING ) ;
// These functions set and retrieve configuration settings. Configuration settings defined are:
// WarningsReturnAsErrors - treat all ODBC warnings as errors and return false from sqlsrv APIs.
// LogSeverity - combination of severity of messages to log (see Logging)
// LogSubsystems - subsystems within sqlsrv to log messages (see Logging)
PHP_FUNCTION ( sqlsrv_configure ) ;
PHP_FUNCTION ( sqlsrv_get_config ) ;
// *** extension error functions ***
PHP_FUNCTION ( sqlsrv_errors ) ;
# endif /* PHP_SQLSRV_H */