return row_count;
}
-static int odbc_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen TSRMLS_DC)
+static int odbc_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type param_type TSRMLS_DC)
{
pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
return 1;
}
+static int odbc_handle_get_attr(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC)
+{
+ switch (attr) {
+ case PDO_ATTR_CLIENT_VERSION:
+ ZVAL_STRING(val, "ODBC-" PDO_ODBC_TYPE, 1);
+ return 1;
+
+ case PDO_ATTR_SERVER_VERSION:
+ case PDO_ATTR_PREFETCH:
+ case PDO_ATTR_TIMEOUT:
+ case PDO_ATTR_SERVER_INFO:
+ case PDO_ATTR_CONNECTION_STATUS:
+ break;
+ }
+ return 0;
+}
static struct pdo_dbh_methods odbc_methods = {
odbc_handle_closer,
NULL, /* set attr */
NULL, /* last id */
pdo_odbc_fetch_error_func,
- NULL, /* get attr */
+ odbc_handle_get_attr, /* get attr */
NULL, /* check_liveness */
};
}
}
+static int odbc_stmt_get_attr(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:
+ {
+ char buf[256];
+ SQLSMALLINT len = 0;
+ rc = SQLGetCursorName(S->stmt, buf, sizeof(buf), &len);
+
+ if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) {
+ ZVAL_STRINGL(val, buf, len, 1);
+ return 1;
+ }
+ pdo_odbc_stmt_error("SQLGetCursorName");
+ return 0;
+ }
+
+ default:
+ strcpy(S->einfo.last_err_msg, "Unknown Attribute");
+ S->einfo.what = "getAttribute";
+ strcpy(S->einfo.last_state, "IM0001");
+ return -1;
+ }
+}
+
static int odbc_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC)
{
SQLRETURN rc;
odbc_stmt_get_col,
odbc_stmt_param_hook,
odbc_stmt_set_param,
- NULL, /* get attr */
+ odbc_stmt_get_attr, /* get attr */
NULL, /* get column meta */
odbc_stmt_next_rowset
};