trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zellerh <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request: [TRAFODION-1727]Fixes for Databa...
Date Mon, 04 Jan 2016 21:05:37 GMT
Github user zellerh commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/244#discussion_r48781035
  
    --- Diff: core/conn/jdbc_type2/native/SrvrCommon.cpp ---
    @@ -1634,6 +1634,94 @@ short do_ExecSMD(
                             tableParam[0], inputParam[0], inputParam[1],
                             inputParam[2], inputParam[3]);
                         break;
    +                case SQL_API_SQLPROCEDURES:
    +                    if ((!checkIfWildCard(catalogNm, catalogNmNoEsc) || !checkIfWildCard(schemaNm,
schemaNmNoEsc) || !checkIfWildCard(
    +tableNm, tableNmNoEsc)) && !metadataId)
    +                    {
    +                        executeException->exception_nr = odbc_SQLSvc_GetSQLCatalogs_ParamError_exn_;
    +                        executeException->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_WILDCARD_NOT_SUPPORTED;
    +                        FUNCTION_RETURN_NUMERIC(EXECUTE_EXCEPTION,("EXECUTE_EXCEPTION"));
    +                    }
    +
    +                    if (strcmp(catalogNm,"") == 0)
    +                        strcpy(tableName1,SEABASE_MD_CATALOG);
    +                    else
    +                        strcpy(tableName1, catalogNm);
    +                    tableParam[0] = tableName1;
    +                    convertWildcard(metadataId, TRUE, schemaNm, expSchemaNm);
    +                    convertWildcardNoEsc(metadataId, TRUE, schemaNm, schemaNmNoEsc);
    +                    convertWildcard(metadataId, TRUE, tableNm, expTableNm);
    +                    convertWildcardNoEsc(metadataId, TRUE, tableNm, tableNmNoEsc);
    +                    inputParam[0] = schemaNmNoEsc;
    +                    inputParam[1] = expSchemaNm;
    +                    inputParam[2] = tableNmNoEsc;
    +                    inputParam[3] = expTableNm;
    +                    inputParam[4] = NULL;
    +
    +                    snprintf((char *)sqlString->dataValue._buffer, totalSize,
    +                        "select obj.CATALOG_NAME PROCEDURE_CAT, obj.SCHEMA_NAME PROCEDURE_SCHEM,
"
    +			"obj.OBJECT_NAME PROCEDURE_NAME, cast(NULL as varchar(10)) R1,cast(NULL as varchar(10))
R2,"
    +                        "cast(NULL as varchar(10)) R3, cast(NULL as varchar(10)) REMARKS,
cast(0 as smallint) PROCEDURE_TYPE, "
    +                        "obj.OBJECT_NAME SPECIFIC_NAME "
    +                        " from TRAFODION.\"_MD_\".OBJECTS obj "
    +                        " where "
    +                        " (obj.SCHEMA_NAME = '%s' or trim(obj.SCHEMA_NAME) LIKE '%s'
ESCAPE '\\')"
    +                        " and obj.OBJECT_TYPE='UR' "
    +                        " order by obj.OBJECT_NAME"
    +                        " FOR READ UNCOMMITTED ACCESS;",
    +                        inputParam[0], inputParam[1]);
    +                    break;
    +                case SQL_API_SQLPROCEDURECOLUMNS:
    +                    if ((!checkIfWildCard(catalogNm, catalogNmNoEsc) || !checkIfWildCard(schemaNm,
schemaNmNoEsc) || !checkIfWildCard(
    +tableNm, tableNmNoEsc)) && !metadataId)
    +                    {
    +                        executeException->exception_nr = odbc_SQLSvc_GetSQLCatalogs_ParamError_exn_;
    +                        executeException->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_WILDCARD_NOT_SUPPORTED;
    +                        FUNCTION_RETURN_NUMERIC(EXECUTE_EXCEPTION,("EXECUTE_EXCEPTION"));
    +                    }
    +
    +                    if (strcmp(catalogNm,"") == 0)
    +                        strcpy(tableName1,SEABASE_MD_CATALOG);
    +                    else
    +                        strcpy(tableName1, catalogNm);
    +                    tableParam[0] = tableName1;
    +                    convertWildcard(metadataId, TRUE, schemaNm, expSchemaNm);
    +                    convertWildcardNoEsc(metadataId, TRUE, schemaNm, schemaNmNoEsc);
    +                    convertWildcard(metadataId, TRUE, tableNm, expTableNm);
    +		            convertWildcardNoEsc(metadataId, TRUE, tableNm, tableNmNoEsc);
    +                    convertWildcard(metadataId, TRUE, columnNm, expColumnNm);
    +                    convertWildcardNoEsc(metadataId, TRUE, columnNm, columnNmNoEsc);
    +                    inputParam[0] = schemaNmNoEsc;
    +                    inputParam[1] = expSchemaNm;
    +                    inputParam[2] = tableNmNoEsc;
    +                    inputParam[3] = expTableNm;
    +                    inputParam[4] = columnNmNoEsc;
    +                    inputParam[5] = expColumnNm;
    +                    inputParam[6] = NULL;
    +
    +                    snprintf((char *)sqlString->dataValue._buffer, totalSize,
    +                            "select obj.CATALOG_NAME PROCEDURE_CAT, obj.SCHEMA_NAME PROCEDURE_SCHEM,"
    +                            "obj.OBJECT_NAME PROCEDURE_NAME, cols.COLUMN_NAME COLUMN_NAME,
"
    +                            "cast((case when cols.DIRECTION='I' then 1 when cols.DIRECTION='N'
then 2 when cols.DIRECTION='O' then 3 e
    +lse 0 end) as smallint) COLUMN_TYPE, "
    +                            "cols.FS_DATA_TYPE DATA_TYPE, cols.SQL_DATA_TYPE TYPE_NAME,
"
    +                            "cols.COLUMN_PRECISION \"PRECISION\", cols.COLUMN_SIZE LENGTH,
cols.COLUMN_SCALE SCALE, "
    +                            "cast(1 as smallint) RADIX, cols.NULLABLE NULLABLE, cast(NULL
as varchar(10)) REMARKS, "
    +                            "cols.DEFAULT_VALUE COLUMN_DEF, cols.FS_DATA_TYPE SQL_DATA_TYPE,
cast(0 as smallint) SQL_DATETIME_SUB, "
    +                            "cols.COLUMN_SIZE CHAR_OCTET_LENGTH, cols.COLUMN_NUMBER ORDINAL_POSITION,
"
    +                            "cols.NULLABLE IS_NULLABLE, cols.COLUMN_NAME SPECIFIC_NAME"
    +                            " from TRAFODION.\"_MD_\".OBJECTS obj "
    +                            " left join TRAFODION.\"_MD_\".COLUMNS cols on obj.OBJECT_UID=cols.OBJECT_UID
"
    +			    " left join TRAFODION.\"_MD_\".KEYS keys on cols.COLUMN_NAME=keys.COLUMN_NAME
and cols.OBJECT_UID=keys.OBJ
    --- End diff --
    
    Is this outer join with the keys table really needed?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message