Merge pull request #479 from david-puglielli/lastinsertID

LastInsertID again
This commit is contained in:
David Puglielli 2017-07-24 12:28:24 -07:00 committed by GitHub
commit 710e282720
43 changed files with 576 additions and 451 deletions

View file

@ -3,7 +3,7 @@
// //
// Contents: JScript build configuration used by buildconf.bat // Contents: JScript build configuration used by buildconf.bat
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Implements the PDO object for PDO_SQLSRV // Contents: Implements the PDO object for PDO_SQLSRV
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License
@ -30,8 +30,8 @@ namespace {
const char LAST_INSERT_ID_QUERY[] = "SELECT @@IDENTITY;"; const char LAST_INSERT_ID_QUERY[] = "SELECT @@IDENTITY;";
const size_t LAST_INSERT_ID_BUFF_LEN = 10; // size of the buffer to hold the string value of the last insert id integer const size_t LAST_INSERT_ID_BUFF_LEN = 10; // size of the buffer to hold the string value of the last insert id integer
const char TABLE_LAST_INSERT_ID_QUERY[] = "SELECT IDENT_CURRENT(%s)"; const char SEQUENCE_CURRENT_VALUE_QUERY[] = "SELECT CURRENT_VALUE FROM SYS.SEQUENCES WHERE NAME=%s";
const int LAST_INSERT_ID_QUERY_MAX_LEN = sizeof( TABLE_LAST_INSERT_ID_QUERY ) + SQL_MAX_SQLSERVERNAME + 2; // include the quotes const int LAST_INSERT_ID_QUERY_MAX_LEN = sizeof( SEQUENCE_CURRENT_VALUE_QUERY ) + SQL_MAX_SQLSERVERNAME + 2; // include the quotes
// List of PDO supported connection options. // List of PDO supported connection options.
namespace PDOConnOptionNames { namespace PDOConnOptionNames {
@ -1235,7 +1235,7 @@ char * pdo_sqlsrv_dbh_last_id( _Inout_ pdo_dbh_t *dbh, _In_z_ const char *name,
size_t quoted_len = 0; size_t quoted_len = 0;
int quoted = pdo_sqlsrv_dbh_quote( dbh, name, strlen( name ), &quoted_table, &quoted_len, PDO_PARAM_NULL TSRMLS_CC ); int quoted = pdo_sqlsrv_dbh_quote( dbh, name, strlen( name ), &quoted_table, &quoted_len, PDO_PARAM_NULL TSRMLS_CC );
SQLSRV_ASSERT( quoted, "PDO::lastInsertId failed to quote the table name."); SQLSRV_ASSERT( quoted, "PDO::lastInsertId failed to quote the table name.");
snprintf( last_insert_id_query, LAST_INSERT_ID_QUERY_MAX_LEN, TABLE_LAST_INSERT_ID_QUERY, quoted_table ); snprintf( last_insert_id_query, LAST_INSERT_ID_QUERY_MAX_LEN, SEQUENCE_CURRENT_VALUE_QUERY, quoted_table );
sqlsrv_free( quoted_table ); sqlsrv_free( quoted_table );
} }

View file

@ -3,7 +3,7 @@
// //
// Contents: initialization routines for PDO_SQLSRV // Contents: initialization routines for PDO_SQLSRV
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -5,7 +5,7 @@
// //
// Copyright Microsoft Corporation // Copyright Microsoft Corporation
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Implements the PDOStatement object for the PDO_SQLSRV // Contents: Implements the PDOStatement object for the PDO_SQLSRV
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Utility functions used by both connection or statement functions // Contents: Utility functions used by both connection or statement functions
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -6,7 +6,7 @@
// //
// Contents: Declarations for the extension // Contents: Declarations for the extension
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Version resource // Contents: Version resource
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -6,7 +6,7 @@
// Contents: Contains functions for handling Windows format strings // Contents: Contains functions for handling Windows format strings
// and UTF-16 on non-Windows platforms // and UTF-16 on non-Windows platforms
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -4,7 +4,7 @@
// Contents: Contains functions for handling Windows format strings // Contents: Contains functions for handling Windows format strings
// and UTF-16 on non-Windows platforms // and UTF-16 on non-Windows platforms
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Contains functions for handling UTF-16 on non-Windows platforms // Contents: Contains functions for handling UTF-16 on non-Windows platforms
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Contains functions for handling UTF-16 on non-Windows platforms // Contents: Contains functions for handling UTF-16 on non-Windows platforms
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Core routines that use connection handles shared between sqlsrv and pdo_sqlsrv // Contents: Core routines that use connection handles shared between sqlsrv and pdo_sqlsrv
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: common initialization routines shared by PDO and sqlsrv // Contents: common initialization routines shared by PDO and sqlsrv
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Result sets // Contents: Result sets
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -6,7 +6,7 @@
// //
// Contents: Core routines and constants shared by the Microsoft Drivers for PHP for SQL Server // Contents: Core routines and constants shared by the Microsoft Drivers for PHP for SQL Server
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Core routines that use statement handles shared between sqlsrv and pdo_sqlsrv // Contents: Core routines that use statement handles shared between sqlsrv and pdo_sqlsrv
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Implementation of PHP streams for reading SQL Server data // Contents: Implementation of PHP streams for reading SQL Server data
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -5,7 +5,7 @@
// //
// Comments: Mostly error handling and some type handling // Comments: Mostly error handling and some type handling
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -4,7 +4,7 @@
// Contents: Contains functions for handling Windows format strings // Contents: Contains functions for handling Windows format strings
// and UTF-16 on non-Windows platforms // and UTF-16 on non-Windows platforms
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -4,7 +4,7 @@
// Contents: Contains a portable abstraction for interlocked, atomic // Contents: Contains a portable abstraction for interlocked, atomic
// operations on int32_t and pointer types. // operations on int32_t and pointer types.
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -4,7 +4,7 @@
// Contents: Contains a portable abstraction for interlocked, atomic // Contents: Contains a portable abstraction for interlocked, atomic
// operations on int32_t and pointer types. // operations on int32_t and pointer types.
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -4,7 +4,7 @@
// Contents: Contains a portable abstraction for interlocked, singly // Contents: Contains a portable abstraction for interlocked, singly
// linked list. // linked list.
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Contains portable classes for localization // Contents: Contains portable classes for localization
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -5,7 +5,7 @@
// Must be included in one c/cpp file per binary // Must be included in one c/cpp file per binary
// A build error will occur if this inclusion policy is not followed // A build error will occur if this inclusion policy is not followed
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -1,405 +1,405 @@
#ifndef __msodbcsql_h__ #ifndef __msodbcsql_h__
#define __msodbcsql_h__ #define __msodbcsql_h__
//--------------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------
// File: msodbcsql.h // File: msodbcsql.h
// //
// Contents: Routines that use statement handles. This is a subset of the header file msodbcsql.h in the ODBC Driver. // Contents: Routines that use statement handles. This is a subset of the header file msodbcsql.h in the ODBC Driver.
// //
// Contents: This SDK is not supported under any Microsoft standard support // Contents: This SDK is not supported under any Microsoft standard support
// program or service. The information is provided AS IS without // program or service. The information is provided AS IS without
// warranty of any kind. Microsoft disclaims all implied // warranty of any kind. Microsoft disclaims all implied
// warranties including, without limitation, any implied // warranties including, without limitation, any implied
// warranties of merchantability or of fitness for a particular // warranties of merchantability or of fitness for a particular
// purpose. The entire risk arising out of the use of this SDK // purpose. The entire risk arising out of the use of this SDK
// remains with you. In no event shall Microsoft, its authors, or // remains with you. In no event shall Microsoft, its authors, or
// anyone else involved in the creation, production, or delivery // anyone else involved in the creation, production, or delivery
// of this SDK be liable for any damages whatsoever (including, // of this SDK be liable for any damages whatsoever (including,
// without limitation, damages for loss of business profits, // without limitation, damages for loss of business profits,
// business interruption, loss of business information, or other // business interruption, loss of business information, or other
// pecuniary loss) arising out of the use of or inability to use // pecuniary loss) arising out of the use of or inability to use
// this SDK, even if Microsoft has been advised of the possibility // this SDK, even if Microsoft has been advised of the possibility
// of such damages. // of such damages.
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the ""Software""), // 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, // 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 : // 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 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, // 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 // 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 // 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. // IN THE SOFTWARE.
//--------------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------
#if !defined(SQLODBC_VER) #if !defined(SQLODBC_VER)
#define SQLODBC_VER 1300 #define SQLODBC_VER 1300
#endif #endif
#if SQLODBC_VER >= 1300 #if SQLODBC_VER >= 1300
#define SQLODBC_PRODUCT_NAME_FULL_VER_ANSI "Microsoft ODBC Driver 13 for SQL Server" #define SQLODBC_PRODUCT_NAME_FULL_VER_ANSI "Microsoft ODBC Driver 13 for SQL Server"
#define SQLODBC_PRODUCT_NAME_FULL_ANSI "Microsoft ODBC Driver for SQL Server" #define SQLODBC_PRODUCT_NAME_FULL_ANSI "Microsoft ODBC Driver for SQL Server"
#define SQLODBC_PRODUCT_NAME_SHORT_VER_ANSI "ODBC Driver 13 for SQL Server" #define SQLODBC_PRODUCT_NAME_SHORT_VER_ANSI "ODBC Driver 13 for SQL Server"
#define SQLODBC_PRODUCT_NAME_SHORT_ANSI "ODBC Driver for SQL Server" #define SQLODBC_PRODUCT_NAME_SHORT_ANSI "ODBC Driver for SQL Server"
#endif // SQLODBC_VER >= 1300 #endif // SQLODBC_VER >= 1300
#define SQLODBC_PRODUCT_NAME_FULL_VER SQLODBC_PRODUCT_NAME_FULL_VER_ANSI #define SQLODBC_PRODUCT_NAME_FULL_VER SQLODBC_PRODUCT_NAME_FULL_VER_ANSI
#define SQLODBC_PRODUCT_NAME_FULL SQLODBC_PRODUCT_NAME_FULL_ANSI #define SQLODBC_PRODUCT_NAME_FULL SQLODBC_PRODUCT_NAME_FULL_ANSI
#define SQLODBC_PRODUCT_NAME_SHORT_VER SQLODBC_PRODUCT_NAME_SHORT_VER_ANSI #define SQLODBC_PRODUCT_NAME_SHORT_VER SQLODBC_PRODUCT_NAME_SHORT_VER_ANSI
#define SQLODBC_PRODUCT_NAME_SHORT SQLODBC_PRODUCT_NAME_SHORT_ANSI #define SQLODBC_PRODUCT_NAME_SHORT SQLODBC_PRODUCT_NAME_SHORT_ANSI
#define SQLODBC_DRIVER_NAME SQLODBC_PRODUCT_NAME_SHORT_VER #define SQLODBC_DRIVER_NAME SQLODBC_PRODUCT_NAME_SHORT_VER
// max SQL Server identifier length // max SQL Server identifier length
#define SQL_MAX_SQLSERVERNAME 128 #define SQL_MAX_SQLSERVERNAME 128
// SQLSetConnectAttr driver specific defines. // SQLSetConnectAttr driver specific defines.
// Microsoft has 1200 thru 1249 reserved for Microsoft ODBC Driver for SQL Server usage. // Microsoft has 1200 thru 1249 reserved for Microsoft ODBC Driver for SQL Server usage.
// Connection attributes // Connection attributes
#define SQL_COPT_SS_BASE 1200 #define SQL_COPT_SS_BASE 1200
#define SQL_COPT_SS_INTEGRATED_SECURITY (SQL_COPT_SS_BASE+3) // Force integrated security on login #define SQL_COPT_SS_INTEGRATED_SECURITY (SQL_COPT_SS_BASE+3) // Force integrated security on login
#define SQL_COPT_SS_TRANSLATE (SQL_COPT_SS_BASE+20) // Perform code page translation #define SQL_COPT_SS_TRANSLATE (SQL_COPT_SS_BASE+20) // Perform code page translation
#define SQL_COPT_SS_ENCRYPT (SQL_COPT_SS_BASE+23) // Allow strong encryption for data #define SQL_COPT_SS_ENCRYPT (SQL_COPT_SS_BASE+23) // Allow strong encryption for data
#define SQL_COPT_SS_MARS_ENABLED (SQL_COPT_SS_BASE+24) // Multiple active result set per connection #define SQL_COPT_SS_MARS_ENABLED (SQL_COPT_SS_BASE+24) // Multiple active result set per connection
#define SQL_COPT_SS_TXN_ISOLATION (SQL_COPT_SS_BASE+27) // Used to set/get any driver-specific or ODBC-defined TXN iso level #define SQL_COPT_SS_TXN_ISOLATION (SQL_COPT_SS_BASE+27) // Used to set/get any driver-specific or ODBC-defined TXN iso level
#define SQL_COPT_SS_TRUST_SERVER_CERTIFICATE (SQL_COPT_SS_BASE+28) // Trust server certificate #define SQL_COPT_SS_TRUST_SERVER_CERTIFICATE (SQL_COPT_SS_BASE+28) // Trust server certificate
// SQLSetStmtAttr Microsoft ODBC Driver for SQL Server specific defines. // SQLSetStmtAttr Microsoft ODBC Driver for SQL Server specific defines.
// Statement attributes // Statement attributes
#define SQL_SOPT_SS_BASE 1225 #define SQL_SOPT_SS_BASE 1225
#define SQL_SOPT_SS_TEXTPTR_LOGGING (SQL_SOPT_SS_BASE+0) // Text pointer logging #define SQL_SOPT_SS_TEXTPTR_LOGGING (SQL_SOPT_SS_BASE+0) // Text pointer logging
#define SQL_SOPT_SS_NOBROWSETABLE (SQL_SOPT_SS_BASE+3) // Set NOBROWSETABLE option #define SQL_SOPT_SS_NOBROWSETABLE (SQL_SOPT_SS_BASE+3) // Set NOBROWSETABLE option
#define SQL_SOPT_SS_COLUMN_ENCRYPTION (SQL_SOPT_SS_BASE+13)// Sets the column encryption mode #define SQL_SOPT_SS_COLUMN_ENCRYPTION (SQL_SOPT_SS_BASE+13)// Sets the column encryption mode
// Define old names // Define old names
#define SQL_TEXTPTR_LOGGING SQL_SOPT_SS_TEXTPTR_LOGGING #define SQL_TEXTPTR_LOGGING SQL_SOPT_SS_TEXTPTR_LOGGING
#define SQL_COPT_SS_BASE_EX 1240 #define SQL_COPT_SS_BASE_EX 1240
#define SQL_COPT_SS_WARN_ON_CP_ERROR (SQL_COPT_SS_BASE_EX+3) // Issues warning when data from the server had a loss during code page conversion. #define SQL_COPT_SS_WARN_ON_CP_ERROR (SQL_COPT_SS_BASE_EX+3) // Issues warning when data from the server had a loss during code page conversion.
#define SQL_COPT_SS_CONNECTION_DEAD (SQL_COPT_SS_BASE_EX+4) // dbdead SQLGetConnectOption only. It will try to ping the server. Expensive connection check #define SQL_COPT_SS_CONNECTION_DEAD (SQL_COPT_SS_BASE_EX+4) // dbdead SQLGetConnectOption only. It will try to ping the server. Expensive connection check
#define SQL_COPT_SS_APPLICATION_INTENT (SQL_COPT_SS_BASE_EX+7) // Application Intent #define SQL_COPT_SS_APPLICATION_INTENT (SQL_COPT_SS_BASE_EX+7) // Application Intent
#define SQL_COPT_SS_MULTISUBNET_FAILOVER (SQL_COPT_SS_BASE_EX+8) // Multi-subnet Failover #define SQL_COPT_SS_MULTISUBNET_FAILOVER (SQL_COPT_SS_BASE_EX+8) // Multi-subnet Failover
#define SQL_COPT_SS_TNIR (SQL_COPT_SS_BASE_EX+9) // Transparent Network IP Resolution #define SQL_COPT_SS_TNIR (SQL_COPT_SS_BASE_EX+9) // Transparent Network IP Resolution
#define SQL_COPT_SS_COLUMN_ENCRYPTION (SQL_COPT_SS_BASE_EX+10)// Column Encryption Enabled or Disabled #define SQL_COPT_SS_COLUMN_ENCRYPTION (SQL_COPT_SS_BASE_EX+10)// Column Encryption Enabled or Disabled
#define SQL_COPT_SS_CEKEYSTOREPROVIDER (SQL_COPT_SS_BASE_EX+11)// Load a keystore provider or read the list of loaded keystore providers #define SQL_COPT_SS_CEKEYSTOREPROVIDER (SQL_COPT_SS_BASE_EX+11)// Load a keystore provider or read the list of loaded keystore providers
#define SQL_COPT_SS_CEKEYSTOREDATA (SQL_COPT_SS_BASE_EX+12)// Communicate with loaded keystore providers #define SQL_COPT_SS_CEKEYSTOREDATA (SQL_COPT_SS_BASE_EX+12)// Communicate with loaded keystore providers
#define SQL_COPT_SS_TRUSTEDCMKPATHS (SQL_COPT_SS_BASE_EX+13)// List of trusted CMK paths #define SQL_COPT_SS_TRUSTEDCMKPATHS (SQL_COPT_SS_BASE_EX+13)// List of trusted CMK paths
#define SQL_COPT_SS_CEKCACHETTL (SQL_COPT_SS_BASE_EX+14)// Symmetric Key Cache TTL #define SQL_COPT_SS_CEKCACHETTL (SQL_COPT_SS_BASE_EX+14)// Symmetric Key Cache TTL
#define SQL_COPT_SS_AUTHENTICATION (SQL_COPT_SS_BASE_EX+15)// The authentication method used for the connection #define SQL_COPT_SS_AUTHENTICATION (SQL_COPT_SS_BASE_EX+15)// The authentication method used for the connection
// SQLColAttributes driver specific defines. // SQLColAttributes driver specific defines.
// SQLSetDescField/SQLGetDescField driver specific defines. // SQLSetDescField/SQLGetDescField driver specific defines.
// Microsoft has 1200 thru 1249 reserved for Microsoft ODBC Driver for SQL Server usage. // Microsoft has 1200 thru 1249 reserved for Microsoft ODBC Driver for SQL Server usage.
#define SQL_CA_SS_BASE 1200 #define SQL_CA_SS_BASE 1200
#define SQL_CA_SS_COLUMN_SSTYPE (SQL_CA_SS_BASE+0) // dbcoltype/dbalttype #define SQL_CA_SS_COLUMN_SSTYPE (SQL_CA_SS_BASE+0) // dbcoltype/dbalttype
#define SQL_CA_SS_COLUMN_UTYPE (SQL_CA_SS_BASE+1) // dbcolutype/dbaltutype #define SQL_CA_SS_COLUMN_UTYPE (SQL_CA_SS_BASE+1) // dbcolutype/dbaltutype
#define SQL_CA_SS_NUM_ORDERS (SQL_CA_SS_BASE+2) // dbnumorders #define SQL_CA_SS_NUM_ORDERS (SQL_CA_SS_BASE+2) // dbnumorders
#define SQL_CA_SS_COLUMN_ORDER (SQL_CA_SS_BASE+3) // dbordercol #define SQL_CA_SS_COLUMN_ORDER (SQL_CA_SS_BASE+3) // dbordercol
#define SQL_CA_SS_COLUMN_VARYLEN (SQL_CA_SS_BASE+4) // dbvarylen #define SQL_CA_SS_COLUMN_VARYLEN (SQL_CA_SS_BASE+4) // dbvarylen
#define SQL_CA_SS_NUM_COMPUTES (SQL_CA_SS_BASE+5) // dbnumcompute #define SQL_CA_SS_NUM_COMPUTES (SQL_CA_SS_BASE+5) // dbnumcompute
#define SQL_CA_SS_COMPUTE_ID (SQL_CA_SS_BASE+6) // dbnextrow status return #define SQL_CA_SS_COMPUTE_ID (SQL_CA_SS_BASE+6) // dbnextrow status return
#define SQL_CA_SS_COMPUTE_BYLIST (SQL_CA_SS_BASE+7) // dbbylist #define SQL_CA_SS_COMPUTE_BYLIST (SQL_CA_SS_BASE+7) // dbbylist
#define SQL_CA_SS_COLUMN_ID (SQL_CA_SS_BASE+8) // dbaltcolid #define SQL_CA_SS_COLUMN_ID (SQL_CA_SS_BASE+8) // dbaltcolid
#define SQL_CA_SS_COLUMN_OP (SQL_CA_SS_BASE+9) // dbaltop #define SQL_CA_SS_COLUMN_OP (SQL_CA_SS_BASE+9) // dbaltop
#define SQL_CA_SS_COLUMN_SIZE (SQL_CA_SS_BASE+10) // dbcollen #define SQL_CA_SS_COLUMN_SIZE (SQL_CA_SS_BASE+10) // dbcollen
#define SQL_CA_SS_COLUMN_HIDDEN (SQL_CA_SS_BASE+11) // Column is hidden (FOR BROWSE) #define SQL_CA_SS_COLUMN_HIDDEN (SQL_CA_SS_BASE+11) // Column is hidden (FOR BROWSE)
#define SQL_CA_SS_COLUMN_KEY (SQL_CA_SS_BASE+12) // Column is key column (FOR BROWSE) #define SQL_CA_SS_COLUMN_KEY (SQL_CA_SS_BASE+12) // Column is key column (FOR BROWSE)
#define SQL_CA_SS_COLUMN_COLLATION (SQL_CA_SS_BASE+14) // Column collation (only for chars) #define SQL_CA_SS_COLUMN_COLLATION (SQL_CA_SS_BASE+14) // Column collation (only for chars)
#define SQL_CA_SS_VARIANT_TYPE (SQL_CA_SS_BASE+15) #define SQL_CA_SS_VARIANT_TYPE (SQL_CA_SS_BASE+15)
#define SQL_CA_SS_VARIANT_SQL_TYPE (SQL_CA_SS_BASE+16) #define SQL_CA_SS_VARIANT_SQL_TYPE (SQL_CA_SS_BASE+16)
#define SQL_CA_SS_VARIANT_SERVER_TYPE (SQL_CA_SS_BASE+17) #define SQL_CA_SS_VARIANT_SERVER_TYPE (SQL_CA_SS_BASE+17)
// XML, CLR UDT, and table valued parameter related metadata // XML, CLR UDT, and table valued parameter related metadata
#define SQL_CA_SS_UDT_CATALOG_NAME (SQL_CA_SS_BASE+18) // UDT catalog name #define SQL_CA_SS_UDT_CATALOG_NAME (SQL_CA_SS_BASE+18) // UDT catalog name
#define SQL_CA_SS_UDT_SCHEMA_NAME (SQL_CA_SS_BASE+19) // UDT schema name #define SQL_CA_SS_UDT_SCHEMA_NAME (SQL_CA_SS_BASE+19) // UDT schema name
#define SQL_CA_SS_UDT_TYPE_NAME (SQL_CA_SS_BASE+20) // UDT type name #define SQL_CA_SS_UDT_TYPE_NAME (SQL_CA_SS_BASE+20) // UDT type name
#define SQL_CA_SS_XML_SCHEMACOLLECTION_CATALOG_NAME (SQL_CA_SS_BASE+22) // Name of the catalog that contains XML Schema collection #define SQL_CA_SS_XML_SCHEMACOLLECTION_CATALOG_NAME (SQL_CA_SS_BASE+22) // Name of the catalog that contains XML Schema collection
#define SQL_CA_SS_XML_SCHEMACOLLECTION_SCHEMA_NAME (SQL_CA_SS_BASE+23) // Name of the schema that contains XML Schema collection #define SQL_CA_SS_XML_SCHEMACOLLECTION_SCHEMA_NAME (SQL_CA_SS_BASE+23) // Name of the schema that contains XML Schema collection
#define SQL_CA_SS_XML_SCHEMACOLLECTION_NAME (SQL_CA_SS_BASE+24) // Name of the XML Schema collection #define SQL_CA_SS_XML_SCHEMACOLLECTION_NAME (SQL_CA_SS_BASE+24) // Name of the XML Schema collection
#define SQL_CA_SS_CATALOG_NAME (SQL_CA_SS_BASE+25) // Catalog name #define SQL_CA_SS_CATALOG_NAME (SQL_CA_SS_BASE+25) // Catalog name
#define SQL_CA_SS_SCHEMA_NAME (SQL_CA_SS_BASE+26) // Schema name #define SQL_CA_SS_SCHEMA_NAME (SQL_CA_SS_BASE+26) // Schema name
#define SQL_CA_SS_TYPE_NAME (SQL_CA_SS_BASE+27) // Type name #define SQL_CA_SS_TYPE_NAME (SQL_CA_SS_BASE+27) // Type name
// table valued parameter related metadata // table valued parameter related metadata
#define SQL_CA_SS_COLUMN_COMPUTED (SQL_CA_SS_BASE+29) // column is computed #define SQL_CA_SS_COLUMN_COMPUTED (SQL_CA_SS_BASE+29) // column is computed
#define SQL_CA_SS_COLUMN_IN_UNIQUE_KEY (SQL_CA_SS_BASE+30) // column is part of a unique key #define SQL_CA_SS_COLUMN_IN_UNIQUE_KEY (SQL_CA_SS_BASE+30) // column is part of a unique key
#define SQL_CA_SS_COLUMN_SORT_ORDER (SQL_CA_SS_BASE+31) // column sort order #define SQL_CA_SS_COLUMN_SORT_ORDER (SQL_CA_SS_BASE+31) // column sort order
#define SQL_CA_SS_COLUMN_SORT_ORDINAL (SQL_CA_SS_BASE+32) // column sort ordinal #define SQL_CA_SS_COLUMN_SORT_ORDINAL (SQL_CA_SS_BASE+32) // column sort ordinal
#define SQL_CA_SS_COLUMN_HAS_DEFAULT_VALUE (SQL_CA_SS_BASE+33) // column has default value for all rows of the table valued parameter #define SQL_CA_SS_COLUMN_HAS_DEFAULT_VALUE (SQL_CA_SS_BASE+33) // column has default value for all rows of the table valued parameter
// sparse column related metadata // sparse column related metadata
#define SQL_CA_SS_IS_COLUMN_SET (SQL_CA_SS_BASE+34) // column is a column-set column for sparse columns #define SQL_CA_SS_IS_COLUMN_SET (SQL_CA_SS_BASE+34) // column is a column-set column for sparse columns
// Legacy datetime related metadata // Legacy datetime related metadata
#define SQL_CA_SS_SERVER_TYPE (SQL_CA_SS_BASE+35) // column type to send on the wire for datetime types #define SQL_CA_SS_SERVER_TYPE (SQL_CA_SS_BASE+35) // column type to send on the wire for datetime types
// force column encryption // force column encryption
#define SQL_CA_SS_FORCE_ENCRYPT (SQL_CA_SS_BASE+36) // indicate mandatory encryption for this parameter #define SQL_CA_SS_FORCE_ENCRYPT (SQL_CA_SS_BASE+36) // indicate mandatory encryption for this parameter
#define SQL_CA_SS_MAX_USED (SQL_CA_SS_BASE+37) #define SQL_CA_SS_MAX_USED (SQL_CA_SS_BASE+37)
// Defines for use with SQL_COPT_SS_INTEGRATED_SECURITY - Pre-Connect Option only // Defines for use with SQL_COPT_SS_INTEGRATED_SECURITY - Pre-Connect Option only
#define SQL_IS_OFF 0L // Integrated security isn't used #define SQL_IS_OFF 0L // Integrated security isn't used
#define SQL_IS_ON 1L // Integrated security is used #define SQL_IS_ON 1L // Integrated security is used
#define SQL_IS_DEFAULT SQL_IS_OFF #define SQL_IS_DEFAULT SQL_IS_OFF
// Defines for use with SQL_COPT_SS_TRANSLATE // Defines for use with SQL_COPT_SS_TRANSLATE
#define SQL_XL_OFF 0L // Code page translation is not performed #define SQL_XL_OFF 0L // Code page translation is not performed
#define SQL_XL_ON 1L // Code page translation is performed #define SQL_XL_ON 1L // Code page translation is performed
#define SQL_XL_DEFAULT SQL_XL_ON #define SQL_XL_DEFAULT SQL_XL_ON
// Defines for use with SQL_SOPT_SS_TEXTPTR_LOGGING // Defines for use with SQL_SOPT_SS_TEXTPTR_LOGGING
#define SQL_TL_OFF 0L // No logging on text pointer ops #define SQL_TL_OFF 0L // No logging on text pointer ops
#define SQL_TL_ON 1L // Logging occurs on text pointer ops #define SQL_TL_ON 1L // Logging occurs on text pointer ops
#define SQL_TL_DEFAULT SQL_TL_ON #define SQL_TL_DEFAULT SQL_TL_ON
// Defines for use with SQL_SOPT_SS_NOBROWSETABLE // Defines for use with SQL_SOPT_SS_NOBROWSETABLE
#define SQL_NB_OFF 0L // NO_BROWSETABLE is off #define SQL_NB_OFF 0L // NO_BROWSETABLE is off
#define SQL_NB_ON 1L // NO_BROWSETABLE is on #define SQL_NB_ON 1L // NO_BROWSETABLE is on
#define SQL_NB_DEFAULT SQL_NB_OFF #define SQL_NB_DEFAULT SQL_NB_OFF
// Defines for use with SQL_SOPT_SS_COLUMN_ENCRYPTION // Defines for use with SQL_SOPT_SS_COLUMN_ENCRYPTION
#define SQL_CE_DISABLED 0L // Disabled #define SQL_CE_DISABLED 0L // Disabled
#define SQL_CE_RESULTSETONLY 1L // Decryption Only (resultsets and return values) #define SQL_CE_RESULTSETONLY 1L // Decryption Only (resultsets and return values)
#define SQL_CE_ENABLED 3L // Enabled (both encryption and decryption) #define SQL_CE_ENABLED 3L // Enabled (both encryption and decryption)
// Defines for use with SQL_COPT_SS_COLUMN_ENCRYPTION // Defines for use with SQL_COPT_SS_COLUMN_ENCRYPTION
#define SQL_COLUMN_ENCRYPTION_DISABLE 0L #define SQL_COLUMN_ENCRYPTION_DISABLE 0L
#define SQL_COLUMN_ENCRYPTION_ENABLE 1L #define SQL_COLUMN_ENCRYPTION_ENABLE 1L
#define SQL_COLUMN_ENCRYPTION_DEFAULT SQL_COLUMN_ENCRYPTION_DISABLE #define SQL_COLUMN_ENCRYPTION_DEFAULT SQL_COLUMN_ENCRYPTION_DISABLE
// Defines for use with SQL_COPT_SS_CEKCACHETTL // Defines for use with SQL_COPT_SS_CEKCACHETTL
#define SQL_CEKCACHETTL_DEFAULT 7200L // TTL value in seconds (2 hours) #define SQL_CEKCACHETTL_DEFAULT 7200L // TTL value in seconds (2 hours)
// SQL_COPT_SS_ENCRYPT // SQL_COPT_SS_ENCRYPT
#define SQL_EN_OFF 0L #define SQL_EN_OFF 0L
#define SQL_EN_ON 1L #define SQL_EN_ON 1L
// SQL_COPT_SS_TRUST_SERVER_CERTIFICATE // SQL_COPT_SS_TRUST_SERVER_CERTIFICATE
#define SQL_TRUST_SERVER_CERTIFICATE_NO 0L #define SQL_TRUST_SERVER_CERTIFICATE_NO 0L
#define SQL_TRUST_SERVER_CERTIFICATE_YES 1L #define SQL_TRUST_SERVER_CERTIFICATE_YES 1L
// SQL_COPT_SS_WARN_ON_CP_ERROR // SQL_COPT_SS_WARN_ON_CP_ERROR
#define SQL_WARN_NO 0L #define SQL_WARN_NO 0L
#define SQL_WARN_YES 1L #define SQL_WARN_YES 1L
// SQL_COPT_SS_MARS_ENABLED // SQL_COPT_SS_MARS_ENABLED
#define SQL_MARS_ENABLED_NO 0L #define SQL_MARS_ENABLED_NO 0L
#define SQL_MARS_ENABLED_YES 1L #define SQL_MARS_ENABLED_YES 1L
// SQL_TXN_ISOLATION_OPTION bitmasks // SQL_TXN_ISOLATION_OPTION bitmasks
#define SQL_TXN_SS_SNAPSHOT 0x00000020L #define SQL_TXN_SS_SNAPSHOT 0x00000020L
// The following are defines for SQL_CA_SS_COLUMN_SORT_ORDER // The following are defines for SQL_CA_SS_COLUMN_SORT_ORDER
#define SQL_SS_ORDER_UNSPECIFIED 0L #define SQL_SS_ORDER_UNSPECIFIED 0L
#define SQL_SS_DESCENDING_ORDER 1L #define SQL_SS_DESCENDING_ORDER 1L
#define SQL_SS_ASCENDING_ORDER 2L #define SQL_SS_ASCENDING_ORDER 2L
#define SQL_SS_ORDER_DEFAULT SQL_SS_ORDER_UNSPECIFIED #define SQL_SS_ORDER_DEFAULT SQL_SS_ORDER_UNSPECIFIED
// Driver specific SQL data type defines. // Driver specific SQL data type defines.
// Microsoft has -150 thru -199 reserved for Microsoft ODBC Driver for SQL Server usage. // Microsoft has -150 thru -199 reserved for Microsoft ODBC Driver for SQL Server usage.
#define SQL_SS_VARIANT (-150) #define SQL_SS_VARIANT (-150)
#define SQL_SS_UDT (-151) #define SQL_SS_UDT (-151)
#define SQL_SS_XML (-152) #define SQL_SS_XML (-152)
#define SQL_SS_TABLE (-153) #define SQL_SS_TABLE (-153)
#define SQL_SS_TIME2 (-154) #define SQL_SS_TIME2 (-154)
#define SQL_SS_TIMESTAMPOFFSET (-155) #define SQL_SS_TIMESTAMPOFFSET (-155)
// Local types to be used with SQL_CA_SS_SERVER_TYPE // Local types to be used with SQL_CA_SS_SERVER_TYPE
#define SQL_SS_TYPE_DEFAULT 0L #define SQL_SS_TYPE_DEFAULT 0L
#define SQL_SS_TYPE_SMALLDATETIME 1L #define SQL_SS_TYPE_SMALLDATETIME 1L
#define SQL_SS_TYPE_DATETIME 2L #define SQL_SS_TYPE_DATETIME 2L
// Extended C Types range 4000 and above. Range of -100 thru 200 is reserved by Driver Manager. // Extended C Types range 4000 and above. Range of -100 thru 200 is reserved by Driver Manager.
#define SQL_C_TYPES_EXTENDED 0x04000L #define SQL_C_TYPES_EXTENDED 0x04000L
// SQL_SS_LENGTH_UNLIMITED is used to describe the max length of // SQL_SS_LENGTH_UNLIMITED is used to describe the max length of
// VARCHAR(max), VARBINARY(max), NVARCHAR(max), and XML columns // VARCHAR(max), VARBINARY(max), NVARCHAR(max), and XML columns
#define SQL_SS_LENGTH_UNLIMITED 0 #define SQL_SS_LENGTH_UNLIMITED 0
// User Data Type definitions. // User Data Type definitions.
// Returned by SQLColAttributes/SQL_CA_SS_COLUMN_UTYPE. // Returned by SQLColAttributes/SQL_CA_SS_COLUMN_UTYPE.
#define SQLudtBINARY 3 #define SQLudtBINARY 3
#define SQLudtBIT 16 #define SQLudtBIT 16
#define SQLudtBITN 0 #define SQLudtBITN 0
#define SQLudtCHAR 1 #define SQLudtCHAR 1
#define SQLudtDATETIM4 22 #define SQLudtDATETIM4 22
#define SQLudtDATETIME 12 #define SQLudtDATETIME 12
#define SQLudtDATETIMN 15 #define SQLudtDATETIMN 15
#define SQLudtDECML 24 #define SQLudtDECML 24
#define SQLudtDECMLN 26 #define SQLudtDECMLN 26
#define SQLudtFLT4 23 #define SQLudtFLT4 23
#define SQLudtFLT8 8 #define SQLudtFLT8 8
#define SQLudtFLTN 14 #define SQLudtFLTN 14
#define SQLudtIMAGE 20 #define SQLudtIMAGE 20
#define SQLudtINT1 5 #define SQLudtINT1 5
#define SQLudtINT2 6 #define SQLudtINT2 6
#define SQLudtINT4 7 #define SQLudtINT4 7
#define SQLudtINTN 13 #define SQLudtINTN 13
#define SQLudtMONEY 11 #define SQLudtMONEY 11
#define SQLudtMONEY4 21 #define SQLudtMONEY4 21
#define SQLudtMONEYN 17 #define SQLudtMONEYN 17
#define SQLudtNUM 10 #define SQLudtNUM 10
#define SQLudtNUMN 25 #define SQLudtNUMN 25
#define SQLudtSYSNAME 18 #define SQLudtSYSNAME 18
#define SQLudtTEXT 19 #define SQLudtTEXT 19
#define SQLudtTIMESTAMP 80 #define SQLudtTIMESTAMP 80
#define SQLudtUNIQUEIDENTIFIER 0 #define SQLudtUNIQUEIDENTIFIER 0
#define SQLudtVARBINARY 4 #define SQLudtVARBINARY 4
#define SQLudtVARCHAR 2 #define SQLudtVARCHAR 2
#define MIN_USER_DATATYPE 256 #define MIN_USER_DATATYPE 256
// Aggregate operator types. // Aggregate operator types.
// Returned by SQLColAttributes/SQL_CA_SS_COLUMN_OP. // Returned by SQLColAttributes/SQL_CA_SS_COLUMN_OP.
#define SQLAOPSTDEV 0x30 // Standard deviation #define SQLAOPSTDEV 0x30 // Standard deviation
#define SQLAOPSTDEVP 0x31 // Standard deviation population #define SQLAOPSTDEVP 0x31 // Standard deviation population
#define SQLAOPVAR 0x32 // Variance #define SQLAOPVAR 0x32 // Variance
#define SQLAOPVARP 0x33 // Variance population #define SQLAOPVARP 0x33 // Variance population
#define SQLAOPCNT 0x4b // Count #define SQLAOPCNT 0x4b // Count
#define SQLAOPSUM 0x4d // Sum #define SQLAOPSUM 0x4d // Sum
#define SQLAOPAVG 0x4f // Average #define SQLAOPAVG 0x4f // Average
#define SQLAOPMIN 0x51 // Min #define SQLAOPMIN 0x51 // Min
#define SQLAOPMAX 0x52 // Max #define SQLAOPMAX 0x52 // Max
#define SQLAOPANY 0x53 // Any #define SQLAOPANY 0x53 // Any
#define SQLAOPNOOP 0x56 // None #define SQLAOPNOOP 0x56 // None
// SQLGetDiagField driver specific defines. // SQLGetDiagField driver specific defines.
// Microsoft has -1150 thru -1199 reserved for Microsoft ODBC Driver for SQL Server usage. // Microsoft has -1150 thru -1199 reserved for Microsoft ODBC Driver for SQL Server usage.
#define SQL_DIAG_SS_BASE (-1150) #define SQL_DIAG_SS_BASE (-1150)
#define SQL_DIAG_SS_MSGSTATE (SQL_DIAG_SS_BASE) #define SQL_DIAG_SS_MSGSTATE (SQL_DIAG_SS_BASE)
#define SQL_DIAG_SS_SEVERITY (SQL_DIAG_SS_BASE-1) #define SQL_DIAG_SS_SEVERITY (SQL_DIAG_SS_BASE-1)
#define SQL_DIAG_SS_SRVNAME (SQL_DIAG_SS_BASE-2) #define SQL_DIAG_SS_SRVNAME (SQL_DIAG_SS_BASE-2)
#define SQL_DIAG_SS_PROCNAME (SQL_DIAG_SS_BASE-3) #define SQL_DIAG_SS_PROCNAME (SQL_DIAG_SS_BASE-3)
#define SQL_DIAG_SS_LINE (SQL_DIAG_SS_BASE-4) #define SQL_DIAG_SS_LINE (SQL_DIAG_SS_BASE-4)
// SQLGetDiagField/SQL_DIAG_DYNAMIC_FUNCTION_CODE driver specific defines. // SQLGetDiagField/SQL_DIAG_DYNAMIC_FUNCTION_CODE driver specific defines.
// Microsoft has -200 thru -299 reserved for Microsoft ODBC Driver for SQL Server usage. // Microsoft has -200 thru -299 reserved for Microsoft ODBC Driver for SQL Server usage.
#define SQL_DIAG_DFC_SS_BASE (-200) #define SQL_DIAG_DFC_SS_BASE (-200)
#define SQL_DIAG_DFC_SS_ALTER_DATABASE (SQL_DIAG_DFC_SS_BASE-0) #define SQL_DIAG_DFC_SS_ALTER_DATABASE (SQL_DIAG_DFC_SS_BASE-0)
#define SQL_DIAG_DFC_SS_CHECKPOINT (SQL_DIAG_DFC_SS_BASE-1) #define SQL_DIAG_DFC_SS_CHECKPOINT (SQL_DIAG_DFC_SS_BASE-1)
#define SQL_DIAG_DFC_SS_CONDITION (SQL_DIAG_DFC_SS_BASE-2) #define SQL_DIAG_DFC_SS_CONDITION (SQL_DIAG_DFC_SS_BASE-2)
#define SQL_DIAG_DFC_SS_CREATE_DATABASE (SQL_DIAG_DFC_SS_BASE-3) #define SQL_DIAG_DFC_SS_CREATE_DATABASE (SQL_DIAG_DFC_SS_BASE-3)
#define SQL_DIAG_DFC_SS_CREATE_DEFAULT (SQL_DIAG_DFC_SS_BASE-4) #define SQL_DIAG_DFC_SS_CREATE_DEFAULT (SQL_DIAG_DFC_SS_BASE-4)
#define SQL_DIAG_DFC_SS_CREATE_PROCEDURE (SQL_DIAG_DFC_SS_BASE-5) #define SQL_DIAG_DFC_SS_CREATE_PROCEDURE (SQL_DIAG_DFC_SS_BASE-5)
#define SQL_DIAG_DFC_SS_CREATE_RULE (SQL_DIAG_DFC_SS_BASE-6) #define SQL_DIAG_DFC_SS_CREATE_RULE (SQL_DIAG_DFC_SS_BASE-6)
#define SQL_DIAG_DFC_SS_CREATE_TRIGGER (SQL_DIAG_DFC_SS_BASE-7) #define SQL_DIAG_DFC_SS_CREATE_TRIGGER (SQL_DIAG_DFC_SS_BASE-7)
#define SQL_DIAG_DFC_SS_CURSOR_DECLARE (SQL_DIAG_DFC_SS_BASE-8) #define SQL_DIAG_DFC_SS_CURSOR_DECLARE (SQL_DIAG_DFC_SS_BASE-8)
#define SQL_DIAG_DFC_SS_CURSOR_OPEN (SQL_DIAG_DFC_SS_BASE-9) #define SQL_DIAG_DFC_SS_CURSOR_OPEN (SQL_DIAG_DFC_SS_BASE-9)
#define SQL_DIAG_DFC_SS_CURSOR_FETCH (SQL_DIAG_DFC_SS_BASE-10) #define SQL_DIAG_DFC_SS_CURSOR_FETCH (SQL_DIAG_DFC_SS_BASE-10)
#define SQL_DIAG_DFC_SS_CURSOR_CLOSE (SQL_DIAG_DFC_SS_BASE-11) #define SQL_DIAG_DFC_SS_CURSOR_CLOSE (SQL_DIAG_DFC_SS_BASE-11)
#define SQL_DIAG_DFC_SS_DEALLOCATE_CURSOR (SQL_DIAG_DFC_SS_BASE-12) #define SQL_DIAG_DFC_SS_DEALLOCATE_CURSOR (SQL_DIAG_DFC_SS_BASE-12)
#define SQL_DIAG_DFC_SS_DBCC (SQL_DIAG_DFC_SS_BASE-13) #define SQL_DIAG_DFC_SS_DBCC (SQL_DIAG_DFC_SS_BASE-13)
#define SQL_DIAG_DFC_SS_DISK (SQL_DIAG_DFC_SS_BASE-14) #define SQL_DIAG_DFC_SS_DISK (SQL_DIAG_DFC_SS_BASE-14)
#define SQL_DIAG_DFC_SS_DROP_DATABASE (SQL_DIAG_DFC_SS_BASE-15) #define SQL_DIAG_DFC_SS_DROP_DATABASE (SQL_DIAG_DFC_SS_BASE-15)
#define SQL_DIAG_DFC_SS_DROP_DEFAULT (SQL_DIAG_DFC_SS_BASE-16) #define SQL_DIAG_DFC_SS_DROP_DEFAULT (SQL_DIAG_DFC_SS_BASE-16)
#define SQL_DIAG_DFC_SS_DROP_PROCEDURE (SQL_DIAG_DFC_SS_BASE-17) #define SQL_DIAG_DFC_SS_DROP_PROCEDURE (SQL_DIAG_DFC_SS_BASE-17)
#define SQL_DIAG_DFC_SS_DROP_RULE (SQL_DIAG_DFC_SS_BASE-18) #define SQL_DIAG_DFC_SS_DROP_RULE (SQL_DIAG_DFC_SS_BASE-18)
#define SQL_DIAG_DFC_SS_DROP_TRIGGER (SQL_DIAG_DFC_SS_BASE-19) #define SQL_DIAG_DFC_SS_DROP_TRIGGER (SQL_DIAG_DFC_SS_BASE-19)
#define SQL_DIAG_DFC_SS_DUMP_DATABASE (SQL_DIAG_DFC_SS_BASE-20) #define SQL_DIAG_DFC_SS_DUMP_DATABASE (SQL_DIAG_DFC_SS_BASE-20)
#define SQL_DIAG_DFC_SS_BACKUP_DATABASE (SQL_DIAG_DFC_SS_BASE-20) #define SQL_DIAG_DFC_SS_BACKUP_DATABASE (SQL_DIAG_DFC_SS_BASE-20)
#define SQL_DIAG_DFC_SS_DUMP_TABLE (SQL_DIAG_DFC_SS_BASE-21) #define SQL_DIAG_DFC_SS_DUMP_TABLE (SQL_DIAG_DFC_SS_BASE-21)
#define SQL_DIAG_DFC_SS_DUMP_TRANSACTION (SQL_DIAG_DFC_SS_BASE-22) #define SQL_DIAG_DFC_SS_DUMP_TRANSACTION (SQL_DIAG_DFC_SS_BASE-22)
#define SQL_DIAG_DFC_SS_BACKUP_TRANSACTION (SQL_DIAG_DFC_SS_BASE-22) #define SQL_DIAG_DFC_SS_BACKUP_TRANSACTION (SQL_DIAG_DFC_SS_BASE-22)
#define SQL_DIAG_DFC_SS_GOTO (SQL_DIAG_DFC_SS_BASE-23) #define SQL_DIAG_DFC_SS_GOTO (SQL_DIAG_DFC_SS_BASE-23)
#define SQL_DIAG_DFC_SS_INSERT_BULK (SQL_DIAG_DFC_SS_BASE-24) #define SQL_DIAG_DFC_SS_INSERT_BULK (SQL_DIAG_DFC_SS_BASE-24)
#define SQL_DIAG_DFC_SS_KILL (SQL_DIAG_DFC_SS_BASE-25) #define SQL_DIAG_DFC_SS_KILL (SQL_DIAG_DFC_SS_BASE-25)
#define SQL_DIAG_DFC_SS_LOAD_DATABASE (SQL_DIAG_DFC_SS_BASE-26) #define SQL_DIAG_DFC_SS_LOAD_DATABASE (SQL_DIAG_DFC_SS_BASE-26)
#define SQL_DIAG_DFC_SS_RESTORE_DATABASE (SQL_DIAG_DFC_SS_BASE-26) #define SQL_DIAG_DFC_SS_RESTORE_DATABASE (SQL_DIAG_DFC_SS_BASE-26)
#define SQL_DIAG_DFC_SS_LOAD_HEADERONLY (SQL_DIAG_DFC_SS_BASE-27) #define SQL_DIAG_DFC_SS_LOAD_HEADERONLY (SQL_DIAG_DFC_SS_BASE-27)
#define SQL_DIAG_DFC_SS_RESTORE_HEADERONLY (SQL_DIAG_DFC_SS_BASE-27) #define SQL_DIAG_DFC_SS_RESTORE_HEADERONLY (SQL_DIAG_DFC_SS_BASE-27)
#define SQL_DIAG_DFC_SS_LOAD_TABLE (SQL_DIAG_DFC_SS_BASE-28) #define SQL_DIAG_DFC_SS_LOAD_TABLE (SQL_DIAG_DFC_SS_BASE-28)
#define SQL_DIAG_DFC_SS_LOAD_TRANSACTION (SQL_DIAG_DFC_SS_BASE-29) #define SQL_DIAG_DFC_SS_LOAD_TRANSACTION (SQL_DIAG_DFC_SS_BASE-29)
#define SQL_DIAG_DFC_SS_RESTORE_TRANSACTION (SQL_DIAG_DFC_SS_BASE-29) #define SQL_DIAG_DFC_SS_RESTORE_TRANSACTION (SQL_DIAG_DFC_SS_BASE-29)
#define SQL_DIAG_DFC_SS_PRINT (SQL_DIAG_DFC_SS_BASE-30) #define SQL_DIAG_DFC_SS_PRINT (SQL_DIAG_DFC_SS_BASE-30)
#define SQL_DIAG_DFC_SS_RAISERROR (SQL_DIAG_DFC_SS_BASE-31) #define SQL_DIAG_DFC_SS_RAISERROR (SQL_DIAG_DFC_SS_BASE-31)
#define SQL_DIAG_DFC_SS_READTEXT (SQL_DIAG_DFC_SS_BASE-32) #define SQL_DIAG_DFC_SS_READTEXT (SQL_DIAG_DFC_SS_BASE-32)
#define SQL_DIAG_DFC_SS_RECONFIGURE (SQL_DIAG_DFC_SS_BASE-33) #define SQL_DIAG_DFC_SS_RECONFIGURE (SQL_DIAG_DFC_SS_BASE-33)
#define SQL_DIAG_DFC_SS_RETURN (SQL_DIAG_DFC_SS_BASE-34) #define SQL_DIAG_DFC_SS_RETURN (SQL_DIAG_DFC_SS_BASE-34)
#define SQL_DIAG_DFC_SS_SELECT_INTO (SQL_DIAG_DFC_SS_BASE-35) #define SQL_DIAG_DFC_SS_SELECT_INTO (SQL_DIAG_DFC_SS_BASE-35)
#define SQL_DIAG_DFC_SS_SET (SQL_DIAG_DFC_SS_BASE-36) #define SQL_DIAG_DFC_SS_SET (SQL_DIAG_DFC_SS_BASE-36)
#define SQL_DIAG_DFC_SS_SET_IDENTITY_INSERT (SQL_DIAG_DFC_SS_BASE-37) #define SQL_DIAG_DFC_SS_SET_IDENTITY_INSERT (SQL_DIAG_DFC_SS_BASE-37)
#define SQL_DIAG_DFC_SS_SET_ROW_COUNT (SQL_DIAG_DFC_SS_BASE-38) #define SQL_DIAG_DFC_SS_SET_ROW_COUNT (SQL_DIAG_DFC_SS_BASE-38)
#define SQL_DIAG_DFC_SS_SET_STATISTICS (SQL_DIAG_DFC_SS_BASE-39) #define SQL_DIAG_DFC_SS_SET_STATISTICS (SQL_DIAG_DFC_SS_BASE-39)
#define SQL_DIAG_DFC_SS_SET_TEXTSIZE (SQL_DIAG_DFC_SS_BASE-40) #define SQL_DIAG_DFC_SS_SET_TEXTSIZE (SQL_DIAG_DFC_SS_BASE-40)
#define SQL_DIAG_DFC_SS_SETUSER (SQL_DIAG_DFC_SS_BASE-41) #define SQL_DIAG_DFC_SS_SETUSER (SQL_DIAG_DFC_SS_BASE-41)
#define SQL_DIAG_DFC_SS_SHUTDOWN (SQL_DIAG_DFC_SS_BASE-42) #define SQL_DIAG_DFC_SS_SHUTDOWN (SQL_DIAG_DFC_SS_BASE-42)
#define SQL_DIAG_DFC_SS_TRANS_BEGIN (SQL_DIAG_DFC_SS_BASE-43) #define SQL_DIAG_DFC_SS_TRANS_BEGIN (SQL_DIAG_DFC_SS_BASE-43)
#define SQL_DIAG_DFC_SS_TRANS_COMMIT (SQL_DIAG_DFC_SS_BASE-44) #define SQL_DIAG_DFC_SS_TRANS_COMMIT (SQL_DIAG_DFC_SS_BASE-44)
#define SQL_DIAG_DFC_SS_TRANS_PREPARE (SQL_DIAG_DFC_SS_BASE-45) #define SQL_DIAG_DFC_SS_TRANS_PREPARE (SQL_DIAG_DFC_SS_BASE-45)
#define SQL_DIAG_DFC_SS_TRANS_ROLLBACK (SQL_DIAG_DFC_SS_BASE-46) #define SQL_DIAG_DFC_SS_TRANS_ROLLBACK (SQL_DIAG_DFC_SS_BASE-46)
#define SQL_DIAG_DFC_SS_TRANS_SAVE (SQL_DIAG_DFC_SS_BASE-47) #define SQL_DIAG_DFC_SS_TRANS_SAVE (SQL_DIAG_DFC_SS_BASE-47)
#define SQL_DIAG_DFC_SS_TRUNCATE_TABLE (SQL_DIAG_DFC_SS_BASE-48) #define SQL_DIAG_DFC_SS_TRUNCATE_TABLE (SQL_DIAG_DFC_SS_BASE-48)
#define SQL_DIAG_DFC_SS_UPDATE_STATISTICS (SQL_DIAG_DFC_SS_BASE-49) #define SQL_DIAG_DFC_SS_UPDATE_STATISTICS (SQL_DIAG_DFC_SS_BASE-49)
#define SQL_DIAG_DFC_SS_UPDATETEXT (SQL_DIAG_DFC_SS_BASE-50) #define SQL_DIAG_DFC_SS_UPDATETEXT (SQL_DIAG_DFC_SS_BASE-50)
#define SQL_DIAG_DFC_SS_USE (SQL_DIAG_DFC_SS_BASE-51) #define SQL_DIAG_DFC_SS_USE (SQL_DIAG_DFC_SS_BASE-51)
#define SQL_DIAG_DFC_SS_WAITFOR (SQL_DIAG_DFC_SS_BASE-52) #define SQL_DIAG_DFC_SS_WAITFOR (SQL_DIAG_DFC_SS_BASE-52)
#define SQL_DIAG_DFC_SS_WRITETEXT (SQL_DIAG_DFC_SS_BASE-53) #define SQL_DIAG_DFC_SS_WRITETEXT (SQL_DIAG_DFC_SS_BASE-53)
#define SQL_DIAG_DFC_SS_DENY (SQL_DIAG_DFC_SS_BASE-54) #define SQL_DIAG_DFC_SS_DENY (SQL_DIAG_DFC_SS_BASE-54)
#define SQL_DIAG_DFC_SS_SET_XCTLVL (SQL_DIAG_DFC_SS_BASE-55) #define SQL_DIAG_DFC_SS_SET_XCTLVL (SQL_DIAG_DFC_SS_BASE-55)
#define SQL_DIAG_DFC_SS_MERGE (SQL_DIAG_DFC_SS_BASE-56) #define SQL_DIAG_DFC_SS_MERGE (SQL_DIAG_DFC_SS_BASE-56)
// Severity codes for SQL_DIAG_SS_SEVERITY // Severity codes for SQL_DIAG_SS_SEVERITY
#define EX_ANY 0 #define EX_ANY 0
#define EX_INFO 10 #define EX_INFO 10
#define EX_MAXISEVERITY EX_INFO #define EX_MAXISEVERITY EX_INFO
#define EX_MISSING 11 #define EX_MISSING 11
#define EX_TYPE 12 #define EX_TYPE 12
#define EX_DEADLOCK 13 #define EX_DEADLOCK 13
#define EX_PERMIT 14 #define EX_PERMIT 14
#define EX_SYNTAX 15 #define EX_SYNTAX 15
#define EX_USER 16 #define EX_USER 16
#define EX_RESOURCE 17 #define EX_RESOURCE 17
#define EX_INTOK 18 #define EX_INTOK 18
#define MAXUSEVERITY EX_INTOK #define MAXUSEVERITY EX_INTOK
#define EX_LIMIT 19 #define EX_LIMIT 19
#define EX_CMDFATAL 20 #define EX_CMDFATAL 20
#define MINFATALERR EX_CMDFATAL #define MINFATALERR EX_CMDFATAL
#define EX_DBFATAL 21 #define EX_DBFATAL 21
#define EX_TABCORRUPT 22 #define EX_TABCORRUPT 22
#define EX_DBCORRUPT 23 #define EX_DBCORRUPT 23
#define EX_HARDWARE 24 #define EX_HARDWARE 24
#define EX_CONTROL 25 #define EX_CONTROL 25
// Data is defined to be past the end of the structure header. // Data is defined to be past the end of the structure header.
// This is accepted by MSVC, GCC, and C99 standard but former emits // This is accepted by MSVC, GCC, and C99 standard but former emits
// unnecessary warning, hence it has to be disabled. // unnecessary warning, hence it has to be disabled.
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma warning(push) #pragma warning(push)
#pragma warning(disable:4200) #pragma warning(disable:4200)
#endif #endif
// Communication between the driver and application via the CEKeystoreData structure // Communication between the driver and application via the CEKeystoreData structure
typedef struct CEKeystoreData typedef struct CEKeystoreData
{ {
wchar_t *name; wchar_t *name;
unsigned int dataSize; unsigned int dataSize;
char data[]; char data[];
} CEKEYSTOREDATA; } CEKEYSTOREDATA;
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma warning(pop) #pragma warning(pop)
#endif #endif
// The following constants are for the Azure Key Vault configuration interface // The following constants are for the Azure Key Vault configuration interface
#define AKV_CONFIG_FLAGS 0 #define AKV_CONFIG_FLAGS 0
#define AKVCFG_AUTHMODE 0x0000000F #define AKVCFG_AUTHMODE 0x0000000F
#define AKVCFG_AUTHMODE_ACCESSTOKEN 0 #define AKVCFG_AUTHMODE_ACCESSTOKEN 0
#define AKVCFG_AUTHMODE_CLIENTKEY 1 #define AKVCFG_AUTHMODE_CLIENTKEY 1
#define AKVCFG_AUTHMODE_PASSWORD 2 #define AKVCFG_AUTHMODE_PASSWORD 2
#define AKVCFG_AUTHMODE_INTEGRATED 3 #define AKVCFG_AUTHMODE_INTEGRATED 3
#define AKVCFG_AUTHMODE_CERTIFICATE 4 #define AKVCFG_AUTHMODE_CERTIFICATE 4
#define AKVCFG_NOAUTORENEW 0x00000010 #define AKVCFG_NOAUTORENEW 0x00000010
#define AKV_CONFIG_PRINCIPALID 1 #define AKV_CONFIG_PRINCIPALID 1
#define AKV_CONFIG_AUTHSECRET 2 #define AKV_CONFIG_AUTHSECRET 2
#define AKV_CONFIG_ACCESSTOKEN 3 #define AKV_CONFIG_ACCESSTOKEN 3
#define AKV_CONFIG_TOKENEXPIRY 4 #define AKV_CONFIG_TOKENEXPIRY 4
#define AKV_CONFIG_MAXRETRIES 5 #define AKV_CONFIG_MAXRETRIES 5
#define AKV_CONFIG_RETRYTIMEOUT 6 #define AKV_CONFIG_RETRYTIMEOUT 6
#define AKV_CONFIG_RETRYWAIT 7 #define AKV_CONFIG_RETRYWAIT 7
#define AKV_CONFIG_RESET 255 #define AKV_CONFIG_RESET 255
#endif // __msodbcsql_h__ #endif // __msodbcsql_h__

View file

@ -3,7 +3,7 @@
// //
// Contents: Contains the minimal definitions to build on non-Windows platforms // Contents: Contains the minimal definitions to build on non-Windows platforms
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -1,7 +1,7 @@
//--------------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------
// File: typedefs_for_linux.h // File: typedefs_for_linux.h
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -4,7 +4,7 @@
// File: version.h // File: version.h
// Contents: Version number constants // Contents: Version number constants
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License
@ -26,8 +26,8 @@
// Increase Major number with backward incompatible breaking changes. // Increase Major number with backward incompatible breaking changes.
// Increase Minor with backward compatible new functionalities and API changes. // Increase Minor with backward compatible new functionalities and API changes.
// Increase Patch for backward compatible fixes. // Increase Patch for backward compatible fixes.
#define SQLVERSION_MAJOR 4 #define SQLVERSION_MAJOR 5
#define SQLVERSION_MINOR 3 #define SQLVERSION_MINOR 0
#define SQLVERSION_PATCH 0 #define SQLVERSION_PATCH 0
#define SQLVERSION_BUILD 0 #define SQLVERSION_BUILD 0
@ -35,7 +35,7 @@
// for stable releases should be empty // for stable releases should be empty
// "-RC" for release candidates // "-RC" for release candidates
// "-preview" for ETP // "-preview" for ETP
#define SEMVER_PRERELEASE #define SEMVER_PRERELEASE "-preview"
// Semantic versioning build metadata, build meta data is not counted in precedence order. // Semantic versioning build metadata, build meta data is not counted in precedence order.
#define SEMVER_BUILDMETA #define SEMVER_BUILDMETA

View file

@ -3,7 +3,7 @@
// //
// Contents: include for definition of Windows types for non-Windows platforms // Contents: include for definition of Windows types for non-Windows platforms
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -4,7 +4,7 @@
// Contents: This module defines helper functions to prevent // Contents: This module defines helper functions to prevent
// integer overflow bugs. // integer overflow bugs.
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Contains the minimal definitions to build on non-Windows platforms // Contents: Contains the minimal definitions to build on non-Windows platforms
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Contains the minimal definitions to build on non-Windows platforms // Contents: Contains the minimal definitions to build on non-Windows platforms
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: JScript build configuration used by buildconf.bat // Contents: JScript build configuration used by buildconf.bat
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Routines that use connection handles // Contents: Routines that use connection handles
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -2,7 +2,7 @@
// File: init.cpp // File: init.cpp
// Contents: initialization routines for the extension // Contents: initialization routines for the extension
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -8,7 +8,7 @@
// //
// Comments: Also contains "internal" declarations shared across source files. // Comments: Also contains "internal" declarations shared across source files.
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Routines that use statement handles // Contents: Routines that use statement handles
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -3,7 +3,7 @@
// //
// Contents: Version resource // Contents: Version resource
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -5,7 +5,7 @@
// //
// Comments: Mostly error handling and some type handling // Comments: Mostly error handling and some type handling
// //
// Microsoft Drivers 4.3 for PHP for SQL Server // Microsoft Drivers 5.0 for PHP for SQL Server
// Copyright(c) Microsoft Corporation // Copyright(c) Microsoft Corporation
// All rights reserved. // All rights reserved.
// MIT License // MIT License

View file

@ -40,4 +40,4 @@ $marsMode = true;
$dsnMode = true; $dsnMode = true;
$traceEnabled = false; $traceEnabled = false;
?> ?>

View file

@ -0,0 +1,61 @@
--TEST--
Provide name in lastInsertId to retrieve the last sequence number
--SKIPIF--
--FILE--
<?php
require_once("MsCommon.inc");
require_once("MsSetup.inc");
try{
$database = "tempdb";
$conn = new PDO("sqlsrv:Server=$server;Database=$databaseName", $uid, $pwd);
// sequence is only supported in SQL server 2012 and up (or version 11 and up)
// Output Done once the server version is found to be < 11
$version_arr = explode(".", $conn->getAttribute(PDO::ATTR_SERVER_VERSION));
if ($version_arr[0] < 11) {
echo "Done\n";
}
else {
$tableName1 = GetTempTableName('tab1', false);
$tableName2 = GetTempTableName('tab2', false);
$sequenceName = 'sequence1';
$stmt = $conn->query("IF OBJECT_ID('$sequenceName', 'SO') IS NOT NULL DROP SEQUENCE $sequenceName");
$sql = "CREATE TABLE $tableName1 (seqnum INTEGER NOT NULL PRIMARY KEY, SomeNumber INT)";
$stmt = $conn->query($sql);
$sql = "CREATE TABLE $tableName2 (ID INT IDENTITY(1,2), SomeValue char(10))";
$stmt = $conn->query($sql);
$sql = "CREATE SEQUENCE $sequenceName AS INTEGER START WITH 1 INCREMENT BY 1 MINVALUE 1 MAXVALUE 100 CYCLE";
$stmt = $conn->query($sql);
$ret = $conn->exec("INSERT INTO $tableName1 VALUES( NEXT VALUE FOR $sequenceName, 20 )");
$ret = $conn->exec("INSERT INTO $tableName1 VALUES( NEXT VALUE FOR $sequenceName, 40 )");
$ret = $conn->exec("INSERT INTO $tableName1 VALUES( NEXT VALUE FOR $sequenceName, 60 )");
$ret = $conn->exec("INSERT INTO $tableName2 VALUES( '20' )");
// return the last sequence number is sequence name is provided
$lastSeq = $conn->lastInsertId($sequenceName);
// defaults to $tableName2 -- because it returns the last inserted id value
$lastRow = $conn->lastInsertId();
if ($lastSeq == 3 && $lastRow == 1) {
echo "Done\n";
}
else {
echo "sequence value or identity does not match as expected\n";
}
$stmt = $conn->query("DROP TABLE $tableName1");
$stmt = $conn->query("DROP TABLE $tableName2");
$stmt = $conn->query("DROP SEQUENCE $sequenceName");
$stmt = null;
}
$conn = null;
}
catch (Exception $e){
echo "Exception $e\n";
}
?>
--EXPECT--
Done

View file

@ -0,0 +1,64 @@
--TEST--
LastInsertId returns the last sequences operating on the same table
--SKIPIF--
--FILE--
<?php
require_once("MsCommon.inc");
require_once("MsSetup.inc");
try{
$database = "tempdb";
$conn = new PDO("sqlsrv:Server=$server;Database=$databaseName", $uid, $pwd);
// sequence is only supported in SQL server 2012 and up (or version 11 and up)
// Output Done once the server version is found to be < 11
$version_arr = explode(".", $conn->getAttribute(PDO::ATTR_SERVER_VERSION));
if ($version_arr[0] < 11) {
echo "Done\n";
}
else {
$tableName = GetTempTableName('tab', false);
$sequence1 = 'sequence1';
$sequence2 = 'sequenceNeg1';
$stmt = $conn->query("IF OBJECT_ID('$sequence1', 'SO') IS NOT NULL DROP SEQUENCE $sequence1");
$stmt = $conn->query("IF OBJECT_ID('$sequence2', 'SO') IS NOT NULL DROP SEQUENCE $sequence2");
$sql = "CREATE TABLE $tableName (ID INT IDENTITY(1,1), SeqNumInc INTEGER NOT NULL PRIMARY KEY, SomeNumber INT)";
$stmt = $conn->query($sql);
$sql = "CREATE SEQUENCE $sequence1 AS INTEGER START WITH 1 INCREMENT BY 1 MINVALUE 1 MAXVALUE 100";
$stmt = $conn->query($sql);
$sql = "CREATE SEQUENCE $sequence2 AS INTEGER START WITH 200 INCREMENT BY -1 MINVALUE 101 MAXVALUE 200";
$stmt = $conn->query($sql);
$ret = $conn->exec("INSERT INTO $tableName VALUES( NEXT VALUE FOR $sequence1, 20 )");
$ret = $conn->exec("INSERT INTO $tableName VALUES( NEXT VALUE FOR $sequence2, 180 )");
$ret = $conn->exec("INSERT INTO $tableName VALUES( NEXT VALUE FOR $sequence1, 40 )");
$ret = $conn->exec("INSERT INTO $tableName VALUES( NEXT VALUE FOR $sequence2, 160 )");
$ret = $conn->exec("INSERT INTO $tableName VALUES( NEXT VALUE FOR $sequence1, 60 )");
$ret = $conn->exec("INSERT INTO $tableName VALUES( NEXT VALUE FOR $sequence2, 140 )");
// return the last sequence number of 'sequence1'
$lastSeq1 = $conn->lastInsertId($sequence1);
// return the last sequence number of 'sequenceNeg1'
$lastSeq2 = $conn->lastInsertId($sequence2);
// providing a table name in lastInsertId should return an empty string
$lastSeq3 = $conn->lastInsertId($tableName);
if ($lastSeq1 == 3 && $lastSeq2 == 198 && $lastSeq3 == "") {
echo "Done\n";
}
$stmt = $conn->query("DROP TABLE $tableName");
$stmt = $conn->query("DROP SEQUENCE $sequence1");
$stmt = $conn->query("DROP SEQUENCE $sequence2");
$stmt = null;
}
$conn = null;
}
catch (Exception $e){
echo "Exception $e\n";
}
?>
--EXPECT--
Done