Index: driver/catalog.c =================================================================== --- driver/catalog.c (revision 1054) +++ driver/catalog.c (working copy) @@ -2090,25 +2090,70 @@ } -/* - @type : ODBC 1.0 API - @purpose : returns the list of input and output parameters, as well as - the columns that make up the result set for the specified - procedures. The driver returns the information as a result - set on the specified statement -*/ - -SQLRETURN SQL_API -SQLProcedureColumns(SQLHSTMT hstmt, - SQLCHAR FAR *szProcQualifier __attribute__((unused)), - SQLSMALLINT cbProcQualifier __attribute__((unused)), - SQLCHAR FAR *szProcOwner __attribute__((unused)), - SQLSMALLINT cbProcOwner __attribute__((unused)), - SQLCHAR FAR *szProcName __attribute__((unused)), - SQLSMALLINT cbProcName __attribute__((unused)), - SQLCHAR FAR *szColumnName __attribute__((unused)), - SQLSMALLINT cbColumnName __attribute__((unused))) -{ - return set_error(hstmt, MYERR_S1000, - "Driver doesn't support this yet", 4000); -} +/* +**************************************************************************** +SQLProcedure Columns +**************************************************************************** +*/ + +char *SQLPROCEDURECOLUMNS_values[]= { + "", "", NullS, NullS, "", "", "", + "", "", "", "10", "", + "MySQL column", "", "", NullS, "", + NullS, "" +}; + +MYSQL_FIELD SQLPROCEDURECOLUMNS_fields[]= +{ + MYODBC_FIELD_STRING("PROCEDURE_CAT", NAME_LEN, 0), + MYODBC_FIELD_STRING("PROCEDURE_SCHEM", NAME_LEN, 0), + MYODBC_FIELD_STRING("PROCEDURE_NAME", NAME_LEN, NOT_NULL_FLAG), + MYODBC_FIELD_STRING("COLUMN_NAME", NAME_LEN, NOT_NULL_FLAG), + MYODBC_FIELD_SHORT ("COLUMN_TYPE", NOT_NULL_FLAG), + MYODBC_FIELD_SHORT ("DATA_TYPE", NOT_NULL_FLAG), + MYODBC_FIELD_STRING("TYPE_NAME", 20, NOT_NULL_FLAG), + MYODBC_FIELD_LONG ("COLUMN_SIZE", 0), + MYODBC_FIELD_LONG ("BUFFER_LENGTH", 0), + MYODBC_FIELD_SHORT ("DECIMAL_DIGITS", 0), + MYODBC_FIELD_SHORT ("NUM_PREC_RADIX", 0), + MYODBC_FIELD_SHORT ("NULLABLE", NOT_NULL_FLAG), + MYODBC_FIELD_STRING("REMARKS", NAME_LEN, 0), + MYODBC_FIELD_STRING("COLUMN_DEF", NAME_LEN, 0), + MYODBC_FIELD_SHORT ("SQL_DATA_TYPE", NOT_NULL_FLAG), + MYODBC_FIELD_SHORT ("SQL_DATETIME_SUB", 0), + MYODBC_FIELD_LONG ("CHAR_OCTET_LENGTH", 0), + MYODBC_FIELD_LONG ("ORDINAL_POSITION", NOT_NULL_FLAG), + MYODBC_FIELD_STRING("IS_NULLABLE", 3, 0), +}; + +const uint SQLPROCEDURECOLUMNS_FIELDS= + array_elements(SQLPROCEDURECOLUMNS_fields); + +/* + @type : ODBC 1.0 API + @purpose : returns the list of input and output parameters, as well as + the columns that make up the result set for the specified + procedures. The driver returns the information as a result + set on the specified statement +*/ + +SQLRETURN SQL_API +SQLProcedureColumns(SQLHSTMT hstmt, + SQLCHAR FAR *szProcQualifier __attribute__((unused)), + SQLSMALLINT cbProcQualifier __attribute__((unused)), + SQLCHAR FAR *szProcOwner __attribute__((unused)), + SQLSMALLINT cbProcOwner __attribute__((unused)), + SQLCHAR FAR *szProcName __attribute__((unused)), + SQLSMALLINT cbProcName __attribute__((unused)), + SQLCHAR FAR *szColumnName __attribute__((unused)), + SQLSMALLINT cbColumnName __attribute__((unused))) +{ + create_empty_fake_resultset(hstmt, SQLPROCEDURECOLUMNS_values, + sizeof(SQLPROCEDURECOLUMNS_values), + SQLPROCEDURECOLUMNS_fields, + SQLPROCEDURECOLUMNS_FIELDS); + + return set_error(hstmt, MYERR_01000, + "MySQL server does not provide the requested information", + 4000); +} Index: driver/info.c =================================================================== --- driver/info.c (revision 1054) +++ driver/info.c (working copy) @@ -1212,7 +1212,7 @@ SQL_API_SQLNUMPARAMS, SQL_API_SQLPARAMOPTIONS, SQL_API_SQLPRIMARYKEYS, - /* SQL_API_SQLPROCEDURECOLUMNS, */ + SQL_API_SQLPROCEDURECOLUMNS, SQL_API_SQLPROCEDURES, SQL_API_SQLSETPOS, SQL_API_SQLSETSCROLLOPTIONS, Index: test/my_info.c =================================================================== --- test/my_info.c (revision 1054) +++ test/my_info.c (working copy) @@ -117,18 +117,6 @@ /** - Bug #27591: SQLProcedureColumns ]Driver doesn't support this yet -*/ -DECLARE_TEST(t_bug27591) -{ - SQLUSMALLINT supported= SQL_TRUE; - ok_con(hdbc, SQLGetFunctions(hdbc, SQL_API_SQLPROCEDURECOLUMNS, &supported)); - is_num(supported, SQL_FALSE); - return OK; -} - - -/** Bug #28657: ODBC Connector returns FALSE on SQLGetTypeInfo with DATETIME (wxWindows latest) */ DECLARE_TEST(t_bug28657) @@ -287,7 +275,6 @@ ADD_TEST(t_gettypeinfo) ADD_TEST(t_stmt_attr_status) ADD_TEST(t_msdev_bug) - ADD_TEST(t_bug27591) ADD_TEST(t_bug28657) ADD_TEST(t_bug14639) ADD_TEST(t_bug31055) Index: test/my_catalog.c =================================================================== --- test/my_catalog.c (revision 1054) +++ test/my_catalog.c (working copy) @@ -1153,6 +1153,28 @@ } +/* + Bug #33298 ADO returns wrong parameter count + in the query (always 0) +*/ +DECLARE_TEST(t_bug33298) +{ + SQLRETURN rc= 0; + expect_stmt(hstmt, SQLProcedureColumns(hstmt, 0, NULL, 0, NULL, + 0, NULL, 0, NULL), + SQL_SUCCESS_WITH_INFO); + rc= SQLFetch(hstmt); + /** + SQL_NO_DATA is ok for the current implementation, + SQL_SUCCESS should be ok for when SQLProcedureColumns is implemented + */ + if(rc == SQL_ERROR) + return FAIL; + + return OK; +} + + BEGIN_TESTS ADD_TEST(my_columns_null) ADD_TEST(my_drop_table) @@ -1176,6 +1198,7 @@ ADD_TEST(t_bug29888) ADD_TEST(t_bug14407) ADD_TEST(t_bug32864) + ADD_TEST(t_bug33298) END_TESTS