@@ -938,7 +938,11 @@ PHP_FUNCTION(odbc_prepare)
938
938
/* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other
939
939
type if not possible.
940
940
*/
941
+ # if defined(ODBCVER ) && (ODBCVER >= 0x0300 )
942
+ SQLSetStmtAttr (result -> stmt , SQL_ATTR_CURSOR_TYPE , (SQLPOINTER ) ODBCG (default_cursortype ), 0 );
943
+ # else
941
944
SQLSetStmtOption (result -> stmt , SQL_CURSOR_TYPE , ODBCG (default_cursortype ));
945
+ # endif
942
946
}
943
947
} else {
944
948
result -> fetch_abs = 0 ;
@@ -1326,7 +1330,11 @@ PHP_FUNCTION(odbc_exec)
1326
1330
/* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other
1327
1331
type if not possible.
1328
1332
*/
1333
+ # if defined(ODBCVER ) && (ODBCVER >= 0x0300 )
1334
+ SQLSetStmtAttr (result -> stmt , SQL_ATTR_CURSOR_TYPE , (SQLPOINTER ) ODBCG (default_cursortype ), 0 );
1335
+ # else
1329
1336
SQLSetStmtOption (result -> stmt , SQL_CURSOR_TYPE , ODBCG (default_cursortype ));
1337
+ # endif
1330
1338
}
1331
1339
} else {
1332
1340
result -> fetch_abs = 0 ;
@@ -2170,7 +2178,11 @@ bool odbc_sqlconnect(zval *zv, char *db, char *uid, char *pwd, int cur_opt, bool
2170
2178
}
2171
2179
#else
2172
2180
if (cur_opt != SQL_CUR_DEFAULT ) {
2181
+ # if defined(ODBCVER ) && (ODBCVER >= 0x0300 )
2182
+ rc = SQLSetConnectAttr (link -> connection -> hdbc , SQL_ATTR_ODBC_CURSORS , (SQLPOINTER ) (intptr_t ) cur_opt , 0 );
2183
+ # else
2173
2184
rc = SQLSetConnectOption (link -> connection -> hdbc , SQL_ODBC_CURSORS , cur_opt );
2185
+ # endif
2174
2186
if (rc != SQL_SUCCESS ) { /* && rc != SQL_SUCCESS_WITH_INFO ? */
2175
2187
odbc_sql_error (link -> connection , SQL_NULL_HSTMT , "SQLSetConnectOption" );
2176
2188
return false;
@@ -2672,7 +2684,11 @@ PHP_FUNCTION(odbc_autocommit)
2672
2684
CHECK_ODBC_CONNECTION (conn );
2673
2685
2674
2686
if (!pv_onoff_is_null ) {
2687
+ #if defined(ODBCVER ) && (ODBCVER >= 0x0300 )
2688
+ rc = SQLSetConnectAttr (conn -> hdbc , SQL_ATTR_AUTOCOMMIT , (SQLPOINTER ) (intptr_t ) (pv_onoff ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF ), 0 );
2689
+ #else
2675
2690
rc = SQLSetConnectOption (conn -> hdbc , SQL_AUTOCOMMIT , pv_onoff ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF );
2691
+ #endif
2676
2692
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO ) {
2677
2693
odbc_sql_error (conn , SQL_NULL_HSTMT , "Set autocommit" );
2678
2694
RETURN_FALSE ;
@@ -2681,7 +2697,11 @@ PHP_FUNCTION(odbc_autocommit)
2681
2697
} else {
2682
2698
SQLINTEGER status ;
2683
2699
2700
+ #if defined(ODBCVER ) && (ODBCVER >= 0x0300 )
2701
+ rc = SQLGetConnectAttr (conn -> hdbc , SQL_ATTR_AUTOCOMMIT , & status , SQL_IS_INTEGER , NULL );
2702
+ #else
2684
2703
rc = SQLGetConnectOption (conn -> hdbc , SQL_AUTOCOMMIT , (PTR )& status );
2704
+ #endif
2685
2705
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO ) {
2686
2706
odbc_sql_error (conn , SQL_NULL_HSTMT , "Get commit status" );
2687
2707
RETURN_FALSE ;
@@ -2783,7 +2803,11 @@ PHP_FUNCTION(odbc_setoption)
2783
2803
php_error_docref (NULL , E_WARNING , "Unable to set option for persistent connection" );
2784
2804
RETURN_FALSE ;
2785
2805
}
2806
+ # if defined(ODBCVER ) && (ODBCVER >= 0x0300 )
2807
+ rc = SQLSetConnectAttr (link -> connection -> hdbc , pv_opt , (SQLPOINTER ) pv_val , 0 );
2808
+ # else
2786
2809
rc = SQLSetConnectOption (link -> connection -> hdbc , (unsigned short ) pv_opt , pv_val );
2810
+ # endif
2787
2811
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO ) {
2788
2812
odbc_sql_error (link -> connection , SQL_NULL_HSTMT , "SetConnectOption" );
2789
2813
RETURN_FALSE ;
@@ -2797,7 +2821,11 @@ PHP_FUNCTION(odbc_setoption)
2797
2821
result = Z_ODBC_RESULT_P (pv_handle );
2798
2822
CHECK_ODBC_RESULT (result );
2799
2823
2824
+ # if defined(ODBCVER ) && (ODBCVER >= 0x0300 )
2825
+ rc = SQLSetStmtAttr (result -> stmt , pv_opt , (SQLPOINTER ) pv_val , 0 );
2826
+ # else
2800
2827
rc = SQLSetStmtOption (result -> stmt , (unsigned short ) pv_opt , pv_val );
2828
+ # endif
2801
2829
2802
2830
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO ) {
2803
2831
odbc_sql_error (result -> conn_ptr , result -> stmt , "SetStmtOption" );
0 commit comments