[OS-JIRA] Created: (CAY-152) SQLTemplate no longer escapes single-quote properly

From: jir..bjectstyle.org
Date: Mon Jun 21 2004 - 11:00:46 EDT

  • Next message: jir..bjectstyle.org: "[OS-JIRA] Created: (CAY-153) Can't save model"

    Message:

      A new issue has been created in JIRA.

    ---------------------------------------------------------------------
    View the issue:

      http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-152

    Here is an overview of the issue:
    ---------------------------------------------------------------------
            Key: CAY-152
        Summary: SQLTemplate no longer escapes single-quote properly
           Type: Bug

         Status: Assigned
       Priority: Major

        Project: Cayenne
     Components:
                 Cayenne Core Library
       Versions:
                 1.1 [DEV]

       Assignee: Andrus Adamchik
       Reporter: Neil Pierson

        Created: Mon, 21 Jun 2004 10:59 AM
        Updated: Mon, 21 Jun 2004 10:59 AM

    Description:
    Sample code, where USER_NAME = Patty O'Furniture:

    String sql = "INSERT INTO NHLDB.CONTEXTAUDIT ";
    sql += " (APP_CONTEXT, APP_NAME, AUDIT_DATE, PAGE_NAME, TEAM_NAME, USER_NAME) ";
    sql += " VALUES ";
    sql += " ('" + appContext + "', 'StatsContract', SYSDATE, '" + pageName;
    sql += "', '";
    sql += StatsUtils.teamAbbrevFromCookieValue(cookieValue);
    sql += "', ";
    sql += "'" + StatsUtils.userFromCookieValue(cookieValue) + "' )";

    SQLTemplate updateAuditQuery = new SQLTemplate(ContextAudit.class, sql, false);
    getDataContext().performQuery(updateAuditQuery);

    generates this SQL, and this error:

    QueryLogger: INSERT INTO NHLDB.CONTEXTAUDIT (APP_CONTEXT, APP_NAME, AUDIT_DATE, PAGE_NAME, TEAM_NAME, USER_NAME)
    VALUES ('CURRENT SEASON SALARIES', 'StatsContract', SYSDATE, 'TabularContractDisplay', 'NYC', 'O'Furniture Patty' )
    statscontract INFO [Thread-6 2004-21-06 10:50:12] QueryLogger: *** error.
    java.sql.SQLException: ORA-00917: missing comma

    I think it should be 'O''Furniture Patty'

    ---------------------------------------------------------------------
    JIRA INFORMATION:
    This message is automatically generated by JIRA.

    If you think it was sent incorrectly contact one of the administrators:
       http://objectstyle.org/jira/secure/Administrators.jspa

    If you want more information on JIRA, or have a bug to report see:
       http://www.atlassian.com/software/jira



    This archive was generated by hypermail 2.0.0 : Mon Jun 21 2004 - 11:00:48 EDT