@@ -938,7 +938,11 @@ PHP_FUNCTION(odbc_prepare)
938938 /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other
939939 type if not possible.
940940 */
941+ # if defined(ODBCVER ) && (ODBCVER >= 0x0300 )
942+ SQLSetStmtAttr (result -> stmt , SQL_ATTR_CURSOR_TYPE , (SQLPOINTER ) ODBCG (default_cursortype ), 0 );
943+ # else
941944 SQLSetStmtOption (result -> stmt , SQL_CURSOR_TYPE , ODBCG (default_cursortype ));
945+ # endif
942946 }
943947 } else {
944948 result -> fetch_abs = 0 ;
@@ -1326,7 +1330,11 @@ PHP_FUNCTION(odbc_exec)
13261330 /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other
13271331 type if not possible.
13281332 */
1333+ # if defined(ODBCVER ) && (ODBCVER >= 0x0300 )
1334+ SQLSetStmtAttr (result -> stmt , SQL_ATTR_CURSOR_TYPE , (SQLPOINTER ) ODBCG (default_cursortype ), 0 );
1335+ # else
13291336 SQLSetStmtOption (result -> stmt , SQL_CURSOR_TYPE , ODBCG (default_cursortype ));
1337+ # endif
13301338 }
13311339 } else {
13321340 result -> fetch_abs = 0 ;
@@ -2170,7 +2178,11 @@ bool odbc_sqlconnect(zval *zv, char *db, char *uid, char *pwd, int cur_opt, bool
21702178 }
21712179#else
21722180 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
21732184 rc = SQLSetConnectOption (link -> connection -> hdbc , SQL_ODBC_CURSORS , cur_opt );
2185+ # endif
21742186 if (rc != SQL_SUCCESS ) { /* && rc != SQL_SUCCESS_WITH_INFO ? */
21752187 odbc_sql_error (link -> connection , SQL_NULL_HSTMT , "SQLSetConnectOption" );
21762188 return false;
@@ -2672,7 +2684,11 @@ PHP_FUNCTION(odbc_autocommit)
26722684 CHECK_ODBC_CONNECTION (conn );
26732685
26742686 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
26752690 rc = SQLSetConnectOption (conn -> hdbc , SQL_AUTOCOMMIT , pv_onoff ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF );
2691+ #endif
26762692 if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO ) {
26772693 odbc_sql_error (conn , SQL_NULL_HSTMT , "Set autocommit" );
26782694 RETURN_FALSE ;
@@ -2681,7 +2697,11 @@ PHP_FUNCTION(odbc_autocommit)
26812697 } else {
26822698 SQLINTEGER status ;
26832699
2700+ #if defined(ODBCVER ) && (ODBCVER >= 0x0300 )
2701+ rc = SQLGetConnectAttr (conn -> hdbc , SQL_ATTR_AUTOCOMMIT , & status , SQL_IS_INTEGER , NULL );
2702+ #else
26842703 rc = SQLGetConnectOption (conn -> hdbc , SQL_AUTOCOMMIT , (PTR )& status );
2704+ #endif
26852705 if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO ) {
26862706 odbc_sql_error (conn , SQL_NULL_HSTMT , "Get commit status" );
26872707 RETURN_FALSE ;
@@ -2783,7 +2803,11 @@ PHP_FUNCTION(odbc_setoption)
27832803 php_error_docref (NULL , E_WARNING , "Unable to set option for persistent connection" );
27842804 RETURN_FALSE ;
27852805 }
2806+ # if defined(ODBCVER ) && (ODBCVER >= 0x0300 )
2807+ rc = SQLSetConnectAttr (link -> connection -> hdbc , pv_opt , (SQLPOINTER ) pv_val , 0 );
2808+ # else
27862809 rc = SQLSetConnectOption (link -> connection -> hdbc , (unsigned short ) pv_opt , pv_val );
2810+ # endif
27872811 if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO ) {
27882812 odbc_sql_error (link -> connection , SQL_NULL_HSTMT , "SetConnectOption" );
27892813 RETURN_FALSE ;
@@ -2797,7 +2821,11 @@ PHP_FUNCTION(odbc_setoption)
27972821 result = Z_ODBC_RESULT_P (pv_handle );
27982822 CHECK_ODBC_RESULT (result );
27992823
2824+ # if defined(ODBCVER ) && (ODBCVER >= 0x0300 )
2825+ rc = SQLSetStmtAttr (result -> stmt , pv_opt , (SQLPOINTER ) pv_val , 0 );
2826+ # else
28002827 rc = SQLSetStmtOption (result -> stmt , (unsigned short ) pv_opt , pv_val );
2828+ # endif
28012829
28022830 if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO ) {
28032831 odbc_sql_error (result -> conn_ptr , result -> stmt , "SetStmtOption" );
0 commit comments