Announcement

Collapse
No announcement yet.

Missing ")" bracket in generated code

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Missing ")" bracket in generated code

    i have my onAfterInsert event coded

    sc_exec_sql("INSERT INTO hcm_emp_history (person_id, person_type, effective, pay_cd, amount) values ( {person_id}, {person_type}, {effective}, 'pay', 998 ) ; ");


    But in the generated SC code (i grabbed in server) it missed the ")" (as below, AFTER 998) in file "EmployeeHistory_apl.php"
    $nm_select ="INSERT INTO hcm_emp_history (person_id, person_type, effective, pay_cd, amount) values ( $this->person_id , $this->person_type , $this->effective , 'pay', 998;

    It's a serious bug and kindly fix it ASAP.

    I am not able to proceed...

  • #2
    Maybe ; is not necesary.

    Comment


    • #3
      what do you mean?

      Or probably you can tell me what's the next step?

      I have re-verified and run in DB tool, it's a valid SQL statement, and sc_exec_sql is vaid to run in onAfterInsert event
      sc_exec_sql("INSERT INTO hcm_emp_salary (person_id, person_type, effective, pay_cd, amount) values ( {person_id}, {person_type}, {effective}, 'pay', 998 ) ; ");

      i really don't know what else to do to fix the issue.

      Plz help & thanks
      Last edited by weilies; 11-15-2014, 09:14 PM.

      Comment


      • #4
        i can confirmed it's a BUG
        coz i tried following statement and it worked !


        sc_exec_sql("INSERT INTO hcm_emp_salary set person_id = {person_id} , person_type = '{person_type}' , effective = '{effective}', pay_cd = 'pay' , amount = 12345 ; ");

        Comment


        • #5
          says well alvagar.
          the ';' NOT must be added if the statement is a parameter of a function.
          sc_exec_sql ("INSERT INTO hcm_emp_history (person_id, person_type, effective, pay_cd, amount) values ( {person_id}, {person_type}, {effective}, 'pay', 998 )");
          is equivalent to:
          sSql = "INSERT INTO hcm_emp_history (person_id, person_type, effective, pay_cd, amount) values ( {person_id}, {person_type}, {effective}, 'pay', 998 )";
          sc_exec_sql (sSql);
          hello
          Henry
          Last edited by henry1311; 11-16-2014, 04:16 AM.

          Comment


          • #6
            The fact that the other statement with the ';' works is the real bug as it shouldn't. You don't close sql statements with a ';' within a variable, which is standard to embedded sql drivers. So leave that out your original code should work. Feature request would be that SC will generate an errorlist while parsing. These problems are hard to find sometimes, especiallly when you have a lot of custom code.
            Albert Drent
            aducom software netherlands
            scriptcase partner, reseller, support and (turn-key) development
            www.scriptcase.eu / www.scriptcase.nl

            Comment

            Working...
            X