Uploaded image for project: 'CUBRID APIs'
  1. CUBRID APIs
  2. APIS-693

LIMIT and OFFSET do not work together as parameters

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Perl Driver
    • Labels:
      None

      Description

      The LIMIT and OFFSET clauses do not work together as parameters on a SELECT statement. The example script returns 21 rows instead of 3.

      Note that it works if the values for LIMIT and OFFSET are embeded in the query, but not if provided as parameters.

      Thank you.

        Activity

        Hide
        cn15800 谢韦华[Bert] added a comment -

        We will test this problem as soon as possible

        Show
        cn15800 谢韦华[Bert] added a comment - We will test this problem as soon as possible
        Hide
        cn15800 谢韦华[Bert] added a comment - - edited

        If user do not set the data type of bind data, driver will set the default data type as string:

        {code}
        cci_bind_param(con,1,CCI_A_TYPE_STR,"2",CCI_U_TYPE_STRING,(char)NULL);{code}

        I have test the issue with cci,it is invalid for 'offset', user need to set correct data type,for example

        Show
        cn15800 谢韦华[Bert] added a comment - - edited If user do not set the data type of bind data, driver will set the default data type as string: {code} cci_bind_param(con,1,CCI_A_TYPE_STR,"2",CCI_U_TYPE_STRING,(char)NULL);{code} I have test the issue with cci,it is invalid for 'offset', user need to set correct data type,for example
        Hide
        cn15800 谢韦华[Bert] added a comment - - edited

        So the program should be(You only need to set the type of 'offset'):

        {code}
        my $sth = $dbh->prepare(
        qq{SELECT code, nation_code
        FROM athlete
        ORDER BY nation_code DESC
        LIMIT ? OFFSET ?
        });

        $sth->bind_param(1,3);
        $sth->bind_param(2,2,SQL_INTEGER);
        $sth->execute();{code}
        Show
        cn15800 谢韦华[Bert] added a comment - - edited So the program should be(You only need to set the type of 'offset'): {code} my $sth = $dbh->prepare( qq{SELECT code, nation_code FROM athlete ORDER BY nation_code DESC LIMIT ? OFFSET ? }); $sth->bind_param(1,3); $sth->bind_param(2,2,SQL_INTEGER); $sth->execute();{code}
        Hide
        cn15800 谢韦华[Bert] added a comment -

        Aonther problem:

        data

        {code}
        14532 'ZIM'
        12397 'ZAM'
        10709 'YUG'
        10806 'YUG'
        10808 'YUG'
        .............{code}

        cci result,

        {code}
        10808 YUG
        10806 YUG
        10801 YUG{code}

        csql result

        {code}
        10709 'YUG'
        10806 'YUG'
        10808 'YUG'{code}

        The result of cci is not correct in my opinion,so the other drivers are not correct,too.

        Show
        cn15800 谢韦华[Bert] added a comment - Aonther problem: data {code} 14532 'ZIM' 12397 'ZAM' 10709 'YUG' 10806 'YUG' 10808 'YUG' .............{code} cci result, {code} 10808 YUG 10806 YUG 10801 YUG{code} csql result {code} 10709 'YUG' 10806 'YUG' 10808 'YUG'{code} The result of cci is not correct in my opinion,so the other drivers are not correct,too.

          People

          • Assignee:
            cn15800 谢韦华[Bert]
            Reporter:
            stefans Stefan Suciu
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: