[ 
https://issues.apache.org/jira/browse/TRAFODION-1698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15575518#comment-15575518
 ] 

ASF GitHub Bot commented on TRAFODION-1698:
-------------------------------------------

Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/762#discussion_r83433726
  
    --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp ---
    @@ -4982,40 +4982,39 @@ odbc_SQLSvc_GetSQLCatalogs_sme_(
                         "cast(PKCO.CATALOG_NAME as varchar(128)) PKTABLE_CAT, "
                         "cast(PKCO.SCHEMA_NAME as varchar(128)) PKTABLE_SCHEM, 
"
                         "cast(PKCO.TABLE_NAME as varchar(128)) PKTABLE_NAME, "
    -                    "cast(PKCO.COLUMN_NAME as varchar(128)) 
PKCOLUMNS_NAME, "
    +                    "cast(PKCO.COLUMN_NAME as varchar(128)) PKCOLUMN_NAME, 
"
                         "cast(FKCO.CATALOG_NAME as varchar(128)) FKTABLE_CAT, "
                         "cast(PKCO.SCHEMA_NAME as varchar(128)) FKTABLE_SCHEM, 
"
                         "cast(FKCO.TABLE_NAME as varchar(128)) FKTABLE_NAME, "
                         "cast(FKCO.COLUMN_NAME as varchar(128)) FKCOLUMN_NAME, 
"
                         "cast(FKKV.ORDINAL_POSITION as smallint) KEY_SEQ, "
                         "cast(0 as smallint) update_rule, " // not support
                         "cast(0 as smallint) delete_rule, " // not support
    -                    "cast(PKCO.COLUMN_NAME as varchar(128)) fk_name, "
    -                    "cast(PKCO.COLUMN_NAME as varchar(128)) PK_NAME, "
    -                    "cast(0 as smallint) DEFERRABILITY "
    +                    "cast(FKKV.CONSTRAINT_NAME as varchar(128)) FK_NAME, "
    +                    "cast(PKKV.CONSTRAINT_NAME as varchar(128)) PK_NAME, "
    +                    "cast(0 as smallint) DEFERRABILITY " // not support
                         "from "
                         "TRAFODION.\"_MD_\".REF_CONSTRAINTS_VIEW rcv, "
                         "TRAFODION.\"_MD_\".KEYS_VIEW PKKV, "
                         "TRAFODION.\"_MD_\".KEYS_VIEW FKKV, "
                         "TRAFODION.\"_MD_\".COLUMNS_VIEW PKCO, "
                         "TRAFODION.\"_MD_\".COLUMNS_VIEW FKCO "
                         "where "
    -                    "PKKV.CONSTRAINT_NAME = rcv.CONSTRAINT_NAME "
    -                    "and FKKV.CONSTRAINT_NAME = rcv.UNIQUE_CONSTRAINT_NAME 
"
    +                    "FKKV.CONSTRAINT_NAME = rcv.CONSTRAINT_NAME "
    +                    "and PKKV.CONSTRAINT_NAME = rcv.UNIQUE_CONSTRAINT_NAME 
"
                         "and PKCO.TABLE_NAME = PKKV.TABLE_NAME "
                         "and FKCO.TABLE_NAME = FKKV.TABLE_NAME "
                         "and PKCO.COLUMN_NAME = PKKV.COLUMN_NAME "
                         "and FKCO.COLUMN_NAME = FKKV.COLUMN_NAME "
    -                    "and (rcv.TABLE_NAME = '%s' or trim(rcv.TABLE_NAME) 
LIKE '%s' ESCAPE '\\') "
                         "and (PKCO.SCHEMA_NAME = '%s' or 
trim(PKCO.SCHEMA_NAME) LIKE '%s' ESCAPE '\\') "
                         "and (PKCO.TABLE_NAME = '%s' or trim(PKCO.TABLE_NAME) 
LIKE '%s' ESCAPE '\\') "
                         "and (FKCO.SCHEMA_NAME = '%s' or 
trim(FKCO.SCHEMA_NAME) LIKE '%s' ESCAPE '\\') "
    -                    "and (FKCO.TABLE_NAME = '%s' or trim(FKCO.TABLE_NAME) 
LIKE '%s' ESCAPE '\\');",
    --- End diff --
    
    Is there a need to add  a condition on CONSTRAINT_TYPE in the where clause? 
You can try to enhance your test script to create the foreign key table with a 
primary key and check the output. BTW, thanks for adding the test script


> ODBC: trafodion doesn't support API SQLForeignKeys
> --------------------------------------------------
>
>                 Key: TRAFODION-1698
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-1698
>             Project: Apache Trafodion
>          Issue Type: Improvement
>          Components: connectivity-dcs
>    Affects Versions: 1.0 (pre-incubation), 2.0-incubating
>         Environment: client platform: windows7, windows8, centos6.7, suse11
>            Reporter: Gao, Rui-Xian
>            Assignee: Weiqing Xu
>
> API SQLForeignKeys returned error that the API  type is not supported.
> To reproduce --
> create table TDV5WYPAQVA (V5WYPAQVJJ  char(10) CHARACTER SET ucs2 not null 
> not droppable, PDO_6ERNAZ  char(10) CHARACTER SET ucs2, primary 
> key(V5WYPAQVJJ)) NO PARTITION
> create table TDV5WYPAQVB (LRO90EZUSH  char(10) CHARACTER SET ucs2 not null 
> not droppable, IKLI4HXBSC  char(10) CHARACTER SET ucs2, primary 
> key(LRO90EZUSH), foreign key (IKLI4HXBSC) references TDV5WYPAQVA(V5WYPAQVJJ)) 
> NO PARTITION
> create table TDV5WYPAQVC (BG1TCQFK2X  char(10) CHARACTER SET ucs2 not null 
> not droppable, W8UMGMNY7F  char(10) CHARACTER SET ucs2, primary 
> key(BG1TCQFK2X), foreign key (W8UMGMNY7F) references TDV5WYPAQVB(LRO90EZUSH)) 
> NO PARTITION
> ==========================
> SQLForeignKeys(hstmt, TRAFODION, 9, RACHEL_ODBCTEST_L, 17, TDV5WYPAQVA, 11, 
> TRAFODION, 9, RACHEL_ODBCTEST_L, 17, <empty>, 0)
> 10:46:03  ***ERROR: SQLForeignKeys: Expected: SQL_SUCCESS Actual: SQL_ERROR
>    File: ../../../../src/coast/coast_unified/src/forkeys.c   Line: 302
>    State: HYC00
>    Native Error: 1
>    Error: [Trafodion ODBC Driver][DCS Server] OPTIONAL FEATURE NOT 
> IMPLEMENTED.UNSUPPORTED INPUT SMD API TYPE



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to