ssteenkiste / nettiers

Automatically exported from code.google.com/p/nettiers
1 stars 0 forks source link

Reserved keywords for column names not being quoted in generated stored procs (procedures.sql) #295

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
 CREATE TABLE  "ReservedKeyword" 
    (   "ID" RAW(16) NOT NULL ENABLE, 
    "Number" NVARCHAR2(2000) NOT NULL ENABLE, 
    "CREATED" TIMESTAMP (6) NOT NULL ENABLE, 
    "LASTMODIFIED" TIMESTAMP (6) NOT NULL ENABLE, 
     CONSTRAINT "PK_SIR" PRIMARY KEY ("ID") ENABLE, 
    )
 /

2.  Create project for Oracle

What is the expected output? What do you see instead?
Where a column name is a reserved keyword (like "Number" above) the name 
isn't being quoted.
Here is a sample of a find proc for the above table:

create or replace PROCEDURE       ReservedKeyword_Find
    (
        p_SearchUsingOR IN NUMBER  ,
        p_Id IN RAW  ,
        p_Number IN NVARCHAR2  ,
        p_Created IN TIMESTAMP(6)  ,
        p_Lastmodified IN TIMESTAMP(6)  ,
        cur_OUT IN OUT types.cursorType  
    )
                IS
                BEGIN

                open cur_OUT for

                SELECT
                  ID
    , Number
    , CREATED
    , LASTMODIFIED
                FROM
                ProjectDAL.ReservedKeyword
                WHERE 
 Number = p_Number OR p_Number is null 
    AND CREATED = p_Created OR p_Created is null 
    AND LASTMODIFIED = p_Lastmodified OR p_Lastmodified is null 
AND p_SearchUsingOR = 0                         

                UNION
                    SELECT
                      ID
    , Number
    , CREATED
    , LASTMODIFIED
                    FROM
                    ProjectDAL.ReservedKeyword
                    WHERE 
 Number = p_Number AND p_Number is not null 
    OR CREATED = p_Created AND p_Created is not null 
    OR LASTMODIFIED = p_Lastmodified AND p_Lastmodified is not null 
AND p_SearchUsingOR = 1;            
    END;

    /

What version of .netTiers and CodeSmith are you using?
.netTiers 2.3, CodeSmith 5.2

Please provide any additional information below.
When running procedures.sql with the problem above (taking into account 
fix for TIMESTAMP(6) previously reported) you get the error:

PL/SQL: ORA-00936: missing expression

Like in SQL with [ and ] I don't see the harm in quoting all column 
names.  Doing so fixed my problem in this case.

Thanks,
Brian

Original issue reported on code.google.com by wordry...@gmail.com on 16 Apr 2010 at 5:14

GoogleCodeExporter commented 9 years ago
Hello,

Did you create a patch for this?

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 21 Sep 2010 at 12:35