Announcement

Collapse
No announcement yet.

[SOLVED]Bug in generatig a grid when sql statement contains a variable

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

  • [SOLVED]Bug in generatig a grid when sql statement contains a variable

    Hello,

    I have found a bug in V8 that was NOT present in V7.

    To reproduce this bug using SC V8, please follow these steps:

    1) create a simple grid application using whatever sql statement you prefer.
    For the sake of this example I am using this trivial sql statement:

    SELECT
    MYFIELD
    FROM
    MYTABLE

    2) Generate and run the application.
    So far so good: it works (of course MYTABLE must exists with a field named MYFIELD)

    3) Now modify the sql statement, replacing the table name with a variable, like this:

    SELECT
    MYFIELD
    FROM
    [TABVAR]

    4) Generate and run the application.

    5) At run time you will be prompted to enter a value for variable TABVAR. Please enter MYTABLE as a value.
    You should get this error message:

    Parse error: syntax error, unexpected '$_SESSION' (T_VARIABLE), expecting identifier (T_STRING) in /opt/NetMake/v8/wwwroot/scriptcase/app/Test/TEST/index.php on line 540

    6) If you look at the generated code you see that variable $_SESSION has been prefixed with a \ (backslash), which causes a syntax error in the PHP parser.
    I have already opened a ticket and tried to explain this bug to the support team but with no success.
    They are not able to reproduce the bug. I guess we have difficulties in understanding each other.
    My portoguese is honestly zero and we have some issues in understanding each other using english.

    Can you please confirm you can reproduce it ?

    My hope is that someone fluent in portuguese can open this bug to the support team.

    Thanks a lot.
    Massimiliano Campagnoli

  • #2
    Hello maxi,

    Did you get any responce on you message? I have same problem and need to remove "\" sign from compiled grid applications:

    Parse error: syntax error, unexpected '$_SESSION' (T_VARIABLE), expecting identifier (T_STRING) in /opt/NetMake/v8/wwwroot/scriptcase/app/AntiFraud_D108854002/SIP_Business_number/index.php on line 541

    $this->nm_tabela = "number join user on number.userid=user.id and user.username='" . \$_SESSION['username'] . "'";
    ^^^^
    With best regards,

    Stanislav

    Comment


    • #3
      Hello,

      I was able to reproduce the issue. I will pass it on to our bugs/development team.

      regards,
      Bernhard Bernsmann

      Comment


      • #4
        Originally posted by Vikulov View Post
        Hello maxi,

        Did you get any responce on you message? I have same problem and need to remove "\" sign from compiled grid applications:

        Parse error: syntax error, unexpected '$_SESSION' (T_VARIABLE), expecting identifier (T_STRING) in /opt/NetMake/v8/wwwroot/scriptcase/app/AntiFraud_D108854002/SIP_Business_number/index.php on line 541

        $this->nm_tabela = "number join user on number.userid=user.id and user.username='" . \$_SESSION['username'] . "'";
        ^^^^
        With best regards,

        Stanislav
        Hello Stanislav,
        I have not received any response yet but there is a workardound that to me it's better that the bug itself.
        Use a feature I didn't know about before experimenting against this bug: Variable for Table.

        In the SQL from clause just leave the original table name ( MYTABLE ) without trying to replace it it with a variable.
        Then fill the two fields below, called : Variable for Table.
        I have attached a picture to explain better.

        Please note that MYVAR in the field Variable for Table must entered WITHOUT square brackets and in the field just below it you must enter the original table name : MYTABLE.
        Scriptcase will substitute, at run time, the content of MYVAR to the string MYTABLE.
        You can set the content of MYVAR in an event or where you want to. I have personally set MYVAR in the onApplicationInit event.
        Attached Files
        Last edited by maxi; 01-11-2015, 05:47 AM.
        Massimiliano Campagnoli

        Comment


        • #5
          Hello,

          This problem has been fixed. Please update your ScriptCase.
          Best Regards,
          John L. Santos

          Bug Tracker Team
          NetMake - IT Solutions

          Comment

          Working...
          X