From d13d9c6047a70138d700f28a725ef352f0bead59 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Tue, 25 May 2004 18:33:51 +0000 Subject: [PATCH] Allow setting the cursor name for ODBC statements, so that: UPDATE foo set .... WHERE CURRENT OF statements will work. --- ext/pdo_odbc/odbc_stmt.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c index 40d2245a84..be8d775ba0 100755 --- a/ext/pdo_odbc/odbc_stmt.c +++ b/ext/pdo_odbc/odbc_stmt.c @@ -214,13 +214,42 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned l } } +static int odbc_stmt_set_param(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC) +{ + SQLRETURN rc; + pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; + + switch (attr) { + case PDO_ATTR_CURSOR_NAME: + convert_to_string(val); + rc = SQLSetCursorName(S->stmt, Z_STRVAL_P(val), Z_STRLEN_P(val)); + + if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) { + return 1; + } + pdo_odbc_stmt_error("SQLFetch"); + return 0; + + default: + strcpy(S->einfo.last_err_msg, "Unknown Attribute"); + S->einfo.what = "setAttribute"; + stmt->error_code = PDO_ERR_NOT_IMPLEMENTED; + S->einfo.last_state[0] = '\0'; + return -1; + } + + +} + struct pdo_stmt_methods odbc_stmt_methods = { odbc_stmt_dtor, odbc_stmt_execute, odbc_stmt_fetch, odbc_stmt_describe, odbc_stmt_get_col, - odbc_stmt_param_hook + odbc_stmt_param_hook, + odbc_stmt_set_param, + NULL }; /* -- 2.50.1